From a51b64c6b777b6622671a25d9e1e98281b7da141 Mon Sep 17 00:00:00 2001 From: Deepak Selvakumar Date: Wed, 29 Jun 2022 20:00:14 +0530 Subject: [PATCH] feat(release): Update SDK to use API generated on 2022-06-30 Signed-off-by: Deepak Selvakumar --- README.md | 2 +- ibm_vpc/vpc_v1.py | 54229 ++++++++++++++++++-------------- test/integration/test_gen2.py | 433 +- test/unit/test_vpc_v1.py | 15717 +++++---- 4 files changed, 40700 insertions(+), 29681 deletions(-) diff --git a/README.md b/README.md index 5f50d60..37b16d7 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Service Name | Imported Class Name * An [IBM Cloud][ibm-cloud-onboarding] account. * An IAM API key to allow the SDK to access your account. Create an apikey [here](https://cloud.ibm.com/iam/apikeys). -* Python version 3.5.3 or above. +* Python version 3.7.6 or above. ## Installation diff --git a/ibm_vpc/vpc_v1.py b/ibm_vpc/vpc_v1.py index 5c39812..535b7c5 100644 --- a/ibm_vpc/vpc_v1.py +++ b/ibm_vpc/vpc_v1.py @@ -1,6 +1,6 @@ # coding: utf-8 -# (C) Copyright IBM Corp. 2020, 2021, 2022. +# (C) Copyright IBM Corp. 2022. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ and manage virtual server instances, along with subnets, volumes, load balancers, and more. -API Version: 2022-05-31 +API Version: 2022-06-30 """ from datetime import datetime @@ -50,7 +50,7 @@ class VpcV1(BaseService): @classmethod def new_instance(cls, - version: str = '2022-05-31', + version: str = '2022-06-30', service_name: str = DEFAULT_SERVICE_NAME, generation: int = 2, ) -> 'VpcV1': @@ -59,7 +59,7 @@ def new_instance(cls, external configuration. :param str version: The API version, in format `YYYY-MM-DD`. For the API - behavior documented here, specify any date between `2022-06-10` and today's + behavior documented here, specify any date between `2022-07-06` and today's date (UTC). """ if version is None: @@ -75,7 +75,7 @@ def new_instance(cls, return service def __init__(self, - version: str = '2022-05-31', + version: str = '2022-06-30', authenticator: Authenticator = None, generation: int = 2, ) -> None: @@ -83,7 +83,7 @@ def __init__(self, Construct a new client for the vpc service. :param str version: The API version, in format `YYYY-MM-DD`. For the API - behavior documented here, specify any date between `2022-06-10` and today's + behavior documented here, specify any date between `2022-07-06` and today's date (UTC). :param Authenticator authenticator: The authenticator specifies the authentication mechanism. @@ -893,7 +893,7 @@ def create_vpc_route(self, *, action: str = None, name: str = None, - next_hop: 'RouteNextHopPrototype' = None, + next_hop: 'RoutePrototypeNextHop' = None, **kwargs ) -> DetailedResponse: """ @@ -923,9 +923,9 @@ def create_vpc_route(self, :param str name: (optional) The user-defined name for this route. If unspecified, the name will be a hyphenated list of randomly-selected words. Names must be unique within the VPC routing table the route resides in. - :param RouteNextHopPrototype next_hop: (optional) If `action` is `deliver`, - the next hop that packets will be delivered to. For - other `action` values, it must be omitted or specified as `0.0.0.0`. + :param RoutePrototypeNextHop next_hop: (optional) If `action` is `deliver`, + the next hop that packets will be delivered to. For other `action` + values, it must be omitted or specified as `0.0.0.0`. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse with `dict` result representing a `Route` object @@ -1203,6 +1203,7 @@ def list_vpc_routing_tables(self, def create_vpc_routing_table(self, vpc_id: str, *, + accept_routes_from: List['ResourceFilter'] = None, name: str = None, route_direct_link_ingress: bool = None, route_transit_gateway_ingress: bool = None, @@ -1218,6 +1219,11 @@ def create_vpc_routing_table(self, table, and contains the information necessary to create the new routing table. :param str vpc_id: The VPC identifier. + :param List[ResourceFilter] accept_routes_from: (optional) The filters + specifying the resources that may create routes in this routing table. + At present, only the `resource_type` filter is permitted, and only the + `vpn_server` value is supported, but filter support is expected to expand + in the future. :param str name: (optional) The user-defined name for this routing table. Names must be unique within the VPC the routing table resides in. If unspecified, the name will be a hyphenated list of randomly-selected words. @@ -1266,6 +1272,8 @@ def create_vpc_routing_table(self, if vpc_id is None: raise ValueError('vpc_id must be provided') + if accept_routes_from is not None: + accept_routes_from = [convert_model(x) for x in accept_routes_from] if routes is not None: routes = [convert_model(x) for x in routes] headers = {} @@ -1280,6 +1288,7 @@ def create_vpc_routing_table(self, } data = { + 'accept_routes_from': accept_routes_from, 'name': name, 'route_direct_link_ingress': route_direct_link_ingress, 'route_transit_gateway_ingress': route_transit_gateway_ingress, @@ -1311,6 +1320,8 @@ def create_vpc_routing_table(self, def delete_vpc_routing_table(self, vpc_id: str, id: str, + *, + if_match: str = None, **kwargs ) -> DetailedResponse: """ @@ -1322,6 +1333,8 @@ def delete_vpc_routing_table(self, :param str vpc_id: The VPC identifier. :param str id: The routing table identifier. + :param str if_match: (optional) If present, the request will fail if the + specified ETag value does not match the resource's current ETag value. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse @@ -1331,7 +1344,9 @@ def delete_vpc_routing_table(self, raise ValueError('vpc_id must be provided') if id is None: raise ValueError('id must be provided') - headers = {} + headers = { + 'If-Match': if_match + } sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='delete_vpc_routing_table') @@ -1412,6 +1427,8 @@ def update_vpc_routing_table(self, vpc_id: str, id: str, routing_table_patch: 'RoutingTablePatch', + *, + if_match: str = None, **kwargs ) -> DetailedResponse: """ @@ -1424,6 +1441,9 @@ def update_vpc_routing_table(self, :param str vpc_id: The VPC identifier. :param str id: The routing table identifier. :param RoutingTablePatch routing_table_patch: The routing table patch. + :param str if_match: (optional) If present, the request will fail if the + specified ETag value does not match the resource's current ETag value. + Required if the request body includes an array. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse with `dict` result representing a `RoutingTable` object @@ -1437,7 +1457,9 @@ def update_vpc_routing_table(self, raise ValueError('routing_table_patch must be provided') if isinstance(routing_table_patch, RoutingTablePatch): routing_table_patch = convert_model(routing_table_patch) - headers = {} + headers = { + 'If-Match': if_match + } sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='update_vpc_routing_table') @@ -1539,7 +1561,7 @@ def create_vpc_routing_table_route(self, *, action: str = None, name: str = None, - next_hop: 'RouteNextHopPrototype' = None, + next_hop: 'RoutePrototypeNextHop' = None, **kwargs ) -> DetailedResponse: """ @@ -1569,9 +1591,9 @@ def create_vpc_routing_table_route(self, :param str name: (optional) The user-defined name for this route. If unspecified, the name will be a hyphenated list of randomly-selected words. Names must be unique within the VPC routing table the route resides in. - :param RouteNextHopPrototype next_hop: (optional) If `action` is `deliver`, - the next hop that packets will be delivered to. For - other `action` values, it must be omitted or specified as `0.0.0.0`. + :param RoutePrototypeNextHop next_hop: (optional) If `action` is `deliver`, + the next hop that packets will be delivered to. For other `action` + values, it must be omitted or specified as `0.0.0.0`. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse with `dict` result representing a `Route` object @@ -5300,8 +5322,9 @@ def create_instance_group(self, balancer pool only. Used by the instance group when scaling up instances to supply the port for the load balancer pool member. :param LoadBalancerIdentity load_balancer: (optional) The load balancer - that the load balancer pool used by this group - is in. Required when using a load balancer pool. + associated with the specified load balancer pool. + Required if `load_balancer_pool` is specified. + At present, only load balancers in the `application` family are supported. :param LoadBalancerPoolIdentity load_balancer_pool: (optional) If specified, the load balancer pool will be managed by this group. Instances created by this group will have a new load @@ -7478,6 +7501,636 @@ def update_dedicated_host(self, response = self.send(request, **kwargs) return response + ######################### + # Backup policies + ######################### + + + def list_backup_policies(self, + *, + start: str = None, + limit: int = None, + resource_group_id: str = None, + name: str = None, + tag: str = None, + **kwargs + ) -> DetailedResponse: + """ + List all backup policies. + + This request lists all backup policies in the region. Backup policies control + which sources are selected for backup and include a set of backup policy plans + that provide the backup schedules and deletion triggers. + + :param str start: (optional) A server-provided token determining what + resource to start the page on. + :param int limit: (optional) The number of resources to return on a page. + :param str resource_group_id: (optional) Filters the collection to + resources in the resource group with the specified identifier. + :param str name: (optional) Filters the collection to resources with the + exact specified name. + :param str tag: (optional) Filters the collection to resources with the + exact tag value. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `BackupPolicyCollection` object + """ + + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='list_backup_policies') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation, + 'start': start, + 'limit': limit, + 'resource_group.id': resource_group_id, + 'name': name, + 'tag': tag + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + url = '/backup_policies' + request = self.prepare_request(method='GET', + url=url, + headers=headers, + params=params) + + response = self.send(request, **kwargs) + return response + + + def create_backup_policy(self, + *, + match_user_tags: List[str] = None, + match_resource_types: List[str] = None, + name: str = None, + plans: List['BackupPolicyPlanPrototype'] = None, + resource_group: 'ResourceGroupIdentity' = None, + **kwargs + ) -> DetailedResponse: + """ + Create a backup policy. + + This request creates a new backup policy from a backup policy prototype object. + The prototype object is structured in the same way as a retrieved backup policy, + and contains the information necessary to create the new backup policy. + + :param List[str] match_user_tags: (optional) The user tags this backup + policy applies to. Resources that have both a matching user tag and a + matching type will be subject to the backup policy. + :param List[str] match_resource_types: (optional) A resource type this + backup policy applies to. Resources that have both a matching type and a + matching user tag will be subject to the backup policy. + :param str name: (optional) The user-defined name for this backup policy. + Names must be unique within the region this backup policy resides in. If + unspecified, the name will be a hyphenated list of randomly-selected words. + :param List[BackupPolicyPlanPrototype] plans: (optional) The prototype + objects for backup plans to be created for this backup policy. + :param ResourceGroupIdentity resource_group: (optional) The resource group + to use. If unspecified, the account's [default resource + group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is + used. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `BackupPolicy` object + """ + + if plans is not None: + plans = [convert_model(x) for x in plans] + if resource_group is not None: + resource_group = convert_model(resource_group) + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='create_backup_policy') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation + } + + data = { + 'match_user_tags': match_user_tags, + 'match_resource_types': match_resource_types, + 'name': name, + 'plans': plans, + 'resource_group': resource_group + } + data = {k: v for (k, v) in data.items() if v is not None} + data = json.dumps(data) + headers['content-type'] = 'application/json' + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + url = '/backup_policies' + request = self.prepare_request(method='POST', + url=url, + headers=headers, + params=params, + data=data) + + response = self.send(request, **kwargs) + return response + + + def list_backup_policy_plans(self, + backup_policy_id: str, + *, + name: str = None, + **kwargs + ) -> DetailedResponse: + """ + List all plans for a backup policy. + + This request retrieves all plans for a backup policy. Backup plans provide the + backup schedule and deletion triggers. + + :param str backup_policy_id: The backup policy identifier. + :param str name: (optional) Filters the collection to resources with the + exact specified name. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `BackupPolicyPlanCollection` object + """ + + if backup_policy_id is None: + raise ValueError('backup_policy_id must be provided') + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='list_backup_policy_plans') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation, + 'name': name + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['backup_policy_id'] + path_param_values = self.encode_path_vars(backup_policy_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/backup_policies/{backup_policy_id}/plans'.format(**path_param_dict) + request = self.prepare_request(method='GET', + url=url, + headers=headers, + params=params) + + response = self.send(request, **kwargs) + return response + + + def create_backup_policy_plan(self, + backup_policy_id: str, + cron_spec: str, + *, + active: bool = None, + attach_user_tags: List[str] = None, + copy_user_tags: bool = None, + deletion_trigger: 'BackupPolicyPlanDeletionTriggerPrototype' = None, + name: str = None, + **kwargs + ) -> DetailedResponse: + """ + Create a plan for a backup policy. + + This request creates a new backup policy plan from a backup policy plan prototype + object. The prototype object is structured in the same way as a retrieved backup + policy plan, and contains the information necessary to create the new backup + policy plan. + Backups created by this plan will use the resource group of the source being + backed up. + Backups created by this plan will use the plan's name truncated to 46 characters, + followed by a unique 16-character suffix. + + :param str backup_policy_id: The backup policy identifier. + :param str cron_spec: The cron specification for the backup schedule. The + backup policy jobs + (which create and delete backups for this plan) will not start until this + time, and may start for up to 90 minutes after this time. + All backup schedules for plans in the same policy must be at least an hour + apart. + :param bool active: (optional) Indicates whether the plan is active. + :param List[str] attach_user_tags: (optional) User tags to attach to each + backup (snapshot) created by this plan. If unspecified, no user tags will + be attached. + :param bool copy_user_tags: (optional) Indicates whether to copy the + source's user tags to the created backups (snapshots). + :param BackupPolicyPlanDeletionTriggerPrototype deletion_trigger: + (optional) + :param str name: (optional) The user-defined name for this backup policy + plan. Names must be unique within the backup policy this plan resides in. + If unspecified, the name will be a hyphenated list of randomly-selected + words. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `BackupPolicyPlan` object + """ + + if backup_policy_id is None: + raise ValueError('backup_policy_id must be provided') + if cron_spec is None: + raise ValueError('cron_spec must be provided') + if deletion_trigger is not None: + deletion_trigger = convert_model(deletion_trigger) + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='create_backup_policy_plan') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation + } + + data = { + 'cron_spec': cron_spec, + 'active': active, + 'attach_user_tags': attach_user_tags, + 'copy_user_tags': copy_user_tags, + 'deletion_trigger': deletion_trigger, + 'name': name + } + data = {k: v for (k, v) in data.items() if v is not None} + data = json.dumps(data) + headers['content-type'] = 'application/json' + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['backup_policy_id'] + path_param_values = self.encode_path_vars(backup_policy_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/backup_policies/{backup_policy_id}/plans'.format(**path_param_dict) + request = self.prepare_request(method='POST', + url=url, + headers=headers, + params=params, + data=data) + + response = self.send(request, **kwargs) + return response + + + def delete_backup_policy_plan(self, + backup_policy_id: str, + id: str, + *, + if_match: str = None, + **kwargs + ) -> DetailedResponse: + """ + Delete a backup policy plan. + + This request deletes a backup policy plan. This operation cannot be reversed. Any + backups that have been created by the plan will remain but will no longer be + subject to the plan's deletion trigger. Any running jobs associated with the plan + will run to completion before the plan is deleted. + If the request is accepted, the backup policy plan `status` will be set to + `deleting`. Once deletion processing completes, the backup policy plan will no + longer be retrievable. + + :param str backup_policy_id: The backup policy identifier. + :param str id: The backup policy plan identifier. + :param str if_match: (optional) If present, the request will fail if the + specified ETag value does not match the resource's current ETag value. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `BackupPolicyPlan` object + """ + + if backup_policy_id is None: + raise ValueError('backup_policy_id must be provided') + if id is None: + raise ValueError('id must be provided') + headers = { + 'If-Match': if_match + } + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='delete_backup_policy_plan') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['backup_policy_id', 'id'] + path_param_values = self.encode_path_vars(backup_policy_id, id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/backup_policies/{backup_policy_id}/plans/{id}'.format(**path_param_dict) + request = self.prepare_request(method='DELETE', + url=url, + headers=headers, + params=params) + + response = self.send(request, **kwargs) + return response + + + def get_backup_policy_plan(self, + backup_policy_id: str, + id: str, + **kwargs + ) -> DetailedResponse: + """ + Retrieve a backup policy plan. + + This request retrieves a single backup policy plan specified by the identifier in + the URL. + + :param str backup_policy_id: The backup policy identifier. + :param str id: The backup policy plan identifier. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `BackupPolicyPlan` object + """ + + if backup_policy_id is None: + raise ValueError('backup_policy_id must be provided') + if id is None: + raise ValueError('id must be provided') + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='get_backup_policy_plan') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['backup_policy_id', 'id'] + path_param_values = self.encode_path_vars(backup_policy_id, id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/backup_policies/{backup_policy_id}/plans/{id}'.format(**path_param_dict) + request = self.prepare_request(method='GET', + url=url, + headers=headers, + params=params) + + response = self.send(request, **kwargs) + return response + + + def update_backup_policy_plan(self, + backup_policy_id: str, + id: str, + backup_policy_plan_patch: 'BackupPolicyPlanPatch', + *, + if_match: str = None, + **kwargs + ) -> DetailedResponse: + """ + Update a backup policy plan. + + This request updates a backup policy plan with the information in a provided plan + patch. The plan patch object is structured in the same way as a retrieved backup + policy plan and can contains only the information to be updated. + + :param str backup_policy_id: The backup policy identifier. + :param str id: The backup policy plan identifier. + :param BackupPolicyPlanPatch backup_policy_plan_patch: The backup policy + plan patch. + :param str if_match: (optional) If present, the request will fail if the + specified ETag value does not match the resource's current ETag value. + Required if the request body includes an array. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `BackupPolicyPlan` object + """ + + if backup_policy_id is None: + raise ValueError('backup_policy_id must be provided') + if id is None: + raise ValueError('id must be provided') + if backup_policy_plan_patch is None: + raise ValueError('backup_policy_plan_patch must be provided') + if isinstance(backup_policy_plan_patch, BackupPolicyPlanPatch): + backup_policy_plan_patch = convert_model(backup_policy_plan_patch) + headers = { + 'If-Match': if_match + } + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='update_backup_policy_plan') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation + } + + data = json.dumps(backup_policy_plan_patch) + headers['content-type'] = 'application/merge-patch+json' + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['backup_policy_id', 'id'] + path_param_values = self.encode_path_vars(backup_policy_id, id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/backup_policies/{backup_policy_id}/plans/{id}'.format(**path_param_dict) + request = self.prepare_request(method='PATCH', + url=url, + headers=headers, + params=params, + data=data) + + response = self.send(request, **kwargs) + return response + + + def delete_backup_policy(self, + id: str, + *, + if_match: str = None, + **kwargs + ) -> DetailedResponse: + """ + Delete a backup policy. + + This request deletes a backup policy. This operation cannot be reversed. + If the request is accepted, the backup policy `status` will be set to `deleting`. + Once deletion processing completes, the backup policy will no longer be + retrievable. + + :param str id: The backup policy identifier. + :param str if_match: (optional) If present, the request will fail if the + specified ETag value does not match the resource's current ETag value. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `BackupPolicy` object + """ + + if id is None: + raise ValueError('id must be provided') + headers = { + 'If-Match': if_match + } + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='delete_backup_policy') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['id'] + path_param_values = self.encode_path_vars(id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/backup_policies/{id}'.format(**path_param_dict) + request = self.prepare_request(method='DELETE', + url=url, + headers=headers, + params=params) + + response = self.send(request, **kwargs) + return response + + + def get_backup_policy(self, + id: str, + **kwargs + ) -> DetailedResponse: + """ + Retrieve a backup policy. + + This request retrieves a single backup policy specified by the identifier in the + URL. + + :param str id: The backup policy identifier. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `BackupPolicy` object + """ + + if id is None: + raise ValueError('id must be provided') + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='get_backup_policy') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['id'] + path_param_values = self.encode_path_vars(id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/backup_policies/{id}'.format(**path_param_dict) + request = self.prepare_request(method='GET', + url=url, + headers=headers, + params=params) + + response = self.send(request, **kwargs) + return response + + + def update_backup_policy(self, + id: str, + backup_policy_patch: 'BackupPolicyPatch', + *, + if_match: str = None, + **kwargs + ) -> DetailedResponse: + """ + Update a backup policy. + + This request updates a backup policy with the information in a provided backup + policy patch. The backup policy patch object is structured in the same way as a + retrieved backup policy and contains only the information to be updated. + + :param str id: The backup policy identifier. + :param BackupPolicyPatch backup_policy_patch: The backup policy patch. + :param str if_match: (optional) If present, the request will fail if the + specified ETag value does not match the resource's current ETag value. + Required if the request body includes an array. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `BackupPolicy` object + """ + + if id is None: + raise ValueError('id must be provided') + if backup_policy_patch is None: + raise ValueError('backup_policy_patch must be provided') + if isinstance(backup_policy_patch, BackupPolicyPatch): + backup_policy_patch = convert_model(backup_policy_patch) + headers = { + 'If-Match': if_match + } + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='update_backup_policy') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation + } + + data = json.dumps(backup_policy_patch) + headers['content-type'] = 'application/merge-patch+json' + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['id'] + path_param_values = self.encode_path_vars(id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/backup_policies/{id}'.format(**path_param_dict) + request = self.prepare_request(method='PATCH', + url=url, + headers=headers, + params=params, + data=data) + + response = self.send(request, **kwargs) + return response + ######################### # Placement groups ######################### @@ -8749,109 +9402,6 @@ def add_bare_metal_server_network_interface_floating_ip(self, return response - def list_bare_metal_server_network_interface_ips(self, - bare_metal_server_id: str, - network_interface_id: str, - **kwargs - ) -> DetailedResponse: - """ - List all reserved IPs bound to a network interface. - - This request lists all reserved IPs bound to a network interface. - - :param str bare_metal_server_id: The bare metal server identifier. - :param str network_interface_id: The network interface identifier. - :param dict headers: A `dict` containing the request headers - :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `ReservedIPCollectionNetworkInterfaceContext` object - """ - - if bare_metal_server_id is None: - raise ValueError('bare_metal_server_id must be provided') - if network_interface_id is None: - raise ValueError('network_interface_id must be provided') - headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='list_bare_metal_server_network_interface_ips') - headers.update(sdk_headers) - - params = { - 'version': self.version, - 'generation': self.generation - } - - if 'headers' in kwargs: - headers.update(kwargs.get('headers')) - headers['Accept'] = 'application/json' - - path_param_keys = ['bare_metal_server_id', 'network_interface_id'] - path_param_values = self.encode_path_vars(bare_metal_server_id, network_interface_id) - path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips'.format(**path_param_dict) - request = self.prepare_request(method='GET', - url=url, - headers=headers, - params=params) - - response = self.send(request, **kwargs) - return response - - - def get_bare_metal_server_network_interface_ip(self, - bare_metal_server_id: str, - network_interface_id: str, - id: str, - **kwargs - ) -> DetailedResponse: - """ - Retrieve bound reserved IP. - - This request a retrieves the specified reserved IP address if it is bound to the - network interface and bare metal server specified in the URL. - - :param str bare_metal_server_id: The bare metal server identifier. - :param str network_interface_id: The network interface identifier. - :param str id: The reserved IP identifier. - :param dict headers: A `dict` containing the request headers - :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `ReservedIP` object - """ - - if bare_metal_server_id is None: - raise ValueError('bare_metal_server_id must be provided') - if network_interface_id is None: - raise ValueError('network_interface_id must be provided') - if id is None: - raise ValueError('id must be provided') - headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='get_bare_metal_server_network_interface_ip') - headers.update(sdk_headers) - - params = { - 'version': self.version, - 'generation': self.generation - } - - if 'headers' in kwargs: - headers.update(kwargs.get('headers')) - headers['Accept'] = 'application/json' - - path_param_keys = ['bare_metal_server_id', 'network_interface_id', 'id'] - path_param_values = self.encode_path_vars(bare_metal_server_id, network_interface_id, id) - path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips/{id}'.format(**path_param_dict) - request = self.prepare_request(method='GET', - url=url, - headers=headers, - params=params) - - response = self.send(request, **kwargs) - return response - - def delete_bare_metal_server(self, id: str, **kwargs @@ -9620,6 +10170,7 @@ def list_snapshots(self, source_image_id: str = None, source_image_crn: str = None, sort: str = None, + backup_policy_plan_id: str = None, **kwargs ) -> DetailedResponse: """ @@ -9656,6 +10207,8 @@ def list_snapshots(self, sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property in descending order, and the value `name` sorts it by the `name` property in ascending order. + :param str backup_policy_plan_id: (optional) Filters the collection to + backup policy jobs with the backup plan with the specified identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse with `dict` result representing a `SnapshotCollection` object @@ -9679,7 +10232,8 @@ def list_snapshots(self, 'source_volume.crn': source_volume_crn, 'source_image.id': source_image_id, 'source_image.crn': source_image_crn, - 'sort': sort + 'sort': sort, + 'backup_policy_plan.id': backup_policy_plan_id } if 'headers' in kwargs: @@ -11803,6 +12357,7 @@ def delete_security_group_target_binding(self, the target must be attached to at least one other security group. The specified target identifier can be: - A network interface identifier + - A VPN server identifier - An application load balancer identifier - An endpoint gateway identifier Security groups are stateful, so any changes to a target's security groups are @@ -11907,6 +12462,7 @@ def create_security_group_target_binding(self, This request adds a resource to an existing security group. The specified target identifier can be: - A network interface identifier + - A VPN server identifier - An application load balancer identifier - An endpoint gateway identifier When a target is added to a security group, the security group rules are applied @@ -13111,6 +13667,7 @@ def list_vpn_gateway_connection_local_cidrs(self, List all local CIDRs for a VPN gateway connection. This request lists all local CIDRs for a VPN gateway connection. + This request is only supported for policy mode VPN gateways. :param str vpn_gateway_id: The VPN gateway identifier. :param str id: The VPN gateway connection identifier. @@ -13162,6 +13719,7 @@ def remove_vpn_gateway_connection_local_cidr(self, Remove a local CIDR from a VPN gateway connection. This request removes a CIDR from a VPN gateway connection. + This request is only supported for policy mode VPN gateways. :param str vpn_gateway_id: The VPN gateway identifier. :param str id: The VPN gateway connection identifier. @@ -13217,8 +13775,9 @@ def check_vpn_gateway_connection_local_cidr(self, """ Check if the specified local CIDR exists on a VPN gateway connection. - This request succeeds if a CIDR exists on the specified VPN gateway connection and - fails otherwise. + This request succeeds if a CIDR exists on the specified VPN gateway connection, + and fails otherwise. + This request is only supported for policy mode VPN gateways. :param str vpn_gateway_id: The VPN gateway identifier. :param str id: The VPN gateway connection identifier. @@ -13274,9 +13833,10 @@ def add_vpn_gateway_connection_local_cidr(self, """ Set a local CIDR on a VPN gateway connection. - This request adds the specified CIDR to the specified VPN gateway connection. A - request body is not required, and if provided, is ignored. This request succeeds - if the CIDR already exists on the specified VPN gateway connection. + This request adds the specified CIDR to the specified VPN gateway connection. This + request succeeds if the specified CIDR already exists. A request body is not + required, and if provided, is ignored. + This request is only supported for policy mode VPN gateways. :param str vpn_gateway_id: The VPN gateway identifier. :param str id: The VPN gateway connection identifier. @@ -13331,6 +13891,7 @@ def list_vpn_gateway_connection_peer_cidrs(self, List all peer CIDRs for a VPN gateway connection. This request lists all peer CIDRs for a VPN gateway connection. + This request is only supported for policy mode VPN gateways. :param str vpn_gateway_id: The VPN gateway identifier. :param str id: The VPN gateway connection identifier. @@ -13382,6 +13943,7 @@ def remove_vpn_gateway_connection_peer_cidr(self, Remove a peer CIDR from a VPN gateway connection. This request removes a CIDR from a VPN gateway connection. + This request is only supported for policy mode VPN gateways. :param str vpn_gateway_id: The VPN gateway identifier. :param str id: The VPN gateway connection identifier. @@ -13437,8 +13999,9 @@ def check_vpn_gateway_connection_peer_cidr(self, """ Check if the specified peer CIDR exists on a VPN gateway connection. - This request succeeds if a CIDR exists on the specified VPN gateway connection and - fails otherwise. + This request succeeds if a CIDR exists on the specified VPN gateway connection, + and fails otherwise. + This request is only supported for policy mode VPN gateways. :param str vpn_gateway_id: The VPN gateway identifier. :param str id: The VPN gateway connection identifier. @@ -13494,9 +14057,10 @@ def add_vpn_gateway_connection_peer_cidr(self, """ Set a peer CIDR on a VPN gateway connection. - This request adds the specified CIDR to the specified VPN gateway connection. A - request body is not required, and if provided, is ignored. This request succeeds - if the CIDR already exists on the specified VPN gateway connection. + This request adds the specified CIDR to the specified VPN gateway connection. This + request succeeds if the specified CIDR already exists. A request body is not + required, and if provided, is ignored. + This request is only supported for policy mode VPN gateways. :param str vpn_gateway_id: The VPN gateway identifier. :param str id: The VPN gateway connection identifier. @@ -13542,140 +14106,62 @@ def add_vpn_gateway_connection_peer_cidr(self, return response ######################### - # Load balancers + # VPN servers ######################### - def list_load_balancer_profiles(self, - *, - start: str = None, - limit: int = None, - **kwargs - ) -> DetailedResponse: - """ - List all load balancer profiles. - - This request lists all load balancer profiles available in the region. A load - balancer profile specifies the performance characteristics and pricing model for a - load balancer. - - :param str start: (optional) A server-provided token determining what - resource to start the page on. - :param int limit: (optional) The number of resources to return on a page. - :param dict headers: A `dict` containing the request headers - :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancerProfileCollection` object - """ - - headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='list_load_balancer_profiles') - headers.update(sdk_headers) - - params = { - 'version': self.version, - 'generation': self.generation, - 'start': start, - 'limit': limit - } - - if 'headers' in kwargs: - headers.update(kwargs.get('headers')) - headers['Accept'] = 'application/json' - - url = '/load_balancer/profiles' - request = self.prepare_request(method='GET', - url=url, - headers=headers, - params=params) - - response = self.send(request, **kwargs) - return response - - - def get_load_balancer_profile(self, - name: str, - **kwargs - ) -> DetailedResponse: - """ - Retrieve a load balancer profile. - - This request retrieves a load balancer profile specified by the name in the URL. - - :param str name: The load balancer profile name. - :param dict headers: A `dict` containing the request headers - :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancerProfile` object - """ - - if name is None: - raise ValueError('name must be provided') - headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='get_load_balancer_profile') - headers.update(sdk_headers) - - params = { - 'version': self.version, - 'generation': self.generation - } - - if 'headers' in kwargs: - headers.update(kwargs.get('headers')) - headers['Accept'] = 'application/json' - - path_param_keys = ['name'] - path_param_values = self.encode_path_vars(name) - path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancer/profiles/{name}'.format(**path_param_dict) - request = self.prepare_request(method='GET', - url=url, - headers=headers, - params=params) - - response = self.send(request, **kwargs) - return response - - - def list_load_balancers(self, + def list_vpn_servers(self, *, + name: str = None, start: str = None, limit: int = None, + resource_group_id: str = None, + sort: str = None, **kwargs ) -> DetailedResponse: """ - List all load balancers. + List all VPN servers. - This request lists all load balancers in the region. + This request lists all VPN servers. + :param str name: (optional) Filters the collection to resources with the + exact specified name. :param str start: (optional) A server-provided token determining what resource to start the page on. :param int limit: (optional) The number of resources to return on a page. + :param str resource_group_id: (optional) Filters the collection to + resources in the resource group with the specified identifier. + :param str sort: (optional) Sorts the returned collection by the specified + property name in ascending order. A `-` may be prepended to the name to + sort in descending order. For example, the value `-created_at` sorts the + collection by the `created_at` property in descending order, and the value + `name` sorts it by the `name` property in ascending order. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancerCollection` object + :rtype: DetailedResponse with `dict` result representing a `VPNServerCollection` object """ headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='list_load_balancers') + operation_id='list_vpn_servers') headers.update(sdk_headers) params = { 'version': self.version, 'generation': self.generation, + 'name': name, 'start': start, - 'limit': limit + 'limit': limit, + 'resource_group.id': resource_group_id, + 'sort': sort } if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' - url = '/load_balancers' + url = '/vpn_servers' request = self.prepare_request(method='GET', url=url, headers=headers, @@ -13685,80 +14171,84 @@ def list_load_balancers(self, return response - def create_load_balancer(self, - is_public: bool, + def create_vpn_server(self, + certificate: 'CertificateInstanceIdentity', + client_authentication: List['VPNServerAuthenticationPrototype'], + client_ip_pool: str, subnets: List['SubnetIdentity'], *, - listeners: List['LoadBalancerListenerPrototypeLoadBalancerContext'] = None, - logging: 'LoadBalancerLogging' = None, + client_dns_server_ips: List['IP'] = None, + client_idle_timeout: int = None, + enable_split_tunneling: bool = None, name: str = None, - pools: List['LoadBalancerPoolPrototype'] = None, - profile: 'LoadBalancerProfileIdentity' = None, + port: int = None, + protocol: str = None, resource_group: 'ResourceGroupIdentity' = None, - route_mode: bool = None, security_groups: List['SecurityGroupIdentity'] = None, **kwargs ) -> DetailedResponse: """ - Create a load balancer. + Create a VPN server. - This request creates and provisions a new load balancer. + This request creates a new VPN server. - :param bool is_public: Indicates whether this load balancer is public or - private. - At present, if route mode is enabled, the load balancer must be private. - :param List[SubnetIdentity] subnets: The subnets to provision this load - balancer in. The load balancer's availability will depend on the - availability of the zones the specified subnets reside in. - Load balancers in the `network` family allow only one subnet to be - specified. - :param List[LoadBalancerListenerPrototypeLoadBalancerContext] listeners: - (optional) The listeners of this load balancer. - :param LoadBalancerLogging logging: (optional) The logging configuration to - use for this load balancer. See [VPC Datapath - Logging](https://cloud.ibm.com/docs/vpc?topic=vpc-datapath-logging) - on the logging format, fields and permitted values. - To activate logging, the load balancer profile must support the specified - logging - type. - :param str name: (optional) The user-defined name for this load balancer. - If unspecified, the name will be a hyphenated list of randomly-selected - words. - :param List[LoadBalancerPoolPrototype] pools: (optional) The pools of this - load balancer. - :param LoadBalancerProfileIdentity profile: (optional) The profile to use - for this load balancer - If unspecified, `application` will be used. + :param CertificateInstanceIdentity certificate: The certificate instance + for this VPN server. + :param List[VPNServerAuthenticationPrototype] client_authentication: The + methods used to authenticate VPN clients to this VPN server. VPN clients + must authenticate against all specified methods. + :param str client_ip_pool: The VPN client IPv4 address pool, expressed in + CIDR format. The request must not overlap with any existing address + prefixes in the VPC or any of the following reserved address ranges: + - `127.0.0.0/8` (IPv4 loopback addresses) + - `161.26.0.0/16` (IBM services) + - `166.8.0.0/14` (Cloud Service Endpoints) + - `169.254.0.0/16` (IPv4 link-local addresses) + - `224.0.0.0/4` (IPv4 multicast addresses) + The prefix length of the client IP address pool's CIDR must be between + `/9` (8,388,608 addresses) and `/22` (1024 addresses). A CIDR block that + contains twice the number of IP addresses that are required to enable the + maximum number of concurrent connections is recommended. + :param List[SubnetIdentity] subnets: The subnets to provision this VPN + server in. Use subnets in different zones for high availability. + :param List[IP] client_dns_server_ips: (optional) The DNS server addresses + that will be provided to VPN clients connected to this VPN server. + :param int client_idle_timeout: (optional) The seconds a VPN client can be + idle before this VPN server will disconnect it. Specify `0` to prevent + the server from disconnecting idle clients. + :param bool enable_split_tunneling: (optional) Indicates whether the split + tunneling is enabled on this VPN server. + :param str name: (optional) The user-defined name for this VPN server. If + unspecified, the name will be a hyphenated list of randomly-selected words. + Names must be unique within the VPC this VPN server is serving. + :param int port: (optional) The port number to use for this VPN server. + :param str protocol: (optional) The transport protocol to use for this VPN + server. :param ResourceGroupIdentity resource_group: (optional) The resource group to use. If unspecified, the account's [default resource group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - :param bool route_mode: (optional) Indicates whether route mode is enabled - for this load balancer. - At present, public load balancers are not supported with route mode - enabled. :param List[SecurityGroupIdentity] security_groups: (optional) The security - groups to use for this load balancer. If unspecified, the VPC's default + groups to use for this VPN server. If unspecified, the VPC's default security group is used. - The load balancer profile must support security groups. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancer` object + :rtype: DetailedResponse with `dict` result representing a `VPNServer` object """ - if is_public is None: - raise ValueError('is_public must be provided') + if certificate is None: + raise ValueError('certificate must be provided') + if client_authentication is None: + raise ValueError('client_authentication must be provided') + if client_ip_pool is None: + raise ValueError('client_ip_pool must be provided') if subnets is None: raise ValueError('subnets must be provided') + certificate = convert_model(certificate) + client_authentication = [convert_model(x) for x in client_authentication] subnets = [convert_model(x) for x in subnets] - if listeners is not None: - listeners = [convert_model(x) for x in listeners] - if logging is not None: - logging = convert_model(logging) - if pools is not None: - pools = [convert_model(x) for x in pools] - if profile is not None: - profile = convert_model(profile) + if client_dns_server_ips is not None: + client_dns_server_ips = [convert_model(x) for x in client_dns_server_ips] if resource_group is not None: resource_group = convert_model(resource_group) if security_groups is not None: @@ -13766,7 +14256,7 @@ def create_load_balancer(self, headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='create_load_balancer') + operation_id='create_vpn_server') headers.update(sdk_headers) params = { @@ -13775,15 +14265,17 @@ def create_load_balancer(self, } data = { - 'is_public': is_public, + 'certificate': certificate, + 'client_authentication': client_authentication, + 'client_ip_pool': client_ip_pool, 'subnets': subnets, - 'listeners': listeners, - 'logging': logging, + 'client_dns_server_ips': client_dns_server_ips, + 'client_idle_timeout': client_idle_timeout, + 'enable_split_tunneling': enable_split_tunneling, 'name': name, - 'pools': pools, - 'profile': profile, + 'port': port, + 'protocol': protocol, 'resource_group': resource_group, - 'route_mode': route_mode, 'security_groups': security_groups } data = {k: v for (k, v) in data.items() if v is not None} @@ -13794,7 +14286,7 @@ def create_load_balancer(self, headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' - url = '/load_balancers' + url = '/vpn_servers' request = self.prepare_request(method='POST', url=url, headers=headers, @@ -13805,17 +14297,20 @@ def create_load_balancer(self, return response - def delete_load_balancer(self, + def delete_vpn_server(self, id: str, + *, + if_match: str = None, **kwargs ) -> DetailedResponse: """ - Delete a load balancer. + Delete a VPN server. - This request deletes a load balancer. This operation cannot be reversed. A load - balancer cannot be deleted if its `provisioning_status` is `delete_pending`. + This request deletes a VPN server. This operation cannot be reversed. - :param str id: The load balancer identifier. + :param str id: The VPN server identifier. + :param str if_match: (optional) If present, the request will fail if the + specified ETag value does not match the resource's current ETag value. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse @@ -13823,10 +14318,12 @@ def delete_load_balancer(self, if id is None: raise ValueError('id must be provided') - headers = {} + headers = { + 'If-Match': if_match + } sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='delete_load_balancer') + operation_id='delete_vpn_server') headers.update(sdk_headers) params = { @@ -13840,7 +14337,7 @@ def delete_load_balancer(self, path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{id}'.format(**path_param_dict) + url = '/vpn_servers/{id}'.format(**path_param_dict) request = self.prepare_request(method='DELETE', url=url, headers=headers, @@ -13850,20 +14347,19 @@ def delete_load_balancer(self, return response - def get_load_balancer(self, + def get_vpn_server(self, id: str, **kwargs ) -> DetailedResponse: """ - Retrieve a load balancer. + Retrieve a VPN server. - This request retrieves a single load balancer specified by the identifier in the - URL path. + This request retrieves a single VPN server specified by the identifier in the URL. - :param str id: The load balancer identifier. + :param str id: The VPN server identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancer` object + :rtype: DetailedResponse with `dict` result representing a `VPNServer` object """ if id is None: @@ -13871,7 +14367,7 @@ def get_load_balancer(self, headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='get_load_balancer') + operation_id='get_vpn_server') headers.update(sdk_headers) params = { @@ -13886,7 +14382,7 @@ def get_load_balancer(self, path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{id}'.format(**path_param_dict) + url = '/vpn_servers/{id}'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers, @@ -13896,33 +14392,42 @@ def get_load_balancer(self, return response - def update_load_balancer(self, + def update_vpn_server(self, id: str, - load_balancer_patch: 'LoadBalancerPatch', + vpn_server_patch: 'VPNServerPatch', + *, + if_match: str = None, **kwargs ) -> DetailedResponse: """ - Update a load balancer. + Update a VPN server. - This request updates a load balancer. + This request updates the properties of an existing VPN server. Any property + changes will cause all connected VPN clients are disconnected from this VPN server + except for the name change. - :param str id: The load balancer identifier. - :param LoadBalancerPatch load_balancer_patch: The load balancer patch. + :param str id: The VPN server identifier. + :param VPNServerPatch vpn_server_patch: The VPN server patch. + :param str if_match: (optional) If present, the request will fail if the + specified ETag value does not match the resource's current ETag value. + Required if the request body includes an array. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancer` object + :rtype: DetailedResponse with `dict` result representing a `VPNServer` object """ if id is None: raise ValueError('id must be provided') - if load_balancer_patch is None: - raise ValueError('load_balancer_patch must be provided') - if isinstance(load_balancer_patch, LoadBalancerPatch): - load_balancer_patch = convert_model(load_balancer_patch) - headers = {} + if vpn_server_patch is None: + raise ValueError('vpn_server_patch must be provided') + if isinstance(vpn_server_patch, VPNServerPatch): + vpn_server_patch = convert_model(vpn_server_patch) + headers = { + 'If-Match': if_match + } sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='update_load_balancer') + operation_id='update_vpn_server') headers.update(sdk_headers) params = { @@ -13930,7 +14435,7 @@ def update_load_balancer(self, 'generation': self.generation } - data = json.dumps(load_balancer_patch) + data = json.dumps(vpn_server_patch) headers['content-type'] = 'application/merge-patch+json' if 'headers' in kwargs: @@ -13940,7 +14445,7 @@ def update_load_balancer(self, path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{id}'.format(**path_param_dict) + url = '/vpn_servers/{id}'.format(**path_param_dict) request = self.prepare_request(method='PATCH', url=url, headers=headers, @@ -13951,19 +14456,21 @@ def update_load_balancer(self, return response - def get_load_balancer_statistics(self, + def get_vpn_server_client_configuration(self, id: str, **kwargs ) -> DetailedResponse: """ - List all statistics of a load balancer. + Retrieve client configuration. - This request lists statistics of a load balancer. + This request retrieves OpenVPN client configuration on a single VPN server + specified by the identifier in the URL. This configuration includes directives + compatible with OpenVPN releases 2.4 and 2.5. - :param str id: The load balancer identifier. + :param str id: The VPN server identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancerStatistics` object + :rtype: DetailedResponse with `str` result """ if id is None: @@ -13971,7 +14478,7 @@ def get_load_balancer_statistics(self, headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='get_load_balancer_statistics') + operation_id='get_vpn_server_client_configuration') headers.update(sdk_headers) params = { @@ -13981,12 +14488,12 @@ def get_load_balancer_statistics(self, if 'headers' in kwargs: headers.update(kwargs.get('headers')) - headers['Accept'] = 'application/json' + headers['Accept'] = 'text/plain' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{id}/statistics'.format(**path_param_dict) + url = '/vpn_servers/{id}/client_configuration'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers, @@ -13996,42 +14503,57 @@ def get_load_balancer_statistics(self, return response - def list_load_balancer_listeners(self, - load_balancer_id: str, + def list_vpn_server_clients(self, + vpn_server_id: str, + *, + start: str = None, + limit: int = None, + sort: str = None, **kwargs ) -> DetailedResponse: """ - List all listeners for a load balancer. + List all VPN clients for a VPN server. - This request lists all listeners for a load balancer. + This request retrieves all connected VPN clients, and any disconnected VPN clients + that the VPN server has not yet deleted based on its auto-deletion policy. - :param str load_balancer_id: The load balancer identifier. + :param str vpn_server_id: The VPN server identifier. + :param str start: (optional) A server-provided token determining what + resource to start the page on. + :param int limit: (optional) The number of resources to return on a page. + :param str sort: (optional) Sorts the returned collection by the specified + property name in ascending order. A `-` may be prepended to the name to + sort in descending order. For example, the value `-created_at` sorts the + collection by the `created_at` property in descending order. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerCollection` object + :rtype: DetailedResponse with `dict` result representing a `VPNServerClientCollection` object """ - if load_balancer_id is None: - raise ValueError('load_balancer_id must be provided') + if vpn_server_id is None: + raise ValueError('vpn_server_id must be provided') headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='list_load_balancer_listeners') + operation_id='list_vpn_server_clients') headers.update(sdk_headers) params = { 'version': self.version, - 'generation': self.generation + 'generation': self.generation, + 'start': start, + 'limit': limit, + 'sort': sort } if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' - path_param_keys = ['load_balancer_id'] - path_param_values = self.encode_path_vars(load_balancer_id) + path_param_keys = ['vpn_server_id'] + path_param_values = self.encode_path_vars(vpn_server_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/listeners'.format(**path_param_dict) + url = '/vpn_servers/{vpn_server_id}/clients'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers, @@ -14041,106 +14563,33 @@ def list_load_balancer_listeners(self, return response - def create_load_balancer_listener(self, - load_balancer_id: str, - protocol: str, - *, - accept_proxy_protocol: bool = None, - certificate_instance: 'CertificateInstanceIdentity' = None, - connection_limit: int = None, - default_pool: 'LoadBalancerPoolIdentity' = None, - https_redirect: 'LoadBalancerListenerHTTPSRedirectPrototype' = None, - policies: List['LoadBalancerListenerPolicyPrototype'] = None, - port: int = None, - port_max: int = None, - port_min: int = None, + def delete_vpn_server_client(self, + vpn_server_id: str, + id: str, **kwargs ) -> DetailedResponse: """ - Create a listener for a load balancer. + Delete a VPN client. - This request creates a new listener for a load balancer. + This request disconnects and deletes the VPN client from the VPN server. The VPN + client may reconnect unless its authentication permissions for the configured + authentication methods (such as its client certificate) have been revoked. - :param str load_balancer_id: The load balancer identifier. - :param str protocol: The listener protocol. Each listener in the load - balancer must have a unique `port` and `protocol` combination. Additional - restrictions: - - If this load balancer is in the `network` family: - - The protocol must be `tcp` or `udp` (if `udp_supported` is `true`). - - If `default_pool` is set, the pool protocol must match. - - If `https_redirect` is set, the protocol must be `http`. - :param bool accept_proxy_protocol: (optional) If set to `true`, this - listener will accept and forward PROXY protocol information. Supported by - load balancers in the `application` family (otherwise always `false`). - Additional restrictions: - - If this listener has `https_redirect` specified, its - `accept_proxy_protocol` value must - match the `accept_proxy_protocol` value of the `https_redirect` listener. - - If this listener is the target of another listener's `https_redirect`, - its - `accept_proxy_protocol` value must match that listener's - `accept_proxy_protocol` value. - :param CertificateInstanceIdentity certificate_instance: (optional) The - certificate instance used for SSL termination. It is applicable only to - `https` - protocol. - :param int connection_limit: (optional) The connection limit of the - listener. - :param LoadBalancerPoolIdentity default_pool: (optional) The default pool - for this listener. The specified pool must: - - Belong to this load balancer - - Have the same `protocol` as this listener, or have a compatible protocol. - At present, the compatible protocols are `http` and `https`. - - Not already be the `default_pool` for another listener. - :param LoadBalancerListenerHTTPSRedirectPrototype https_redirect: - (optional) The target listener that requests will be redirected to. This - listener must have a - `protocol` of `http`, and the target listener must have a `protocol` of - `https`. - :param List[LoadBalancerListenerPolicyPrototype] policies: (optional) The - policy prototype objects for this listener. - :param int port: (optional) The listener port number, or the inclusive - lower bound of the port range. Each listener in the load balancer must have - a unique `port` and `protocol` combination. - Not supported for load balancers operating with route mode enabled. - :param int port_max: (optional) The inclusive upper bound of the range of - ports used by this listener. Must not be less than `port_min`. - At present, only load balancers operating with route mode enabled, and - public load balancers in the `network` family support different values for - `port_min` and - `port_max`. When route mode is enabled, the value `65535` must be - specified. - The specified port range must not overlap with port ranges used by other - listeners for this load balancer using the same protocol. - :param int port_min: (optional) The inclusive lower bound of the range of - ports used by this listener. Must not be greater than `port_max`. - At present, only load balancers operating with route mode enabled, and - public load balancers in the `network` family support different values for - `port_min` and - `port_max`. When route mode is enabled, the value `1` must be specified. - The specified port range must not overlap with port ranges used by other - listeners for this load balancer using the same protocol. + :param str vpn_server_id: The VPN server identifier. + :param str id: The VPN client identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListener` object + :rtype: DetailedResponse """ - if load_balancer_id is None: - raise ValueError('load_balancer_id must be provided') - if protocol is None: - raise ValueError('protocol must be provided') - if certificate_instance is not None: - certificate_instance = convert_model(certificate_instance) - if default_pool is not None: - default_pool = convert_model(default_pool) - if https_redirect is not None: - https_redirect = convert_model(https_redirect) - if policies is not None: - policies = [convert_model(x) for x in policies] + if vpn_server_id is None: + raise ValueError('vpn_server_id must be provided') + if id is None: + raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='create_load_balancer_listener') + operation_id='delete_vpn_server_client') headers.update(sdk_headers) params = { @@ -14148,67 +14597,47 @@ def create_load_balancer_listener(self, 'generation': self.generation } - data = { - 'protocol': protocol, - 'accept_proxy_protocol': accept_proxy_protocol, - 'certificate_instance': certificate_instance, - 'connection_limit': connection_limit, - 'default_pool': default_pool, - 'https_redirect': https_redirect, - 'policies': policies, - 'port': port, - 'port_max': port_max, - 'port_min': port_min - } - data = {k: v for (k, v) in data.items() if v is not None} - data = json.dumps(data) - headers['content-type'] = 'application/json' - if 'headers' in kwargs: headers.update(kwargs.get('headers')) - headers['Accept'] = 'application/json' - path_param_keys = ['load_balancer_id'] - path_param_values = self.encode_path_vars(load_balancer_id) + path_param_keys = ['vpn_server_id', 'id'] + path_param_values = self.encode_path_vars(vpn_server_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/listeners'.format(**path_param_dict) - request = self.prepare_request(method='POST', + url = '/vpn_servers/{vpn_server_id}/clients/{id}'.format(**path_param_dict) + request = self.prepare_request(method='DELETE', url=url, headers=headers, - params=params, - data=data) + params=params) response = self.send(request, **kwargs) return response - def delete_load_balancer_listener(self, - load_balancer_id: str, + def get_vpn_server_client(self, + vpn_server_id: str, id: str, **kwargs ) -> DetailedResponse: """ - Delete a load balancer listener. + Retrieve a VPN client. - This request deletes a load balancer listener. This operation cannot be reversed. - For this operation to succeed, the listener must not be the target of another load - balancer listener. + This request retrieves a single VPN client specified by the identifier in the URL. - :param str load_balancer_id: The load balancer identifier. - :param str id: The listener identifier. + :param str vpn_server_id: The VPN server identifier. + :param str id: The VPN client identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse + :rtype: DetailedResponse with `dict` result representing a `VPNServerClient` object """ - if load_balancer_id is None: - raise ValueError('load_balancer_id must be provided') + if vpn_server_id is None: + raise ValueError('vpn_server_id must be provided') if id is None: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='delete_load_balancer_listener') + operation_id='get_vpn_server_client') headers.update(sdk_headers) params = { @@ -14218,12 +14647,13 @@ def delete_load_balancer_listener(self, if 'headers' in kwargs: headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' - path_param_keys = ['load_balancer_id', 'id'] - path_param_values = self.encode_path_vars(load_balancer_id, id) + path_param_keys = ['vpn_server_id', 'id'] + path_param_values = self.encode_path_vars(vpn_server_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/listeners/{id}'.format(**path_param_dict) - request = self.prepare_request(method='DELETE', + url = '/vpn_servers/{vpn_server_id}/clients/{id}'.format(**path_param_dict) + request = self.prepare_request(method='GET', url=url, headers=headers, params=params) @@ -14232,32 +14662,34 @@ def delete_load_balancer_listener(self, return response - def get_load_balancer_listener(self, - load_balancer_id: str, + def disconnect_vpn_client(self, + vpn_server_id: str, id: str, **kwargs ) -> DetailedResponse: """ - Retrieve a load balancer listener. + Disconnect a VPN client. - This request retrieves a single listener specified by the identifier in the URL - path. + This request disconnects the specified VPN client, and deletes the client + according to the VPN server's auto-deletion policy. The VPN client may reconnect + unless its authentication permissions for the configured authentication methods + (such as its client certificate) have been revoked. - :param str load_balancer_id: The load balancer identifier. - :param str id: The listener identifier. + :param str vpn_server_id: The VPN server identifier. + :param str id: The VPN client identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListener` object + :rtype: DetailedResponse """ - if load_balancer_id is None: - raise ValueError('load_balancer_id must be provided') + if vpn_server_id is None: + raise ValueError('vpn_server_id must be provided') if id is None: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='get_load_balancer_listener') + operation_id='disconnect_vpn_client') headers.update(sdk_headers) params = { @@ -14267,13 +14699,12 @@ def get_load_balancer_listener(self, if 'headers' in kwargs: headers.update(kwargs.get('headers')) - headers['Accept'] = 'application/json' - path_param_keys = ['load_balancer_id', 'id'] - path_param_values = self.encode_path_vars(load_balancer_id, id) + path_param_keys = ['vpn_server_id', 'id'] + path_param_values = self.encode_path_vars(vpn_server_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/listeners/{id}'.format(**path_param_dict) - request = self.prepare_request(method='GET', + url = '/vpn_servers/{vpn_server_id}/clients/{id}/disconnect'.format(**path_param_dict) + request = self.prepare_request(method='POST', url=url, headers=headers, params=params) @@ -14282,106 +14713,60 @@ def get_load_balancer_listener(self, return response - def update_load_balancer_listener(self, - load_balancer_id: str, - id: str, - load_balancer_listener_patch: 'LoadBalancerListenerPatch', - **kwargs - ) -> DetailedResponse: - """ - Update a load balancer listener. - - This request updates a load balancer listener from a listener patch. - - :param str load_balancer_id: The load balancer identifier. - :param str id: The listener identifier. - :param LoadBalancerListenerPatch load_balancer_listener_patch: The load - balancer listener patch. - :param dict headers: A `dict` containing the request headers - :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListener` object - """ - - if load_balancer_id is None: - raise ValueError('load_balancer_id must be provided') - if id is None: - raise ValueError('id must be provided') - if load_balancer_listener_patch is None: - raise ValueError('load_balancer_listener_patch must be provided') - if isinstance(load_balancer_listener_patch, LoadBalancerListenerPatch): - load_balancer_listener_patch = convert_model(load_balancer_listener_patch) - headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='update_load_balancer_listener') - headers.update(sdk_headers) - - params = { - 'version': self.version, - 'generation': self.generation - } - - data = json.dumps(load_balancer_listener_patch) - headers['content-type'] = 'application/merge-patch+json' - - if 'headers' in kwargs: - headers.update(kwargs.get('headers')) - headers['Accept'] = 'application/json' - - path_param_keys = ['load_balancer_id', 'id'] - path_param_values = self.encode_path_vars(load_balancer_id, id) - path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/listeners/{id}'.format(**path_param_dict) - request = self.prepare_request(method='PATCH', - url=url, - headers=headers, - params=params, - data=data) - - response = self.send(request, **kwargs) - return response - - - def list_load_balancer_listener_policies(self, - load_balancer_id: str, - listener_id: str, + def list_vpn_server_routes(self, + vpn_server_id: str, + *, + start: str = None, + limit: int = None, + sort: str = None, **kwargs ) -> DetailedResponse: """ - List all policies for a load balancer listener. + List all VPN routes for a VPN server. - This request lists all policies for a load balancer listener. + This request lists all VPN routes in a VPN server. All VPN routes are provided to + the VPN client when the connection is established. Packets received from the VPN + client will be dropped by the VPN server if there is no VPN route matching their + specified destinations. All VPN routes must be unique within the VPN server. - :param str load_balancer_id: The load balancer identifier. - :param str listener_id: The listener identifier. + :param str vpn_server_id: The VPN server identifier. + :param str start: (optional) A server-provided token determining what + resource to start the page on. + :param int limit: (optional) The number of resources to return on a page. + :param str sort: (optional) Sorts the returned collection by the specified + property name in ascending order. A `-` may be prepended to the name to + sort in descending order. For example, the value `-created_at` sorts the + collection by the `created_at` property in descending order, and the value + `name` sorts it by the `name` property in ascending order. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerPolicyCollection` object + :rtype: DetailedResponse with `dict` result representing a `VPNServerRouteCollection` object """ - if load_balancer_id is None: - raise ValueError('load_balancer_id must be provided') - if listener_id is None: - raise ValueError('listener_id must be provided') + if vpn_server_id is None: + raise ValueError('vpn_server_id must be provided') headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='list_load_balancer_listener_policies') + operation_id='list_vpn_server_routes') headers.update(sdk_headers) params = { 'version': self.version, - 'generation': self.generation + 'generation': self.generation, + 'start': start, + 'limit': limit, + 'sort': sort } if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' - path_param_keys = ['load_balancer_id', 'listener_id'] - path_param_values = self.encode_path_vars(load_balancer_id, listener_id) + path_param_keys = ['vpn_server_id'] + path_param_values = self.encode_path_vars(vpn_server_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies'.format(**path_param_dict) + url = '/vpn_servers/{vpn_server_id}/routes'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers, @@ -14391,62 +14776,53 @@ def list_load_balancer_listener_policies(self, return response - def create_load_balancer_listener_policy(self, - load_balancer_id: str, - listener_id: str, - action: str, - priority: int, + def create_vpn_server_route(self, + vpn_server_id: str, + destination: str, *, + action: str = None, name: str = None, - rules: List['LoadBalancerListenerPolicyRulePrototype'] = None, - target: 'LoadBalancerListenerPolicyTargetPrototype' = None, **kwargs ) -> DetailedResponse: """ - Create a policy for a load balancer listener. + Create a VPN route for a VPN server. - Creates a new policy for a load balancer listener. + This request creates a new VPN route in the VPN server. All VPN routes are + provided to the VPN client when the connection is established. Packets received + from the VPN client will be dropped by the VPN server if there is no VPN route + matching their specified destinations. All VPN routes must be unique within the + VPN server. destination of the packet. - :param str load_balancer_id: The load balancer identifier. - :param str listener_id: The listener identifier. - :param str action: The policy action. + :param str vpn_server_id: The VPN server identifier. + :param str destination: The destination to use for this VPN route in the + VPN server. Must be unique within the VPN server. If an incoming packet + does not match any destination, it will be dropped. + :param str action: (optional) The action to perform with a packet matching + the VPN route: + - `translate`: translate the source IP address to one of the private IP + addresses of the VPN server, then deliver the packet to target. + - `deliver`: deliver the packet to the target. + - `drop`: drop the packet The enumerated values for this property are expected to expand in the future. When processing this property, check for and log unknown values. - Optionally halt processing and surface the error, or bypass the policy on - which the unexpected property value was encountered. - :param int priority: Priority of the policy. Lower value indicates higher - priority. - :param str name: (optional) The user-defined name for this policy. Names - must be unique within the load balancer listener the policy resides in. - :param List[LoadBalancerListenerPolicyRulePrototype] rules: (optional) The - rule prototype objects for this policy. - :param LoadBalancerListenerPolicyTargetPrototype target: (optional) - If - `action` is `forward`, specify a `LoadBalancerPoolIdentity`. - - If `action` is `redirect`, specify a - `LoadBalancerListenerPolicyRedirectURLPrototype`. - - If `action` is `https_redirect`, specify a - `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. + Optionally halt processing and surface the error, or bypass the VPN route + on which the unexpected property value was encountered. + :param str name: (optional) The user-defined name for this VPN route. If + unspecified, the name will be a hyphenated list of randomly-selected words. + Names must be unique within the VPN server the VPN route resides in. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerPolicy` object + :rtype: DetailedResponse with `dict` result representing a `VPNServerRoute` object """ - if load_balancer_id is None: - raise ValueError('load_balancer_id must be provided') - if listener_id is None: - raise ValueError('listener_id must be provided') - if action is None: - raise ValueError('action must be provided') - if priority is None: - raise ValueError('priority must be provided') - if rules is not None: - rules = [convert_model(x) for x in rules] - if target is not None: - target = convert_model(target) + if vpn_server_id is None: + raise ValueError('vpn_server_id must be provided') + if destination is None: + raise ValueError('destination must be provided') headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='create_load_balancer_listener_policy') + operation_id='create_vpn_server_route') headers.update(sdk_headers) params = { @@ -14455,11 +14831,9 @@ def create_load_balancer_listener_policy(self, } data = { + 'destination': destination, 'action': action, - 'priority': priority, - 'name': name, - 'rules': rules, - 'target': target + 'name': name } data = {k: v for (k, v) in data.items() if v is not None} data = json.dumps(data) @@ -14469,10 +14843,10 @@ def create_load_balancer_listener_policy(self, headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' - path_param_keys = ['load_balancer_id', 'listener_id'] - path_param_values = self.encode_path_vars(load_balancer_id, listener_id) + path_param_keys = ['vpn_server_id'] + path_param_values = self.encode_path_vars(vpn_server_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies'.format(**path_param_dict) + url = '/vpn_servers/{vpn_server_id}/routes'.format(**path_param_dict) request = self.prepare_request(method='POST', url=url, headers=headers, @@ -14483,35 +14857,31 @@ def create_load_balancer_listener_policy(self, return response - def delete_load_balancer_listener_policy(self, - load_balancer_id: str, - listener_id: str, + def delete_vpn_server_route(self, + vpn_server_id: str, id: str, **kwargs ) -> DetailedResponse: """ - Delete a load balancer listener policy. + Delete a VPN route. - Deletes a policy of the load balancer listener. This operation cannot be reversed. + This request deletes a VPN route. This operation cannot be reversed. - :param str load_balancer_id: The load balancer identifier. - :param str listener_id: The listener identifier. - :param str id: The policy identifier. + :param str vpn_server_id: The VPN server identifier. + :param str id: The VPN route identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse """ - if load_balancer_id is None: - raise ValueError('load_balancer_id must be provided') - if listener_id is None: - raise ValueError('listener_id must be provided') + if vpn_server_id is None: + raise ValueError('vpn_server_id must be provided') if id is None: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='delete_load_balancer_listener_policy') + operation_id='delete_vpn_server_route') headers.update(sdk_headers) params = { @@ -14522,10 +14892,10 @@ def delete_load_balancer_listener_policy(self, if 'headers' in kwargs: headers.update(kwargs.get('headers')) - path_param_keys = ['load_balancer_id', 'listener_id', 'id'] - path_param_values = self.encode_path_vars(load_balancer_id, listener_id, id) + path_param_keys = ['vpn_server_id', 'id'] + path_param_values = self.encode_path_vars(vpn_server_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}'.format(**path_param_dict) + url = '/vpn_servers/{vpn_server_id}/routes/{id}'.format(**path_param_dict) request = self.prepare_request(method='DELETE', url=url, headers=headers, @@ -14535,35 +14905,31 @@ def delete_load_balancer_listener_policy(self, return response - def get_load_balancer_listener_policy(self, - load_balancer_id: str, - listener_id: str, + def get_vpn_server_route(self, + vpn_server_id: str, id: str, **kwargs ) -> DetailedResponse: """ - Retrieve a load balancer listener policy. + Retrieve a VPN route. - Retrieve a single policy specified by the identifier in the URL path. + This request retrieves a single VPN route specified by the identifier in the URL. - :param str load_balancer_id: The load balancer identifier. - :param str listener_id: The listener identifier. - :param str id: The policy identifier. + :param str vpn_server_id: The VPN server identifier. + :param str id: The VPN route identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerPolicy` object + :rtype: DetailedResponse with `dict` result representing a `VPNServerRoute` object """ - if load_balancer_id is None: - raise ValueError('load_balancer_id must be provided') - if listener_id is None: - raise ValueError('listener_id must be provided') + if vpn_server_id is None: + raise ValueError('vpn_server_id must be provided') if id is None: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='get_load_balancer_listener_policy') + operation_id='get_vpn_server_route') headers.update(sdk_headers) params = { @@ -14575,10 +14941,10 @@ def get_load_balancer_listener_policy(self, headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' - path_param_keys = ['load_balancer_id', 'listener_id', 'id'] - path_param_values = self.encode_path_vars(load_balancer_id, listener_id, id) + path_param_keys = ['vpn_server_id', 'id'] + path_param_values = self.encode_path_vars(vpn_server_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}'.format(**path_param_dict) + url = '/vpn_servers/{vpn_server_id}/routes/{id}'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers, @@ -14588,42 +14954,39 @@ def get_load_balancer_listener_policy(self, return response - def update_load_balancer_listener_policy(self, - load_balancer_id: str, - listener_id: str, + def update_vpn_server_route(self, + vpn_server_id: str, id: str, - load_balancer_listener_policy_patch: 'LoadBalancerListenerPolicyPatch', + vpn_server_route_patch: 'VPNServerRoutePatch', **kwargs ) -> DetailedResponse: """ - Update a load balancer listener policy. + Update a VPN route. - Updates a policy from a policy patch. + This request updates a VPN route with the information in a provided VPN route + patch. The VPN route patch object is structured in the same way as a retrieved VPN + route and contains only the information to be updated. - :param str load_balancer_id: The load balancer identifier. - :param str listener_id: The listener identifier. - :param str id: The policy identifier. - :param LoadBalancerListenerPolicyPatch load_balancer_listener_policy_patch: - The listener policy patch. + :param str vpn_server_id: The VPN server identifier. + :param str id: The VPN route identifier. + :param VPNServerRoutePatch vpn_server_route_patch: The VPN route patch. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerPolicy` object + :rtype: DetailedResponse with `dict` result representing a `VPNServerRoute` object """ - if load_balancer_id is None: - raise ValueError('load_balancer_id must be provided') - if listener_id is None: - raise ValueError('listener_id must be provided') + if vpn_server_id is None: + raise ValueError('vpn_server_id must be provided') if id is None: raise ValueError('id must be provided') - if load_balancer_listener_policy_patch is None: - raise ValueError('load_balancer_listener_policy_patch must be provided') - if isinstance(load_balancer_listener_policy_patch, LoadBalancerListenerPolicyPatch): - load_balancer_listener_policy_patch = convert_model(load_balancer_listener_policy_patch) + if vpn_server_route_patch is None: + raise ValueError('vpn_server_route_patch must be provided') + if isinstance(vpn_server_route_patch, VPNServerRoutePatch): + vpn_server_route_patch = convert_model(vpn_server_route_patch) headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='update_load_balancer_listener_policy') + operation_id='update_vpn_server_route') headers.update(sdk_headers) params = { @@ -14631,17 +14994,17 @@ def update_load_balancer_listener_policy(self, 'generation': self.generation } - data = json.dumps(load_balancer_listener_policy_patch) + data = json.dumps(vpn_server_route_patch) headers['content-type'] = 'application/merge-patch+json' if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' - path_param_keys = ['load_balancer_id', 'listener_id', 'id'] - path_param_values = self.encode_path_vars(load_balancer_id, listener_id, id) + path_param_keys = ['vpn_server_id', 'id'] + path_param_values = self.encode_path_vars(vpn_server_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}'.format(**path_param_dict) + url = '/vpn_servers/{vpn_server_id}/routes/{id}'.format(**path_param_dict) request = self.prepare_request(method='PATCH', url=url, headers=headers, @@ -14651,51 +15014,50 @@ def update_load_balancer_listener_policy(self, response = self.send(request, **kwargs) return response + ######################### + # Load balancers + ######################### - def list_load_balancer_listener_policy_rules(self, - load_balancer_id: str, - listener_id: str, - policy_id: str, + + def list_load_balancer_profiles(self, + *, + start: str = None, + limit: int = None, **kwargs ) -> DetailedResponse: """ - List all rules of a load balancer listener policy. + List all load balancer profiles. - This request lists all rules of a load balancer listener policy. + This request lists all load balancer profiles available in the region. A load + balancer profile specifies the performance characteristics and pricing model for a + load balancer. - :param str load_balancer_id: The load balancer identifier. - :param str listener_id: The listener identifier. - :param str policy_id: The policy identifier. + :param str start: (optional) A server-provided token determining what + resource to start the page on. + :param int limit: (optional) The number of resources to return on a page. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerPolicyRuleCollection` object + :rtype: DetailedResponse with `dict` result representing a `LoadBalancerProfileCollection` object """ - if load_balancer_id is None: - raise ValueError('load_balancer_id must be provided') - if listener_id is None: - raise ValueError('listener_id must be provided') - if policy_id is None: - raise ValueError('policy_id must be provided') headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='list_load_balancer_listener_policy_rules') + operation_id='list_load_balancer_profiles') headers.update(sdk_headers) params = { 'version': self.version, - 'generation': self.generation + 'generation': self.generation, + 'start': start, + 'limit': limit } if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' - path_param_keys = ['load_balancer_id', 'listener_id', 'policy_id'] - path_param_values = self.encode_path_vars(load_balancer_id, listener_id, policy_id) - path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules'.format(**path_param_dict) + url = '/load_balancer/profiles' request = self.prepare_request(method='GET', url=url, headers=headers, @@ -14705,60 +15067,27 @@ def list_load_balancer_listener_policy_rules(self, return response - def create_load_balancer_listener_policy_rule(self, - load_balancer_id: str, - listener_id: str, - policy_id: str, - condition: str, - type: str, - value: str, - *, - field: str = None, + def get_load_balancer_profile(self, + name: str, **kwargs ) -> DetailedResponse: """ - Create a rule for a load balancer listener policy. + Retrieve a load balancer profile. - Creates a new rule for the load balancer listener policy. + This request retrieves a load balancer profile specified by the name in the URL. - :param str load_balancer_id: The load balancer identifier. - :param str listener_id: The listener identifier. - :param str policy_id: The policy identifier. - :param str condition: The condition of the rule. - :param str type: The type of the rule. - Body rules are applied to form-encoded request bodies using the `UTF-8` - character set. - :param str value: Value to be matched for rule condition. - If the rule type is `query` and the rule condition is not `matches_regex`, - the value must be percent-encoded. - :param str field: (optional) The field. This is applicable to `header`, - `query`, and `body` rule types. - If the rule type is `header`, this property is required. - If the rule type is `query`, this is optional. If specified and the rule - condition is not - `matches_regex`, the value must be percent-encoded. - If the rule type is `body`, this is optional. + :param str name: The load balancer profile name. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerPolicyRule` object + :rtype: DetailedResponse with `dict` result representing a `LoadBalancerProfile` object """ - if load_balancer_id is None: - raise ValueError('load_balancer_id must be provided') - if listener_id is None: - raise ValueError('listener_id must be provided') - if policy_id is None: - raise ValueError('policy_id must be provided') - if condition is None: - raise ValueError('condition must be provided') - if type is None: - raise ValueError('type must be provided') - if value is None: - raise ValueError('value must be provided') + if name is None: + raise ValueError('name must be provided') headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='create_load_balancer_listener_policy_rule') + operation_id='get_load_balancer_profile') headers.update(sdk_headers) params = { @@ -14766,83 +15095,61 @@ def create_load_balancer_listener_policy_rule(self, 'generation': self.generation } - data = { - 'condition': condition, - 'type': type, - 'value': value, - 'field': field - } - data = {k: v for (k, v) in data.items() if v is not None} - data = json.dumps(data) - headers['content-type'] = 'application/json' - if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' - path_param_keys = ['load_balancer_id', 'listener_id', 'policy_id'] - path_param_values = self.encode_path_vars(load_balancer_id, listener_id, policy_id) + path_param_keys = ['name'] + path_param_values = self.encode_path_vars(name) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules'.format(**path_param_dict) - request = self.prepare_request(method='POST', + url = '/load_balancer/profiles/{name}'.format(**path_param_dict) + request = self.prepare_request(method='GET', url=url, headers=headers, - params=params, - data=data) + params=params) response = self.send(request, **kwargs) return response - def delete_load_balancer_listener_policy_rule(self, - load_balancer_id: str, - listener_id: str, - policy_id: str, - id: str, + def list_load_balancers(self, + *, + start: str = None, + limit: int = None, **kwargs ) -> DetailedResponse: """ - Delete a load balancer listener policy rule. + List all load balancers. - Deletes a rule from the load balancer listener policy. This operation cannot be - reversed. + This request lists all load balancers in the region. - :param str load_balancer_id: The load balancer identifier. - :param str listener_id: The listener identifier. - :param str policy_id: The policy identifier. - :param str id: The rule identifier. + :param str start: (optional) A server-provided token determining what + resource to start the page on. + :param int limit: (optional) The number of resources to return on a page. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse + :rtype: DetailedResponse with `dict` result representing a `LoadBalancerCollection` object """ - if load_balancer_id is None: - raise ValueError('load_balancer_id must be provided') - if listener_id is None: - raise ValueError('listener_id must be provided') - if policy_id is None: - raise ValueError('policy_id must be provided') - if id is None: - raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='delete_load_balancer_listener_policy_rule') + operation_id='list_load_balancers') headers.update(sdk_headers) params = { 'version': self.version, - 'generation': self.generation + 'generation': self.generation, + 'start': start, + 'limit': limit } if 'headers' in kwargs: headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' - path_param_keys = ['load_balancer_id', 'listener_id', 'policy_id', 'id'] - path_param_values = self.encode_path_vars(load_balancer_id, listener_id, policy_id, id) - path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}'.format(**path_param_dict) - request = self.prepare_request(method='DELETE', + url = '/load_balancers' + request = self.prepare_request(method='GET', url=url, headers=headers, params=params) @@ -14851,39 +15158,88 @@ def delete_load_balancer_listener_policy_rule(self, return response - def get_load_balancer_listener_policy_rule(self, - load_balancer_id: str, - listener_id: str, - policy_id: str, - id: str, + def create_load_balancer(self, + is_public: bool, + subnets: List['SubnetIdentity'], + *, + listeners: List['LoadBalancerListenerPrototypeLoadBalancerContext'] = None, + logging: 'LoadBalancerLogging' = None, + name: str = None, + pools: List['LoadBalancerPoolPrototype'] = None, + profile: 'LoadBalancerProfileIdentity' = None, + resource_group: 'ResourceGroupIdentity' = None, + route_mode: bool = None, + security_groups: List['SecurityGroupIdentity'] = None, **kwargs ) -> DetailedResponse: """ - Retrieve a load balancer listener policy rule. + Create a load balancer. - Retrieves a single rule specified by the identifier in the URL path. + This request creates and provisions a new load balancer. - :param str load_balancer_id: The load balancer identifier. - :param str listener_id: The listener identifier. - :param str policy_id: The policy identifier. - :param str id: The rule identifier. + :param bool is_public: Indicates whether this load balancer is public or + private. + At present, if route mode is enabled, the load balancer must be private. + :param List[SubnetIdentity] subnets: The subnets to provision this load + balancer in. The load balancer's availability will depend on the + availability of the zones the specified subnets reside in. + Load balancers in the `network` family allow only one subnet to be + specified. + :param List[LoadBalancerListenerPrototypeLoadBalancerContext] listeners: + (optional) The listeners of this load balancer. + :param LoadBalancerLogging logging: (optional) The logging configuration to + use for this load balancer. See [VPC Datapath + Logging](https://cloud.ibm.com/docs/vpc?topic=vpc-datapath-logging) + on the logging format, fields and permitted values. + To activate logging, the load balancer profile must support the specified + logging + type. + :param str name: (optional) The user-defined name for this load balancer. + If unspecified, the name will be a hyphenated list of randomly-selected + words. + :param List[LoadBalancerPoolPrototype] pools: (optional) The pools of this + load balancer. + :param LoadBalancerProfileIdentity profile: (optional) The profile to use + for this load balancer + If unspecified, `application` will be used. + :param ResourceGroupIdentity resource_group: (optional) The resource group + to use. If unspecified, the account's [default resource + group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is + used. + :param bool route_mode: (optional) Indicates whether route mode is enabled + for this load balancer. + At present, public load balancers are not supported with route mode + enabled. + :param List[SecurityGroupIdentity] security_groups: (optional) The security + groups to use for this load balancer. If unspecified, the VPC's default + security group is used. + The load balancer profile must support security groups. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerPolicyRule` object + :rtype: DetailedResponse with `dict` result representing a `LoadBalancer` object """ - if load_balancer_id is None: - raise ValueError('load_balancer_id must be provided') - if listener_id is None: - raise ValueError('listener_id must be provided') - if policy_id is None: - raise ValueError('policy_id must be provided') - if id is None: - raise ValueError('id must be provided') + if is_public is None: + raise ValueError('is_public must be provided') + if subnets is None: + raise ValueError('subnets must be provided') + subnets = [convert_model(x) for x in subnets] + if listeners is not None: + listeners = [convert_model(x) for x in listeners] + if logging is not None: + logging = convert_model(logging) + if pools is not None: + pools = [convert_model(x) for x in pools] + if profile is not None: + profile = convert_model(profile) + if resource_group is not None: + resource_group = convert_model(resource_group) + if security_groups is not None: + security_groups = [convert_model(x) for x in security_groups] headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='get_load_balancer_listener_policy_rule') + operation_id='create_load_balancer') headers.update(sdk_headers) params = { @@ -14891,63 +15247,59 @@ def get_load_balancer_listener_policy_rule(self, 'generation': self.generation } + data = { + 'is_public': is_public, + 'subnets': subnets, + 'listeners': listeners, + 'logging': logging, + 'name': name, + 'pools': pools, + 'profile': profile, + 'resource_group': resource_group, + 'route_mode': route_mode, + 'security_groups': security_groups + } + data = {k: v for (k, v) in data.items() if v is not None} + data = json.dumps(data) + headers['content-type'] = 'application/json' + if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' - path_param_keys = ['load_balancer_id', 'listener_id', 'policy_id', 'id'] - path_param_values = self.encode_path_vars(load_balancer_id, listener_id, policy_id, id) - path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}'.format(**path_param_dict) - request = self.prepare_request(method='GET', + url = '/load_balancers' + request = self.prepare_request(method='POST', url=url, headers=headers, - params=params) + params=params, + data=data) response = self.send(request, **kwargs) return response - def update_load_balancer_listener_policy_rule(self, - load_balancer_id: str, - listener_id: str, - policy_id: str, + def delete_load_balancer(self, id: str, - load_balancer_listener_policy_rule_patch: 'LoadBalancerListenerPolicyRulePatch', **kwargs ) -> DetailedResponse: """ - Update a load balancer listener policy rule. + Delete a load balancer. - Updates a rule of the load balancer listener policy. + This request deletes a load balancer. This operation cannot be reversed. A load + balancer cannot be deleted if its `provisioning_status` is `delete_pending`. - :param str load_balancer_id: The load balancer identifier. - :param str listener_id: The listener identifier. - :param str policy_id: The policy identifier. - :param str id: The rule identifier. - :param LoadBalancerListenerPolicyRulePatch - load_balancer_listener_policy_rule_patch: The listener policy rule patch. + :param str id: The load balancer identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerPolicyRule` object + :rtype: DetailedResponse """ - if load_balancer_id is None: - raise ValueError('load_balancer_id must be provided') - if listener_id is None: - raise ValueError('listener_id must be provided') - if policy_id is None: - raise ValueError('policy_id must be provided') if id is None: raise ValueError('id must be provided') - if load_balancer_listener_policy_rule_patch is None: - raise ValueError('load_balancer_listener_policy_rule_patch must be provided') - if isinstance(load_balancer_listener_policy_rule_patch, LoadBalancerListenerPolicyRulePatch): - load_balancer_listener_policy_rule_patch = convert_model(load_balancer_listener_policy_rule_patch) headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='update_load_balancer_listener_policy_rule') + operation_id='delete_load_balancer') headers.update(sdk_headers) params = { @@ -14955,17 +15307,113 @@ def update_load_balancer_listener_policy_rule(self, 'generation': self.generation } - data = json.dumps(load_balancer_listener_policy_rule_patch) + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + + path_param_keys = ['id'] + path_param_values = self.encode_path_vars(id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/load_balancers/{id}'.format(**path_param_dict) + request = self.prepare_request(method='DELETE', + url=url, + headers=headers, + params=params) + + response = self.send(request, **kwargs) + return response + + + def get_load_balancer(self, + id: str, + **kwargs + ) -> DetailedResponse: + """ + Retrieve a load balancer. + + This request retrieves a single load balancer specified by the identifier in the + URL path. + + :param str id: The load balancer identifier. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `LoadBalancer` object + """ + + if id is None: + raise ValueError('id must be provided') + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='get_load_balancer') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['id'] + path_param_values = self.encode_path_vars(id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/load_balancers/{id}'.format(**path_param_dict) + request = self.prepare_request(method='GET', + url=url, + headers=headers, + params=params) + + response = self.send(request, **kwargs) + return response + + + def update_load_balancer(self, + id: str, + load_balancer_patch: 'LoadBalancerPatch', + **kwargs + ) -> DetailedResponse: + """ + Update a load balancer. + + This request updates a load balancer. + + :param str id: The load balancer identifier. + :param LoadBalancerPatch load_balancer_patch: The load balancer patch. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `LoadBalancer` object + """ + + if id is None: + raise ValueError('id must be provided') + if load_balancer_patch is None: + raise ValueError('load_balancer_patch must be provided') + if isinstance(load_balancer_patch, LoadBalancerPatch): + load_balancer_patch = convert_model(load_balancer_patch) + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='update_load_balancer') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation + } + + data = json.dumps(load_balancer_patch) headers['content-type'] = 'application/merge-patch+json' if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' - path_param_keys = ['load_balancer_id', 'listener_id', 'policy_id', 'id'] - path_param_values = self.encode_path_vars(load_balancer_id, listener_id, policy_id, id) + path_param_keys = ['id'] + path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}'.format(**path_param_dict) + url = '/load_balancers/{id}'.format(**path_param_dict) request = self.prepare_request(method='PATCH', url=url, headers=headers, @@ -14976,19 +15424,64 @@ def update_load_balancer_listener_policy_rule(self, return response - def list_load_balancer_pools(self, + def get_load_balancer_statistics(self, + id: str, + **kwargs + ) -> DetailedResponse: + """ + List all statistics of a load balancer. + + This request lists statistics of a load balancer. + + :param str id: The load balancer identifier. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `LoadBalancerStatistics` object + """ + + if id is None: + raise ValueError('id must be provided') + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='get_load_balancer_statistics') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['id'] + path_param_values = self.encode_path_vars(id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/load_balancers/{id}/statistics'.format(**path_param_dict) + request = self.prepare_request(method='GET', + url=url, + headers=headers, + params=params) + + response = self.send(request, **kwargs) + return response + + + def list_load_balancer_listeners(self, load_balancer_id: str, **kwargs ) -> DetailedResponse: """ - List all pools of a load balancer. + List all listeners for a load balancer. - This request lists all pools of a load balancer. + This request lists all listeners for a load balancer. :param str load_balancer_id: The load balancer identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPoolCollection` object + :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerCollection` object """ if load_balancer_id is None: @@ -14996,7 +15489,7 @@ def list_load_balancer_pools(self, headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='list_load_balancer_pools') + operation_id='list_load_balancer_listeners') headers.update(sdk_headers) params = { @@ -15011,7 +15504,7 @@ def list_load_balancer_pools(self, path_param_keys = ['load_balancer_id'] path_param_values = self.encode_path_vars(load_balancer_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/pools'.format(**path_param_dict) + url = '/load_balancers/{load_balancer_id}/listeners'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers, @@ -15021,69 +15514,106 @@ def list_load_balancer_pools(self, return response - def create_load_balancer_pool(self, + def create_load_balancer_listener(self, load_balancer_id: str, - algorithm: str, - health_monitor: 'LoadBalancerPoolHealthMonitorPrototype', protocol: str, *, - members: List['LoadBalancerPoolMemberPrototype'] = None, - name: str = None, - proxy_protocol: str = None, - session_persistence: 'LoadBalancerPoolSessionPersistencePrototype' = None, + accept_proxy_protocol: bool = None, + certificate_instance: 'CertificateInstanceIdentity' = None, + connection_limit: int = None, + default_pool: 'LoadBalancerPoolIdentity' = None, + https_redirect: 'LoadBalancerListenerHTTPSRedirectPrototype' = None, + policies: List['LoadBalancerListenerPolicyPrototype'] = None, + port: int = None, + port_max: int = None, + port_min: int = None, **kwargs ) -> DetailedResponse: """ - Create a load balancer pool. + Create a listener for a load balancer. - This request creates a new pool from a pool prototype object. + This request creates a new listener for a load balancer. :param str load_balancer_id: The load balancer identifier. - :param str algorithm: The load balancing algorithm. - :param LoadBalancerPoolHealthMonitorPrototype health_monitor: The health - monitor of this pool. - :param str protocol: The protocol used for this load balancer pool. Load - balancers in the `network` family support `tcp` and `udp` (if - `udp_supported` is `true`). Load balancers in the - `application` family support `tcp`, `http`, and `https`. - :param List[LoadBalancerPoolMemberPrototype] members: (optional) The - members for this load balancer pool. For load balancers in the `network` - family, the same `port` and `target` tuple cannot be shared by a pool - member of any other load balancer in the same VPC. - :param str name: (optional) The user-defined name for this load balancer - pool. If unspecified, the name will be a hyphenated list of - randomly-selected words. - :param str proxy_protocol: (optional) The PROXY protocol setting for this - pool: - - `v1`: Enabled with version 1 (human-readable header format) - - `v2`: Enabled with version 2 (binary header format) - - `disabled`: Disabled - Supported by load balancers in the `application` family (otherwise always - `disabled`). - :param LoadBalancerPoolSessionPersistencePrototype session_persistence: - (optional) The session persistence of this pool. + :param str protocol: The listener protocol. Each listener in the load + balancer must have a unique `port` and `protocol` combination. Additional + restrictions: + - If this load balancer is in the `network` family: + - The protocol must be `tcp` or `udp` (if `udp_supported` is `true`). + - If `default_pool` is set, the pool protocol must match. + - If `https_redirect` is set, the protocol must be `http`. + :param bool accept_proxy_protocol: (optional) If set to `true`, this + listener will accept and forward PROXY protocol information. Supported by + load balancers in the `application` family (otherwise always `false`). + Additional restrictions: + - If this listener has `https_redirect` specified, its + `accept_proxy_protocol` value must + match the `accept_proxy_protocol` value of the `https_redirect` listener. + - If this listener is the target of another listener's `https_redirect`, + its + `accept_proxy_protocol` value must match that listener's + `accept_proxy_protocol` value. + :param CertificateInstanceIdentity certificate_instance: (optional) The + certificate instance used for SSL termination. It is applicable only to + `https` + protocol. + :param int connection_limit: (optional) The connection limit of the + listener. + :param LoadBalancerPoolIdentity default_pool: (optional) The default pool + for this listener. The specified pool must: + - Belong to this load balancer + - Have the same `protocol` as this listener, or have a compatible protocol. + At present, the compatible protocols are `http` and `https`. + - Not already be the `default_pool` for another listener. + :param LoadBalancerListenerHTTPSRedirectPrototype https_redirect: + (optional) The target listener that requests will be redirected to. This + listener must have a + `protocol` of `http`, and the target listener must have a `protocol` of + `https`. + :param List[LoadBalancerListenerPolicyPrototype] policies: (optional) The + policy prototype objects for this listener. + :param int port: (optional) The listener port number, or the inclusive + lower bound of the port range. Each listener in the load balancer must have + a unique `port` and `protocol` combination. + Not supported for load balancers operating with route mode enabled. + :param int port_max: (optional) The inclusive upper bound of the range of + ports used by this listener. Must not be less than `port_min`. + At present, only load balancers operating with route mode enabled, and + public load balancers in the `network` family support different values for + `port_min` and + `port_max`. When route mode is enabled, the value `65535` must be + specified. + The specified port range must not overlap with port ranges used by other + listeners for this load balancer using the same protocol. + :param int port_min: (optional) The inclusive lower bound of the range of + ports used by this listener. Must not be greater than `port_max`. + At present, only load balancers operating with route mode enabled, and + public load balancers in the `network` family support different values for + `port_min` and + `port_max`. When route mode is enabled, the value `1` must be specified. + The specified port range must not overlap with port ranges used by other + listeners for this load balancer using the same protocol. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPool` object + :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListener` object """ if load_balancer_id is None: raise ValueError('load_balancer_id must be provided') - if algorithm is None: - raise ValueError('algorithm must be provided') - if health_monitor is None: - raise ValueError('health_monitor must be provided') if protocol is None: raise ValueError('protocol must be provided') - health_monitor = convert_model(health_monitor) - if members is not None: - members = [convert_model(x) for x in members] - if session_persistence is not None: - session_persistence = convert_model(session_persistence) + if certificate_instance is not None: + certificate_instance = convert_model(certificate_instance) + if default_pool is not None: + default_pool = convert_model(default_pool) + if https_redirect is not None: + https_redirect = convert_model(https_redirect) + if policies is not None: + policies = [convert_model(x) for x in policies] headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='create_load_balancer_pool') + operation_id='create_load_balancer_listener') headers.update(sdk_headers) params = { @@ -15092,13 +15622,16 @@ def create_load_balancer_pool(self, } data = { - 'algorithm': algorithm, - 'health_monitor': health_monitor, 'protocol': protocol, - 'members': members, - 'name': name, - 'proxy_protocol': proxy_protocol, - 'session_persistence': session_persistence + 'accept_proxy_protocol': accept_proxy_protocol, + 'certificate_instance': certificate_instance, + 'connection_limit': connection_limit, + 'default_pool': default_pool, + 'https_redirect': https_redirect, + 'policies': policies, + 'port': port, + 'port_max': port_max, + 'port_min': port_min } data = {k: v for (k, v) in data.items() if v is not None} data = json.dumps(data) @@ -15111,7 +15644,7 @@ def create_load_balancer_pool(self, path_param_keys = ['load_balancer_id'] path_param_values = self.encode_path_vars(load_balancer_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/pools'.format(**path_param_dict) + url = '/load_balancers/{load_balancer_id}/listeners'.format(**path_param_dict) request = self.prepare_request(method='POST', url=url, headers=headers, @@ -15122,19 +15655,20 @@ def create_load_balancer_pool(self, return response - def delete_load_balancer_pool(self, + def delete_load_balancer_listener(self, load_balancer_id: str, id: str, **kwargs ) -> DetailedResponse: """ - Delete a load balancer pool. + Delete a load balancer listener. - This request deletes a load balancer pool. This operation cannot be reversed. The - pool must not currently be the default pool for any listener in the load balancer. + This request deletes a load balancer listener. This operation cannot be reversed. + For this operation to succeed, the listener must not be the target of another load + balancer listener. :param str load_balancer_id: The load balancer identifier. - :param str id: The pool identifier. + :param str id: The listener identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse @@ -15147,7 +15681,7 @@ def delete_load_balancer_pool(self, headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='delete_load_balancer_pool') + operation_id='delete_load_balancer_listener') headers.update(sdk_headers) params = { @@ -15161,7 +15695,7 @@ def delete_load_balancer_pool(self, path_param_keys = ['load_balancer_id', 'id'] path_param_values = self.encode_path_vars(load_balancer_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/pools/{id}'.format(**path_param_dict) + url = '/load_balancers/{load_balancer_id}/listeners/{id}'.format(**path_param_dict) request = self.prepare_request(method='DELETE', url=url, headers=headers, @@ -15171,21 +15705,22 @@ def delete_load_balancer_pool(self, return response - def get_load_balancer_pool(self, + def get_load_balancer_listener(self, load_balancer_id: str, id: str, **kwargs ) -> DetailedResponse: """ - Retrieve a load balancer pool. + Retrieve a load balancer listener. - This request retrieves a single pool specified by the identifier in the URL path. + This request retrieves a single listener specified by the identifier in the URL + path. :param str load_balancer_id: The load balancer identifier. - :param str id: The pool identifier. + :param str id: The listener identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPool` object + :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListener` object """ if load_balancer_id is None: @@ -15195,7 +15730,7 @@ def get_load_balancer_pool(self, headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='get_load_balancer_pool') + operation_id='get_load_balancer_listener') headers.update(sdk_headers) params = { @@ -15210,7 +15745,7 @@ def get_load_balancer_pool(self, path_param_keys = ['load_balancer_id', 'id'] path_param_values = self.encode_path_vars(load_balancer_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/pools/{id}'.format(**path_param_dict) + url = '/load_balancers/{load_balancer_id}/listeners/{id}'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers, @@ -15220,38 +15755,38 @@ def get_load_balancer_pool(self, return response - def update_load_balancer_pool(self, + def update_load_balancer_listener(self, load_balancer_id: str, id: str, - load_balancer_pool_patch: 'LoadBalancerPoolPatch', + load_balancer_listener_patch: 'LoadBalancerListenerPatch', **kwargs ) -> DetailedResponse: """ - Update a load balancer pool. + Update a load balancer listener. - This request updates a load balancer pool from a pool patch. + This request updates a load balancer listener from a listener patch. :param str load_balancer_id: The load balancer identifier. - :param str id: The pool identifier. - :param LoadBalancerPoolPatch load_balancer_pool_patch: The load balancer - pool patch. + :param str id: The listener identifier. + :param LoadBalancerListenerPatch load_balancer_listener_patch: The load + balancer listener patch. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPool` object + :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListener` object """ if load_balancer_id is None: raise ValueError('load_balancer_id must be provided') if id is None: raise ValueError('id must be provided') - if load_balancer_pool_patch is None: - raise ValueError('load_balancer_pool_patch must be provided') - if isinstance(load_balancer_pool_patch, LoadBalancerPoolPatch): - load_balancer_pool_patch = convert_model(load_balancer_pool_patch) + if load_balancer_listener_patch is None: + raise ValueError('load_balancer_listener_patch must be provided') + if isinstance(load_balancer_listener_patch, LoadBalancerListenerPatch): + load_balancer_listener_patch = convert_model(load_balancer_listener_patch) headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='update_load_balancer_pool') + operation_id='update_load_balancer_listener') headers.update(sdk_headers) params = { @@ -15259,7 +15794,7 @@ def update_load_balancer_pool(self, 'generation': self.generation } - data = json.dumps(load_balancer_pool_patch) + data = json.dumps(load_balancer_listener_patch) headers['content-type'] = 'application/merge-patch+json' if 'headers' in kwargs: @@ -15269,7 +15804,7 @@ def update_load_balancer_pool(self, path_param_keys = ['load_balancer_id', 'id'] path_param_values = self.encode_path_vars(load_balancer_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/pools/{id}'.format(**path_param_dict) + url = '/load_balancers/{load_balancer_id}/listeners/{id}'.format(**path_param_dict) request = self.prepare_request(method='PATCH', url=url, headers=headers, @@ -15280,31 +15815,31 @@ def update_load_balancer_pool(self, return response - def list_load_balancer_pool_members(self, + def list_load_balancer_listener_policies(self, load_balancer_id: str, - pool_id: str, + listener_id: str, **kwargs ) -> DetailedResponse: """ - List all members of a load balancer pool. + List all policies for a load balancer listener. - This request lists all members of a load balancer pool. + This request lists all policies for a load balancer listener. :param str load_balancer_id: The load balancer identifier. - :param str pool_id: The pool identifier. + :param str listener_id: The listener identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPoolMemberCollection` object + :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerPolicyCollection` object """ if load_balancer_id is None: raise ValueError('load_balancer_id must be provided') - if pool_id is None: - raise ValueError('pool_id must be provided') + if listener_id is None: + raise ValueError('listener_id must be provided') headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='list_load_balancer_pool_members') + operation_id='list_load_balancer_listener_policies') headers.update(sdk_headers) params = { @@ -15316,10 +15851,10 @@ def list_load_balancer_pool_members(self, headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' - path_param_keys = ['load_balancer_id', 'pool_id'] - path_param_values = self.encode_path_vars(load_balancer_id, pool_id) + path_param_keys = ['load_balancer_id', 'listener_id'] + path_param_values = self.encode_path_vars(load_balancer_id, listener_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/pools/{pool_id}/members'.format(**path_param_dict) + url = '/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers, @@ -15329,60 +15864,62 @@ def list_load_balancer_pool_members(self, return response - def create_load_balancer_pool_member(self, + def create_load_balancer_listener_policy(self, load_balancer_id: str, - pool_id: str, - port: int, - target: 'LoadBalancerPoolMemberTargetPrototype', + listener_id: str, + action: str, + priority: int, *, - weight: int = None, + name: str = None, + rules: List['LoadBalancerListenerPolicyRulePrototype'] = None, + target: 'LoadBalancerListenerPolicyTargetPrototype' = None, **kwargs ) -> DetailedResponse: """ - Create a member in a load balancer pool. + Create a policy for a load balancer listener. - This request creates a new member and adds the member to the pool. + Creates a new policy for a load balancer listener. :param str load_balancer_id: The load balancer identifier. - :param str pool_id: The pool identifier. - :param int port: The port the member will receive load balancer traffic on. - Applies only to load balancer traffic received on a listener with a single - port. (If the traffic is received on a listener with a port range, the - member will receive the traffic on the same port the listener received it - on.) - This port will also be used for health checks unless the `port` property of - `health_monitor` property is specified. - The port must be unique across all members for all pools associated with - this pool's listener. - :param LoadBalancerPoolMemberTargetPrototype target: The pool member - target. Load balancers in the `network` family support virtual server - instances in the same zone as the load balancer's subnet. Load balancers in - the - `application` family support any IP address in the VPC. If the load - balancer has - `route mode` enabled, the member must be in a zone the load balancer has a - subnet in. - :param int weight: (optional) Weight of the server member. Applicable only - if the pool algorithm is - `weighted_round_robin`. + :param str listener_id: The listener identifier. + :param str action: The policy action. + The enumerated values for this property are expected to expand in the + future. When processing this property, check for and log unknown values. + Optionally halt processing and surface the error, or bypass the policy on + which the unexpected property value was encountered. + :param int priority: Priority of the policy. Lower value indicates higher + priority. + :param str name: (optional) The user-defined name for this policy. Names + must be unique within the load balancer listener the policy resides in. + :param List[LoadBalancerListenerPolicyRulePrototype] rules: (optional) The + rule prototype objects for this policy. + :param LoadBalancerListenerPolicyTargetPrototype target: (optional) - If + `action` is `forward`, specify a `LoadBalancerPoolIdentity`. + - If `action` is `redirect`, specify a + `LoadBalancerListenerPolicyRedirectURLPrototype`. + - If `action` is `https_redirect`, specify a + `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPoolMember` object + :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerPolicy` object """ if load_balancer_id is None: raise ValueError('load_balancer_id must be provided') - if pool_id is None: - raise ValueError('pool_id must be provided') - if port is None: - raise ValueError('port must be provided') - if target is None: - raise ValueError('target must be provided') - target = convert_model(target) + if listener_id is None: + raise ValueError('listener_id must be provided') + if action is None: + raise ValueError('action must be provided') + if priority is None: + raise ValueError('priority must be provided') + if rules is not None: + rules = [convert_model(x) for x in rules] + if target is not None: + target = convert_model(target) headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='create_load_balancer_pool_member') + operation_id='create_load_balancer_listener_policy') headers.update(sdk_headers) params = { @@ -15391,9 +15928,11 @@ def create_load_balancer_pool_member(self, } data = { - 'port': port, - 'target': target, - 'weight': weight + 'action': action, + 'priority': priority, + 'name': name, + 'rules': rules, + 'target': target } data = {k: v for (k, v) in data.items() if v is not None} data = json.dumps(data) @@ -15403,10 +15942,10 @@ def create_load_balancer_pool_member(self, headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' - path_param_keys = ['load_balancer_id', 'pool_id'] - path_param_values = self.encode_path_vars(load_balancer_id, pool_id) + path_param_keys = ['load_balancer_id', 'listener_id'] + path_param_values = self.encode_path_vars(load_balancer_id, listener_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/pools/{pool_id}/members'.format(**path_param_dict) + url = '/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies'.format(**path_param_dict) request = self.prepare_request(method='POST', url=url, headers=headers, @@ -15417,99 +15956,35 @@ def create_load_balancer_pool_member(self, return response - def replace_load_balancer_pool_members(self, + def delete_load_balancer_listener_policy(self, load_balancer_id: str, - pool_id: str, - members: List['LoadBalancerPoolMemberPrototype'], + listener_id: str, + id: str, **kwargs ) -> DetailedResponse: """ - Replace load balancer pool members. + Delete a load balancer listener policy. - This request replaces the existing members of the load balancer pool with new - members created from the collection of member prototype objects. + Deletes a policy of the load balancer listener. This operation cannot be reversed. :param str load_balancer_id: The load balancer identifier. - :param str pool_id: The pool identifier. - :param List[LoadBalancerPoolMemberPrototype] members: The member prototype - objects for this pool. + :param str listener_id: The listener identifier. + :param str id: The policy identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPoolMemberCollection` object + :rtype: DetailedResponse """ if load_balancer_id is None: raise ValueError('load_balancer_id must be provided') - if pool_id is None: - raise ValueError('pool_id must be provided') - if members is None: - raise ValueError('members must be provided') - members = [convert_model(x) for x in members] + if listener_id is None: + raise ValueError('listener_id must be provided') + if id is None: + raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='replace_load_balancer_pool_members') - headers.update(sdk_headers) - - params = { - 'version': self.version, - 'generation': self.generation - } - - data = { - 'members': members - } - data = {k: v for (k, v) in data.items() if v is not None} - data = json.dumps(data) - headers['content-type'] = 'application/json' - - if 'headers' in kwargs: - headers.update(kwargs.get('headers')) - headers['Accept'] = 'application/json' - - path_param_keys = ['load_balancer_id', 'pool_id'] - path_param_values = self.encode_path_vars(load_balancer_id, pool_id) - path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/pools/{pool_id}/members'.format(**path_param_dict) - request = self.prepare_request(method='PUT', - url=url, - headers=headers, - params=params, - data=data) - - response = self.send(request, **kwargs) - return response - - - def delete_load_balancer_pool_member(self, - load_balancer_id: str, - pool_id: str, - id: str, - **kwargs - ) -> DetailedResponse: - """ - Delete a load balancer pool member. - - This request deletes a member from the pool. This operation cannot be reversed. - - :param str load_balancer_id: The load balancer identifier. - :param str pool_id: The pool identifier. - :param str id: The member identifier. - :param dict headers: A `dict` containing the request headers - :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse - """ - - if load_balancer_id is None: - raise ValueError('load_balancer_id must be provided') - if pool_id is None: - raise ValueError('pool_id must be provided') - if id is None: - raise ValueError('id must be provided') - headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='delete_load_balancer_pool_member') + operation_id='delete_load_balancer_listener_policy') headers.update(sdk_headers) params = { @@ -15520,10 +15995,10 @@ def delete_load_balancer_pool_member(self, if 'headers' in kwargs: headers.update(kwargs.get('headers')) - path_param_keys = ['load_balancer_id', 'pool_id', 'id'] - path_param_values = self.encode_path_vars(load_balancer_id, pool_id, id) + path_param_keys = ['load_balancer_id', 'listener_id', 'id'] + path_param_values = self.encode_path_vars(load_balancer_id, listener_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}'.format(**path_param_dict) + url = '/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}'.format(**path_param_dict) request = self.prepare_request(method='DELETE', url=url, headers=headers, @@ -15533,36 +16008,35 @@ def delete_load_balancer_pool_member(self, return response - def get_load_balancer_pool_member(self, + def get_load_balancer_listener_policy(self, load_balancer_id: str, - pool_id: str, + listener_id: str, id: str, **kwargs ) -> DetailedResponse: """ - Retrieve a load balancer pool member. + Retrieve a load balancer listener policy. - This request retrieves a single member specified by the identifier in the URL - path. + Retrieve a single policy specified by the identifier in the URL path. :param str load_balancer_id: The load balancer identifier. - :param str pool_id: The pool identifier. - :param str id: The member identifier. + :param str listener_id: The listener identifier. + :param str id: The policy identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPoolMember` object + :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerPolicy` object """ if load_balancer_id is None: raise ValueError('load_balancer_id must be provided') - if pool_id is None: - raise ValueError('pool_id must be provided') + if listener_id is None: + raise ValueError('listener_id must be provided') if id is None: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='get_load_balancer_pool_member') + operation_id='get_load_balancer_listener_policy') headers.update(sdk_headers) params = { @@ -15574,10 +16048,10 @@ def get_load_balancer_pool_member(self, headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' - path_param_keys = ['load_balancer_id', 'pool_id', 'id'] - path_param_values = self.encode_path_vars(load_balancer_id, pool_id, id) + path_param_keys = ['load_balancer_id', 'listener_id', 'id'] + path_param_values = self.encode_path_vars(load_balancer_id, listener_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}'.format(**path_param_dict) + url = '/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers, @@ -15587,42 +16061,42 @@ def get_load_balancer_pool_member(self, return response - def update_load_balancer_pool_member(self, + def update_load_balancer_listener_policy(self, load_balancer_id: str, - pool_id: str, + listener_id: str, id: str, - load_balancer_pool_member_patch: 'LoadBalancerPoolMemberPatch', + load_balancer_listener_policy_patch: 'LoadBalancerListenerPolicyPatch', **kwargs ) -> DetailedResponse: """ - Update a load balancer pool member. + Update a load balancer listener policy. - This request updates an existing member from a member patch. + Updates a policy from a policy patch. :param str load_balancer_id: The load balancer identifier. - :param str pool_id: The pool identifier. - :param str id: The member identifier. - :param LoadBalancerPoolMemberPatch load_balancer_pool_member_patch: The - load balancer pool member patch. + :param str listener_id: The listener identifier. + :param str id: The policy identifier. + :param LoadBalancerListenerPolicyPatch load_balancer_listener_policy_patch: + The listener policy patch. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPoolMember` object + :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerPolicy` object """ if load_balancer_id is None: raise ValueError('load_balancer_id must be provided') - if pool_id is None: - raise ValueError('pool_id must be provided') + if listener_id is None: + raise ValueError('listener_id must be provided') if id is None: raise ValueError('id must be provided') - if load_balancer_pool_member_patch is None: - raise ValueError('load_balancer_pool_member_patch must be provided') - if isinstance(load_balancer_pool_member_patch, LoadBalancerPoolMemberPatch): - load_balancer_pool_member_patch = convert_model(load_balancer_pool_member_patch) + if load_balancer_listener_policy_patch is None: + raise ValueError('load_balancer_listener_policy_patch must be provided') + if isinstance(load_balancer_listener_policy_patch, LoadBalancerListenerPolicyPatch): + load_balancer_listener_policy_patch = convert_model(load_balancer_listener_policy_patch) headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='update_load_balancer_pool_member') + operation_id='update_load_balancer_listener_policy') headers.update(sdk_headers) params = { @@ -15630,17 +16104,17 @@ def update_load_balancer_pool_member(self, 'generation': self.generation } - data = json.dumps(load_balancer_pool_member_patch) + data = json.dumps(load_balancer_listener_policy_patch) headers['content-type'] = 'application/merge-patch+json' if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' - path_param_keys = ['load_balancer_id', 'pool_id', 'id'] - path_param_values = self.encode_path_vars(load_balancer_id, pool_id, id) + path_param_keys = ['load_balancer_id', 'listener_id', 'id'] + path_param_values = self.encode_path_vars(load_balancer_id, listener_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}'.format(**path_param_dict) + url = '/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}'.format(**path_param_dict) request = self.prepare_request(method='PATCH', url=url, headers=headers, @@ -15650,57 +16124,51 @@ def update_load_balancer_pool_member(self, response = self.send(request, **kwargs) return response - ######################### - # Endpoint gateways - ######################### - - def list_endpoint_gateways(self, - *, - name: str = None, - start: str = None, - limit: int = None, - resource_group_id: str = None, + def list_load_balancer_listener_policy_rules(self, + load_balancer_id: str, + listener_id: str, + policy_id: str, **kwargs ) -> DetailedResponse: """ - List all endpoint gateways. + List all rules of a load balancer listener policy. - This request lists all endpoint gateways in the region. An endpoint gateway maps - one or more reserved IPs in a VPC to a target outside the VPC. + This request lists all rules of a load balancer listener policy. - :param str name: (optional) Filters the collection to resources with the - exact specified name. - :param str start: (optional) A server-provided token determining what - resource to start the page on. - :param int limit: (optional) The number of resources to return on a page. - :param str resource_group_id: (optional) Filters the collection to - resources in the resource group with the specified identifier. + :param str load_balancer_id: The load balancer identifier. + :param str listener_id: The listener identifier. + :param str policy_id: The policy identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `EndpointGatewayCollection` object + :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerPolicyRuleCollection` object """ + if load_balancer_id is None: + raise ValueError('load_balancer_id must be provided') + if listener_id is None: + raise ValueError('listener_id must be provided') + if policy_id is None: + raise ValueError('policy_id must be provided') headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='list_endpoint_gateways') + operation_id='list_load_balancer_listener_policy_rules') headers.update(sdk_headers) params = { 'version': self.version, - 'generation': self.generation, - 'name': name, - 'start': start, - 'limit': limit, - 'resource_group.id': resource_group_id + 'generation': self.generation } if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' - url = '/endpoint_gateways' + path_param_keys = ['load_balancer_id', 'listener_id', 'policy_id'] + path_param_values = self.encode_path_vars(load_balancer_id, listener_id, policy_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers, @@ -15710,59 +16178,60 @@ def list_endpoint_gateways(self, return response - def create_endpoint_gateway(self, - target: 'EndpointGatewayTargetPrototype', - vpc: 'VPCIdentity', + def create_load_balancer_listener_policy_rule(self, + load_balancer_id: str, + listener_id: str, + policy_id: str, + condition: str, + type: str, + value: str, *, - ips: List['EndpointGatewayReservedIP'] = None, - name: str = None, - resource_group: 'ResourceGroupIdentity' = None, - security_groups: List['SecurityGroupIdentity'] = None, + field: str = None, **kwargs ) -> DetailedResponse: """ - Create an endpoint gateway. + Create a rule for a load balancer listener policy. - This request creates a new endpoint gateway. An endpoint gateway maps one or more - reserved IPs in a VPC to a target outside the VPC. + Creates a new rule for the load balancer listener policy. - :param EndpointGatewayTargetPrototype target: The target for this endpoint - gateway. - :param VPCIdentity vpc: The VPC this endpoint gateway will serve. - :param List[EndpointGatewayReservedIP] ips: (optional) The reserved IPs to - bind to this endpoint gateway. At most one reserved IP per zone is allowed. - :param str name: (optional) The user-defined name for this endpoint - gateway. If unspecified, the name will be a hyphenated list of - randomly-selected words. Names must be unique within the VPC this endpoint - gateway is serving. - :param ResourceGroupIdentity resource_group: (optional) The resource group - to use. If unspecified, the account's [default resource - group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is - used. - :param List[SecurityGroupIdentity] security_groups: (optional) The security - groups to use for this endpoint gateway. If unspecified, the VPC's default - security group is used. + :param str load_balancer_id: The load balancer identifier. + :param str listener_id: The listener identifier. + :param str policy_id: The policy identifier. + :param str condition: The condition of the rule. + :param str type: The type of the rule. + Body rules are applied to form-encoded request bodies using the `UTF-8` + character set. + :param str value: Value to be matched for rule condition. + If the rule type is `query` and the rule condition is not `matches_regex`, + the value must be percent-encoded. + :param str field: (optional) The field. This is applicable to `header`, + `query`, and `body` rule types. + If the rule type is `header`, this property is required. + If the rule type is `query`, this is optional. If specified and the rule + condition is not + `matches_regex`, the value must be percent-encoded. + If the rule type is `body`, this is optional. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `EndpointGateway` object + :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerPolicyRule` object """ - if target is None: - raise ValueError('target must be provided') - if vpc is None: - raise ValueError('vpc must be provided') - target = convert_model(target) - vpc = convert_model(vpc) - if ips is not None: - ips = [convert_model(x) for x in ips] - if resource_group is not None: - resource_group = convert_model(resource_group) - if security_groups is not None: - security_groups = [convert_model(x) for x in security_groups] + if load_balancer_id is None: + raise ValueError('load_balancer_id must be provided') + if listener_id is None: + raise ValueError('listener_id must be provided') + if policy_id is None: + raise ValueError('policy_id must be provided') + if condition is None: + raise ValueError('condition must be provided') + if type is None: + raise ValueError('type must be provided') + if value is None: + raise ValueError('value must be provided') headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='create_endpoint_gateway') + operation_id='create_load_balancer_listener_policy_rule') headers.update(sdk_headers) params = { @@ -15771,12 +16240,10 @@ def create_endpoint_gateway(self, } data = { - 'target': target, - 'vpc': vpc, - 'ips': ips, - 'name': name, - 'resource_group': resource_group, - 'security_groups': security_groups + 'condition': condition, + 'type': type, + 'value': value, + 'field': field } data = {k: v for (k, v) in data.items() if v is not None} data = json.dumps(data) @@ -15786,7 +16253,10 @@ def create_endpoint_gateway(self, headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' - url = '/endpoint_gateways' + path_param_keys = ['load_balancer_id', 'listener_id', 'policy_id'] + path_param_values = self.encode_path_vars(load_balancer_id, listener_id, policy_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules'.format(**path_param_dict) request = self.prepare_request(method='POST', url=url, headers=headers, @@ -15797,93 +16267,40 @@ def create_endpoint_gateway(self, return response - def list_endpoint_gateway_ips(self, - endpoint_gateway_id: str, - *, - start: str = None, - limit: int = None, - sort: str = None, - **kwargs - ) -> DetailedResponse: - """ - List all reserved IPs bound to an endpoint gateway. - - This request lists all reserved IPs bound to an endpoint gateway. - - :param str endpoint_gateway_id: The endpoint gateway identifier. - :param str start: (optional) A server-provided token determining what - resource to start the page on. - :param int limit: (optional) The number of resources to return on a page. - :param str sort: (optional) Sorts the returned collection by the specified - property name in ascending order. A `-` may be prepended to the name to - sort in descending order. For example, the value `-created_at` sorts the - collection by the `created_at` property in descending order, and the value - `name` sorts it by the `name` property in ascending order. - :param dict headers: A `dict` containing the request headers - :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `ReservedIPCollectionEndpointGatewayContext` object - """ - - if endpoint_gateway_id is None: - raise ValueError('endpoint_gateway_id must be provided') - headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='list_endpoint_gateway_ips') - headers.update(sdk_headers) - - params = { - 'version': self.version, - 'generation': self.generation, - 'start': start, - 'limit': limit, - 'sort': sort - } - - if 'headers' in kwargs: - headers.update(kwargs.get('headers')) - headers['Accept'] = 'application/json' - - path_param_keys = ['endpoint_gateway_id'] - path_param_values = self.encode_path_vars(endpoint_gateway_id) - path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/endpoint_gateways/{endpoint_gateway_id}/ips'.format(**path_param_dict) - request = self.prepare_request(method='GET', - url=url, - headers=headers, - params=params) - - response = self.send(request, **kwargs) - return response - - - def remove_endpoint_gateway_ip(self, - endpoint_gateway_id: str, + def delete_load_balancer_listener_policy_rule(self, + load_balancer_id: str, + listener_id: str, + policy_id: str, id: str, **kwargs ) -> DetailedResponse: """ - Unbind a reserved IP from an endpoint gateway. + Delete a load balancer listener policy rule. - This request unbinds the specified reserved IP from the specified endpoint - gateway. If the reserved IP has `auto_delete` set to `true`, the reserved IP will - be deleted. + Deletes a rule from the load balancer listener policy. This operation cannot be + reversed. - :param str endpoint_gateway_id: The endpoint gateway identifier. - :param str id: The reserved IP identifier. + :param str load_balancer_id: The load balancer identifier. + :param str listener_id: The listener identifier. + :param str policy_id: The policy identifier. + :param str id: The rule identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse """ - if endpoint_gateway_id is None: - raise ValueError('endpoint_gateway_id must be provided') + if load_balancer_id is None: + raise ValueError('load_balancer_id must be provided') + if listener_id is None: + raise ValueError('listener_id must be provided') + if policy_id is None: + raise ValueError('policy_id must be provided') if id is None: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='remove_endpoint_gateway_ip') + operation_id='delete_load_balancer_listener_policy_rule') headers.update(sdk_headers) params = { @@ -15894,10 +16311,10 @@ def remove_endpoint_gateway_ip(self, if 'headers' in kwargs: headers.update(kwargs.get('headers')) - path_param_keys = ['endpoint_gateway_id', 'id'] - path_param_values = self.encode_path_vars(endpoint_gateway_id, id) + path_param_keys = ['load_balancer_id', 'listener_id', 'policy_id', 'id'] + path_param_values = self.encode_path_vars(load_balancer_id, listener_id, policy_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/endpoint_gateways/{endpoint_gateway_id}/ips/{id}'.format(**path_param_dict) + url = '/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}'.format(**path_param_dict) request = self.prepare_request(method='DELETE', url=url, headers=headers, @@ -15907,32 +16324,39 @@ def remove_endpoint_gateway_ip(self, return response - def get_endpoint_gateway_ip(self, - endpoint_gateway_id: str, + def get_load_balancer_listener_policy_rule(self, + load_balancer_id: str, + listener_id: str, + policy_id: str, id: str, **kwargs ) -> DetailedResponse: """ - Retrieve a reserved IP bound to an endpoint gateway. + Retrieve a load balancer listener policy rule. - This request a retrieves the specified reserved IP address if it is bound to the - endpoint gateway specified in the URL. + Retrieves a single rule specified by the identifier in the URL path. - :param str endpoint_gateway_id: The endpoint gateway identifier. - :param str id: The reserved IP identifier. + :param str load_balancer_id: The load balancer identifier. + :param str listener_id: The listener identifier. + :param str policy_id: The policy identifier. + :param str id: The rule identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `ReservedIP` object + :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerPolicyRule` object """ - if endpoint_gateway_id is None: - raise ValueError('endpoint_gateway_id must be provided') + if load_balancer_id is None: + raise ValueError('load_balancer_id must be provided') + if listener_id is None: + raise ValueError('listener_id must be provided') + if policy_id is None: + raise ValueError('policy_id must be provided') if id is None: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='get_endpoint_gateway_ip') + operation_id='get_load_balancer_listener_policy_rule') headers.update(sdk_headers) params = { @@ -15944,10 +16368,10 @@ def get_endpoint_gateway_ip(self, headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' - path_param_keys = ['endpoint_gateway_id', 'id'] - path_param_values = self.encode_path_vars(endpoint_gateway_id, id) + path_param_keys = ['load_balancer_id', 'listener_id', 'policy_id', 'id'] + path_param_values = self.encode_path_vars(load_balancer_id, listener_id, policy_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/endpoint_gateways/{endpoint_gateway_id}/ips/{id}'.format(**path_param_dict) + url = '/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers, @@ -15957,35 +16381,46 @@ def get_endpoint_gateway_ip(self, return response - def add_endpoint_gateway_ip(self, - endpoint_gateway_id: str, + def update_load_balancer_listener_policy_rule(self, + load_balancer_id: str, + listener_id: str, + policy_id: str, id: str, + load_balancer_listener_policy_rule_patch: 'LoadBalancerListenerPolicyRulePatch', **kwargs ) -> DetailedResponse: """ - Bind a reserved IP to an endpoint gateway. + Update a load balancer listener policy rule. - This request binds the specified reserved IP to the specified endpoint gateway. - The reserved IP: - - must currently be unbound - - must not be in the same zone as any other reserved IP bound to the endpoint - gateway. + Updates a rule of the load balancer listener policy. - :param str endpoint_gateway_id: The endpoint gateway identifier. - :param str id: The reserved IP identifier. + :param str load_balancer_id: The load balancer identifier. + :param str listener_id: The listener identifier. + :param str policy_id: The policy identifier. + :param str id: The rule identifier. + :param LoadBalancerListenerPolicyRulePatch + load_balancer_listener_policy_rule_patch: The listener policy rule patch. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `ReservedIP` object + :rtype: DetailedResponse with `dict` result representing a `LoadBalancerListenerPolicyRule` object """ - if endpoint_gateway_id is None: - raise ValueError('endpoint_gateway_id must be provided') + if load_balancer_id is None: + raise ValueError('load_balancer_id must be provided') + if listener_id is None: + raise ValueError('listener_id must be provided') + if policy_id is None: + raise ValueError('policy_id must be provided') if id is None: raise ValueError('id must be provided') + if load_balancer_listener_policy_rule_patch is None: + raise ValueError('load_balancer_listener_policy_rule_patch must be provided') + if isinstance(load_balancer_listener_policy_rule_patch, LoadBalancerListenerPolicyRulePatch): + load_balancer_listener_policy_rule_patch = convert_model(load_balancer_listener_policy_rule_patch) headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='add_endpoint_gateway_ip') + operation_id='update_load_balancer_listener_policy_rule') headers.update(sdk_headers) params = { @@ -15993,46 +16428,48 @@ def add_endpoint_gateway_ip(self, 'generation': self.generation } + data = json.dumps(load_balancer_listener_policy_rule_patch) + headers['content-type'] = 'application/merge-patch+json' + if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' - path_param_keys = ['endpoint_gateway_id', 'id'] - path_param_values = self.encode_path_vars(endpoint_gateway_id, id) + path_param_keys = ['load_balancer_id', 'listener_id', 'policy_id', 'id'] + path_param_values = self.encode_path_vars(load_balancer_id, listener_id, policy_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/endpoint_gateways/{endpoint_gateway_id}/ips/{id}'.format(**path_param_dict) - request = self.prepare_request(method='PUT', + url = '/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}'.format(**path_param_dict) + request = self.prepare_request(method='PATCH', url=url, headers=headers, - params=params) + params=params, + data=data) response = self.send(request, **kwargs) return response - def delete_endpoint_gateway(self, - id: str, + def list_load_balancer_pools(self, + load_balancer_id: str, **kwargs ) -> DetailedResponse: """ - Delete an endpoint gateway. + List all pools of a load balancer. - This request deletes an endpoint gateway. This operation cannot be reversed. - Reserved IPs that were bound to the endpoint gateway will be released if their - `auto_delete` property is set to true. + This request lists all pools of a load balancer. - :param str id: The endpoint gateway identifier. + :param str load_balancer_id: The load balancer identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse + :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPoolCollection` object """ - if id is None: - raise ValueError('id must be provided') + if load_balancer_id is None: + raise ValueError('load_balancer_id must be provided') headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='delete_endpoint_gateway') + operation_id='list_load_balancer_pools') headers.update(sdk_headers) params = { @@ -16042,12 +16479,13 @@ def delete_endpoint_gateway(self, if 'headers' in kwargs: headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' - path_param_keys = ['id'] - path_param_values = self.encode_path_vars(id) + path_param_keys = ['load_balancer_id'] + path_param_values = self.encode_path_vars(load_balancer_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/endpoint_gateways/{id}'.format(**path_param_dict) - request = self.prepare_request(method='DELETE', + url = '/load_balancers/{load_balancer_id}/pools'.format(**path_param_dict) + request = self.prepare_request(method='GET', url=url, headers=headers, params=params) @@ -16056,28 +16494,181 @@ def delete_endpoint_gateway(self, return response - def get_endpoint_gateway(self, - id: str, + def create_load_balancer_pool(self, + load_balancer_id: str, + algorithm: str, + health_monitor: 'LoadBalancerPoolHealthMonitorPrototype', + protocol: str, + *, + members: List['LoadBalancerPoolMemberPrototype'] = None, + name: str = None, + proxy_protocol: str = None, + session_persistence: 'LoadBalancerPoolSessionPersistencePrototype' = None, **kwargs ) -> DetailedResponse: """ - Retrieve an endpoint gateway. + Create a load balancer pool. - This request retrieves a single endpoint gateway specified by the identifier in - the URL. + This request creates a new pool from a pool prototype object. - :param str id: The endpoint gateway identifier. - :param dict headers: A `dict` containing the request headers - :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `EndpointGateway` object - """ + :param str load_balancer_id: The load balancer identifier. + :param str algorithm: The load balancing algorithm. + :param LoadBalancerPoolHealthMonitorPrototype health_monitor: The health + monitor of this pool. + :param str protocol: The protocol used for this load balancer pool. Load + balancers in the `network` family support `tcp` and `udp` (if + `udp_supported` is `true`). Load balancers in the + `application` family support `tcp`, `http`, and `https`. + :param List[LoadBalancerPoolMemberPrototype] members: (optional) The + members for this load balancer pool. For load balancers in the `network` + family, the same `port` and `target` tuple cannot be shared by a pool + member of any other load balancer in the same VPC. + :param str name: (optional) The user-defined name for this load balancer + pool. If unspecified, the name will be a hyphenated list of + randomly-selected words. + :param str proxy_protocol: (optional) The PROXY protocol setting for this + pool: + - `v1`: Enabled with version 1 (human-readable header format) + - `v2`: Enabled with version 2 (binary header format) + - `disabled`: Disabled + Supported by load balancers in the `application` family (otherwise always + `disabled`). + :param LoadBalancerPoolSessionPersistencePrototype session_persistence: + (optional) The session persistence of this pool. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPool` object + """ + + if load_balancer_id is None: + raise ValueError('load_balancer_id must be provided') + if algorithm is None: + raise ValueError('algorithm must be provided') + if health_monitor is None: + raise ValueError('health_monitor must be provided') + if protocol is None: + raise ValueError('protocol must be provided') + health_monitor = convert_model(health_monitor) + if members is not None: + members = [convert_model(x) for x in members] + if session_persistence is not None: + session_persistence = convert_model(session_persistence) + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='create_load_balancer_pool') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation + } + + data = { + 'algorithm': algorithm, + 'health_monitor': health_monitor, + 'protocol': protocol, + 'members': members, + 'name': name, + 'proxy_protocol': proxy_protocol, + 'session_persistence': session_persistence + } + data = {k: v for (k, v) in data.items() if v is not None} + data = json.dumps(data) + headers['content-type'] = 'application/json' + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['load_balancer_id'] + path_param_values = self.encode_path_vars(load_balancer_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/load_balancers/{load_balancer_id}/pools'.format(**path_param_dict) + request = self.prepare_request(method='POST', + url=url, + headers=headers, + params=params, + data=data) + + response = self.send(request, **kwargs) + return response + + + def delete_load_balancer_pool(self, + load_balancer_id: str, + id: str, + **kwargs + ) -> DetailedResponse: + """ + Delete a load balancer pool. + + This request deletes a load balancer pool. This operation cannot be reversed. The + pool must not currently be the default pool for any listener in the load balancer. + + :param str load_balancer_id: The load balancer identifier. + :param str id: The pool identifier. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse + """ + if load_balancer_id is None: + raise ValueError('load_balancer_id must be provided') if id is None: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='get_endpoint_gateway') + operation_id='delete_load_balancer_pool') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + + path_param_keys = ['load_balancer_id', 'id'] + path_param_values = self.encode_path_vars(load_balancer_id, id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/load_balancers/{load_balancer_id}/pools/{id}'.format(**path_param_dict) + request = self.prepare_request(method='DELETE', + url=url, + headers=headers, + params=params) + + response = self.send(request, **kwargs) + return response + + + def get_load_balancer_pool(self, + load_balancer_id: str, + id: str, + **kwargs + ) -> DetailedResponse: + """ + Retrieve a load balancer pool. + + This request retrieves a single pool specified by the identifier in the URL path. + + :param str load_balancer_id: The load balancer identifier. + :param str id: The pool identifier. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPool` object + """ + + if load_balancer_id is None: + raise ValueError('load_balancer_id must be provided') + if id is None: + raise ValueError('id must be provided') + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='get_load_balancer_pool') headers.update(sdk_headers) params = { @@ -16089,10 +16680,10 @@ def get_endpoint_gateway(self, headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' - path_param_keys = ['id'] - path_param_values = self.encode_path_vars(id) + path_param_keys = ['load_balancer_id', 'id'] + path_param_values = self.encode_path_vars(load_balancer_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/endpoint_gateways/{id}'.format(**path_param_dict) + url = '/load_balancers/{load_balancer_id}/pools/{id}'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers, @@ -16102,34 +16693,38 @@ def get_endpoint_gateway(self, return response - def update_endpoint_gateway(self, + def update_load_balancer_pool(self, + load_balancer_id: str, id: str, - endpoint_gateway_patch: 'EndpointGatewayPatch', + load_balancer_pool_patch: 'LoadBalancerPoolPatch', **kwargs ) -> DetailedResponse: """ - Update an endpoint gateway. + Update a load balancer pool. - This request updates an endpoint gateway's name. + This request updates a load balancer pool from a pool patch. - :param str id: The endpoint gateway identifier. - :param EndpointGatewayPatch endpoint_gateway_patch: The endpoint gateway - patch. + :param str load_balancer_id: The load balancer identifier. + :param str id: The pool identifier. + :param LoadBalancerPoolPatch load_balancer_pool_patch: The load balancer + pool patch. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `EndpointGateway` object + :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPool` object """ + if load_balancer_id is None: + raise ValueError('load_balancer_id must be provided') if id is None: raise ValueError('id must be provided') - if endpoint_gateway_patch is None: - raise ValueError('endpoint_gateway_patch must be provided') - if isinstance(endpoint_gateway_patch, EndpointGatewayPatch): - endpoint_gateway_patch = convert_model(endpoint_gateway_patch) + if load_balancer_pool_patch is None: + raise ValueError('load_balancer_pool_patch must be provided') + if isinstance(load_balancer_pool_patch, LoadBalancerPoolPatch): + load_balancer_pool_patch = convert_model(load_balancer_pool_patch) headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='update_endpoint_gateway') + operation_id='update_load_balancer_pool') headers.update(sdk_headers) params = { @@ -16137,17 +16732,17 @@ def update_endpoint_gateway(self, 'generation': self.generation } - data = json.dumps(endpoint_gateway_patch) + data = json.dumps(load_balancer_pool_patch) headers['content-type'] = 'application/merge-patch+json' if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' - path_param_keys = ['id'] - path_param_values = self.encode_path_vars(id) + path_param_keys = ['load_balancer_id', 'id'] + path_param_values = self.encode_path_vars(load_balancer_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/endpoint_gateways/{id}'.format(**path_param_dict) + url = '/load_balancers/{load_balancer_id}/pools/{id}'.format(**path_param_dict) request = self.prepare_request(method='PATCH', url=url, headers=headers, @@ -16157,78 +16752,47 @@ def update_endpoint_gateway(self, response = self.send(request, **kwargs) return response - ######################### - # Flow log collectors - ######################### - - def list_flow_log_collectors(self, - *, - start: str = None, - limit: int = None, - resource_group_id: str = None, - name: str = None, - vpc_id: str = None, - vpc_crn: str = None, - vpc_name: str = None, - target_id: str = None, - target_resource_type: str = None, + def list_load_balancer_pool_members(self, + load_balancer_id: str, + pool_id: str, **kwargs ) -> DetailedResponse: """ - List all flow log collectors. + List all members of a load balancer pool. - This request lists all flow log collectors in the region. A flow log collector - summarizes data sent over one or more network interfaces within a VPC, depending - on the chosen target. + This request lists all members of a load balancer pool. - :param str start: (optional) A server-provided token determining what - resource to start the page on. - :param int limit: (optional) The number of resources to return on a page. - :param str resource_group_id: (optional) Filters the collection to - resources in the resource group with the specified identifier. - :param str name: (optional) Filters the collection to resources with the - exact specified name. - :param str vpc_id: (optional) Filters the collection to resources in the - VPC with the specified identifier. - :param str vpc_crn: (optional) Filters the collection to resources in the - VPC with the specified CRN. - :param str vpc_name: (optional) Filters the collection to resources in the - VPC with the exact specified name. - :param str target_id: (optional) Filters the collection to flow log - collectors that target the specified resource. - :param str target_resource_type: (optional) Filters the collection to flow - log collectors that target the specified resource type. + :param str load_balancer_id: The load balancer identifier. + :param str pool_id: The pool identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `FlowLogCollectorCollection` object + :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPoolMemberCollection` object """ + if load_balancer_id is None: + raise ValueError('load_balancer_id must be provided') + if pool_id is None: + raise ValueError('pool_id must be provided') headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='list_flow_log_collectors') + operation_id='list_load_balancer_pool_members') headers.update(sdk_headers) params = { 'version': self.version, - 'generation': self.generation, - 'start': start, - 'limit': limit, - 'resource_group.id': resource_group_id, - 'name': name, - 'vpc.id': vpc_id, - 'vpc.crn': vpc_crn, - 'vpc.name': vpc_name, - 'target.id': target_id, - 'target.resource_type': target_resource_type + 'generation': self.generation } if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' - url = '/flow_log_collectors' + path_param_keys = ['load_balancer_id', 'pool_id'] + path_param_values = self.encode_path_vars(load_balancer_id, pool_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/load_balancers/{load_balancer_id}/pools/{pool_id}/members'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers, @@ -16238,60 +16802,59 @@ def list_flow_log_collectors(self, return response - def create_flow_log_collector(self, - storage_bucket: 'LegacyCloudObjectStorageBucketIdentity', - target: 'FlowLogCollectorTargetPrototype', + def create_load_balancer_pool_member(self, + load_balancer_id: str, + pool_id: str, + port: int, + target: 'LoadBalancerPoolMemberTargetPrototype', *, - active: bool = None, - name: str = None, - resource_group: 'ResourceGroupIdentity' = None, + weight: int = None, **kwargs ) -> DetailedResponse: """ - Create a flow log collector. + Create a member in a load balancer pool. - This request creates and starts a new flow log collector from a flow log collector - prototype object. The prototype object is structured in the same way as a - retrieved flow log collector, and contains the information necessary to create and - start the new flow log collector. + This request creates a new member and adds the member to the pool. - :param LegacyCloudObjectStorageBucketIdentity storage_bucket: The Cloud - Object Storage bucket where the collected flows will be logged. - The bucket must exist and an IAM service authorization must grant - `IBM Cloud Flow Logs` resources of `VPC Infrastructure Services` writer - access to the bucket. - :param FlowLogCollectorTargetPrototype target: The target this collector - will collect flow logs for. If the target is an instance, - subnet, or VPC, flow logs will not be collected for any network interfaces - within the - target that are themselves the target of a more specific flow log - collector. - :param bool active: (optional) Indicates whether this collector will be - active upon creation. - :param str name: (optional) The unique user-defined name for this flow log - collector. If unspecified, the name will be a hyphenated list of - randomly-selected words. - :param ResourceGroupIdentity resource_group: (optional) The resource group - to use. If unspecified, the account's [default resource - group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is - used. + :param str load_balancer_id: The load balancer identifier. + :param str pool_id: The pool identifier. + :param int port: The port the member will receive load balancer traffic on. + Applies only to load balancer traffic received on a listener with a single + port. (If the traffic is received on a listener with a port range, the + member will receive the traffic on the same port the listener received it + on.) + This port will also be used for health checks unless the `port` property of + `health_monitor` property is specified. + The port must be unique across all members for all pools associated with + this pool's listener. + :param LoadBalancerPoolMemberTargetPrototype target: The pool member + target. Load balancers in the `network` family support virtual server + instances. Load balancers in the `application` family support IP addresses. + If the load + balancer has route mode enabled, the member must be in a zone the load + balancer has a + subnet in. + :param int weight: (optional) Weight of the server member. Applicable only + if the pool algorithm is + `weighted_round_robin`. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `FlowLogCollector` object + :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPoolMember` object """ - if storage_bucket is None: - raise ValueError('storage_bucket must be provided') + if load_balancer_id is None: + raise ValueError('load_balancer_id must be provided') + if pool_id is None: + raise ValueError('pool_id must be provided') + if port is None: + raise ValueError('port must be provided') if target is None: raise ValueError('target must be provided') - storage_bucket = convert_model(storage_bucket) target = convert_model(target) - if resource_group is not None: - resource_group = convert_model(resource_group) headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='create_flow_log_collector') + operation_id='create_load_balancer_pool_member') headers.update(sdk_headers) params = { @@ -16300,11 +16863,9 @@ def create_flow_log_collector(self, } data = { - 'storage_bucket': storage_bucket, + 'port': port, 'target': target, - 'active': active, - 'name': name, - 'resource_group': resource_group + 'weight': weight } data = {k: v for (k, v) in data.items() if v is not None} data = json.dumps(data) @@ -16314,7 +16875,10 @@ def create_flow_log_collector(self, headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' - url = '/flow_log_collectors' + path_param_keys = ['load_balancer_id', 'pool_id'] + path_param_values = self.encode_path_vars(load_balancer_id, pool_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/load_balancers/{load_balancer_id}/pools/{pool_id}/members'.format(**path_param_dict) request = self.prepare_request(method='POST', url=url, headers=headers, @@ -16325,30 +16889,99 @@ def create_flow_log_collector(self, return response - def delete_flow_log_collector(self, + def replace_load_balancer_pool_members(self, + load_balancer_id: str, + pool_id: str, + members: List['LoadBalancerPoolMemberPrototype'], + **kwargs + ) -> DetailedResponse: + """ + Replace load balancer pool members. + + This request replaces the existing members of the load balancer pool with new + members created from the collection of member prototype objects. + + :param str load_balancer_id: The load balancer identifier. + :param str pool_id: The pool identifier. + :param List[LoadBalancerPoolMemberPrototype] members: The member prototype + objects for this pool. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPoolMemberCollection` object + """ + + if load_balancer_id is None: + raise ValueError('load_balancer_id must be provided') + if pool_id is None: + raise ValueError('pool_id must be provided') + if members is None: + raise ValueError('members must be provided') + members = [convert_model(x) for x in members] + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='replace_load_balancer_pool_members') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation + } + + data = { + 'members': members + } + data = {k: v for (k, v) in data.items() if v is not None} + data = json.dumps(data) + headers['content-type'] = 'application/json' + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['load_balancer_id', 'pool_id'] + path_param_values = self.encode_path_vars(load_balancer_id, pool_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/load_balancers/{load_balancer_id}/pools/{pool_id}/members'.format(**path_param_dict) + request = self.prepare_request(method='PUT', + url=url, + headers=headers, + params=params, + data=data) + + response = self.send(request, **kwargs) + return response + + + def delete_load_balancer_pool_member(self, + load_balancer_id: str, + pool_id: str, id: str, **kwargs ) -> DetailedResponse: """ - Delete a flow log collector. + Delete a load balancer pool member. - This request stops and deletes a flow log collector. This operation cannot be - reversed. - Collected flow logs remain available within the flow log collector's Cloud Object - Storage bucket. + This request deletes a member from the pool. This operation cannot be reversed. - :param str id: The flow log collector identifier. + :param str load_balancer_id: The load balancer identifier. + :param str pool_id: The pool identifier. + :param str id: The member identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse """ + if load_balancer_id is None: + raise ValueError('load_balancer_id must be provided') + if pool_id is None: + raise ValueError('pool_id must be provided') if id is None: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='delete_flow_log_collector') + operation_id='delete_load_balancer_pool_member') headers.update(sdk_headers) params = { @@ -16359,10 +16992,10 @@ def delete_flow_log_collector(self, if 'headers' in kwargs: headers.update(kwargs.get('headers')) - path_param_keys = ['id'] - path_param_values = self.encode_path_vars(id) + path_param_keys = ['load_balancer_id', 'pool_id', 'id'] + path_param_values = self.encode_path_vars(load_balancer_id, pool_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/flow_log_collectors/{id}'.format(**path_param_dict) + url = '/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}'.format(**path_param_dict) request = self.prepare_request(method='DELETE', url=url, headers=headers, @@ -16372,28 +17005,36 @@ def delete_flow_log_collector(self, return response - def get_flow_log_collector(self, + def get_load_balancer_pool_member(self, + load_balancer_id: str, + pool_id: str, id: str, **kwargs ) -> DetailedResponse: """ - Retrieve a flow log collector. + Retrieve a load balancer pool member. - This request retrieves a single flow log collector specified by the identifier in - the URL. + This request retrieves a single member specified by the identifier in the URL + path. - :param str id: The flow log collector identifier. + :param str load_balancer_id: The load balancer identifier. + :param str pool_id: The pool identifier. + :param str id: The member identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `FlowLogCollector` object + :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPoolMember` object """ + if load_balancer_id is None: + raise ValueError('load_balancer_id must be provided') + if pool_id is None: + raise ValueError('pool_id must be provided') if id is None: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='get_flow_log_collector') + operation_id='get_load_balancer_pool_member') headers.update(sdk_headers) params = { @@ -16405,10 +17046,10 @@ def get_flow_log_collector(self, headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' - path_param_keys = ['id'] - path_param_values = self.encode_path_vars(id) + path_param_keys = ['load_balancer_id', 'pool_id', 'id'] + path_param_values = self.encode_path_vars(load_balancer_id, pool_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/flow_log_collectors/{id}'.format(**path_param_dict) + url = '/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers, @@ -16418,37 +17059,42 @@ def get_flow_log_collector(self, return response - def update_flow_log_collector(self, + def update_load_balancer_pool_member(self, + load_balancer_id: str, + pool_id: str, id: str, - flow_log_collector_patch: 'FlowLogCollectorPatch', + load_balancer_pool_member_patch: 'LoadBalancerPoolMemberPatch', **kwargs ) -> DetailedResponse: """ - Update a flow log collector. + Update a load balancer pool member. - This request updates a flow log collector with the information in a provided flow - log collector patch. The flow log collector patch object is structured in the same - way as a retrieved flow log collector and contains only the information to be - updated. + This request updates an existing member from a member patch. - :param str id: The flow log collector identifier. - :param FlowLogCollectorPatch flow_log_collector_patch: The flow log - collector patch. + :param str load_balancer_id: The load balancer identifier. + :param str pool_id: The pool identifier. + :param str id: The member identifier. + :param LoadBalancerPoolMemberPatch load_balancer_pool_member_patch: The + load balancer pool member patch. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `FlowLogCollector` object + :rtype: DetailedResponse with `dict` result representing a `LoadBalancerPoolMember` object """ + if load_balancer_id is None: + raise ValueError('load_balancer_id must be provided') + if pool_id is None: + raise ValueError('pool_id must be provided') if id is None: raise ValueError('id must be provided') - if flow_log_collector_patch is None: - raise ValueError('flow_log_collector_patch must be provided') - if isinstance(flow_log_collector_patch, FlowLogCollectorPatch): - flow_log_collector_patch = convert_model(flow_log_collector_patch) + if load_balancer_pool_member_patch is None: + raise ValueError('load_balancer_pool_member_patch must be provided') + if isinstance(load_balancer_pool_member_patch, LoadBalancerPoolMemberPatch): + load_balancer_pool_member_patch = convert_model(load_balancer_pool_member_patch) headers = {} sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='update_flow_log_collector') + operation_id='update_load_balancer_pool_member') headers.update(sdk_headers) params = { @@ -16456,17 +17102,17 @@ def update_flow_log_collector(self, 'generation': self.generation } - data = json.dumps(flow_log_collector_patch) + data = json.dumps(load_balancer_pool_member_patch) headers['content-type'] = 'application/merge-patch+json' if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' - path_param_keys = ['id'] - path_param_values = self.encode_path_vars(id) + path_param_keys = ['load_balancer_id', 'pool_id', 'id'] + path_param_values = self.encode_path_vars(load_balancer_id, pool_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/flow_log_collectors/{id}'.format(**path_param_dict) + url = '/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}'.format(**path_param_dict) request = self.prepare_request(method='PATCH', url=url, headers=headers, @@ -16476,254 +17122,4456 @@ def update_flow_log_collector(self, response = self.send(request, **kwargs) return response - -class ListSubnetReservedIpsEnums: + ######################### + # Endpoint gateways + ######################### + + + def list_endpoint_gateways(self, + *, + name: str = None, + start: str = None, + limit: int = None, + resource_group_id: str = None, + **kwargs + ) -> DetailedResponse: + """ + List all endpoint gateways. + + This request lists all endpoint gateways in the region. An endpoint gateway maps + one or more reserved IPs in a VPC to a target outside the VPC. + + :param str name: (optional) Filters the collection to resources with the + exact specified name. + :param str start: (optional) A server-provided token determining what + resource to start the page on. + :param int limit: (optional) The number of resources to return on a page. + :param str resource_group_id: (optional) Filters the collection to + resources in the resource group with the specified identifier. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `EndpointGatewayCollection` object + """ + + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='list_endpoint_gateways') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation, + 'name': name, + 'start': start, + 'limit': limit, + 'resource_group.id': resource_group_id + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + url = '/endpoint_gateways' + request = self.prepare_request(method='GET', + url=url, + headers=headers, + params=params) + + response = self.send(request, **kwargs) + return response + + + def create_endpoint_gateway(self, + target: 'EndpointGatewayTargetPrototype', + vpc: 'VPCIdentity', + *, + ips: List['EndpointGatewayReservedIP'] = None, + name: str = None, + resource_group: 'ResourceGroupIdentity' = None, + security_groups: List['SecurityGroupIdentity'] = None, + **kwargs + ) -> DetailedResponse: + """ + Create an endpoint gateway. + + This request creates a new endpoint gateway. An endpoint gateway maps one or more + reserved IPs in a VPC to a target outside the VPC. + + :param EndpointGatewayTargetPrototype target: The target for this endpoint + gateway. + :param VPCIdentity vpc: The VPC this endpoint gateway will serve. + :param List[EndpointGatewayReservedIP] ips: (optional) The reserved IPs to + bind to this endpoint gateway. At most one reserved IP per zone is allowed. + :param str name: (optional) The user-defined name for this endpoint + gateway. If unspecified, the name will be a hyphenated list of + randomly-selected words. Names must be unique within the VPC this endpoint + gateway is serving. + :param ResourceGroupIdentity resource_group: (optional) The resource group + to use. If unspecified, the account's [default resource + group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is + used. + :param List[SecurityGroupIdentity] security_groups: (optional) The security + groups to use for this endpoint gateway. If unspecified, the VPC's default + security group is used. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `EndpointGateway` object + """ + + if target is None: + raise ValueError('target must be provided') + if vpc is None: + raise ValueError('vpc must be provided') + target = convert_model(target) + vpc = convert_model(vpc) + if ips is not None: + ips = [convert_model(x) for x in ips] + if resource_group is not None: + resource_group = convert_model(resource_group) + if security_groups is not None: + security_groups = [convert_model(x) for x in security_groups] + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='create_endpoint_gateway') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation + } + + data = { + 'target': target, + 'vpc': vpc, + 'ips': ips, + 'name': name, + 'resource_group': resource_group, + 'security_groups': security_groups + } + data = {k: v for (k, v) in data.items() if v is not None} + data = json.dumps(data) + headers['content-type'] = 'application/json' + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + url = '/endpoint_gateways' + request = self.prepare_request(method='POST', + url=url, + headers=headers, + params=params, + data=data) + + response = self.send(request, **kwargs) + return response + + + def list_endpoint_gateway_ips(self, + endpoint_gateway_id: str, + *, + start: str = None, + limit: int = None, + sort: str = None, + **kwargs + ) -> DetailedResponse: + """ + List all reserved IPs bound to an endpoint gateway. + + This request lists all reserved IPs bound to an endpoint gateway. + + :param str endpoint_gateway_id: The endpoint gateway identifier. + :param str start: (optional) A server-provided token determining what + resource to start the page on. + :param int limit: (optional) The number of resources to return on a page. + :param str sort: (optional) Sorts the returned collection by the specified + property name in ascending order. A `-` may be prepended to the name to + sort in descending order. For example, the value `-created_at` sorts the + collection by the `created_at` property in descending order, and the value + `name` sorts it by the `name` property in ascending order. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `ReservedIPCollectionEndpointGatewayContext` object + """ + + if endpoint_gateway_id is None: + raise ValueError('endpoint_gateway_id must be provided') + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='list_endpoint_gateway_ips') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation, + 'start': start, + 'limit': limit, + 'sort': sort + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['endpoint_gateway_id'] + path_param_values = self.encode_path_vars(endpoint_gateway_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/endpoint_gateways/{endpoint_gateway_id}/ips'.format(**path_param_dict) + request = self.prepare_request(method='GET', + url=url, + headers=headers, + params=params) + + response = self.send(request, **kwargs) + return response + + + def remove_endpoint_gateway_ip(self, + endpoint_gateway_id: str, + id: str, + **kwargs + ) -> DetailedResponse: + """ + Unbind a reserved IP from an endpoint gateway. + + This request unbinds the specified reserved IP from the specified endpoint + gateway. If the reserved IP has `auto_delete` set to `true`, the reserved IP will + be deleted. + + :param str endpoint_gateway_id: The endpoint gateway identifier. + :param str id: The reserved IP identifier. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse + """ + + if endpoint_gateway_id is None: + raise ValueError('endpoint_gateway_id must be provided') + if id is None: + raise ValueError('id must be provided') + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='remove_endpoint_gateway_ip') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + + path_param_keys = ['endpoint_gateway_id', 'id'] + path_param_values = self.encode_path_vars(endpoint_gateway_id, id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/endpoint_gateways/{endpoint_gateway_id}/ips/{id}'.format(**path_param_dict) + request = self.prepare_request(method='DELETE', + url=url, + headers=headers, + params=params) + + response = self.send(request, **kwargs) + return response + + + def get_endpoint_gateway_ip(self, + endpoint_gateway_id: str, + id: str, + **kwargs + ) -> DetailedResponse: + """ + Retrieve a reserved IP bound to an endpoint gateway. + + This request a retrieves the specified reserved IP address if it is bound to the + endpoint gateway specified in the URL. + + :param str endpoint_gateway_id: The endpoint gateway identifier. + :param str id: The reserved IP identifier. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `ReservedIP` object + """ + + if endpoint_gateway_id is None: + raise ValueError('endpoint_gateway_id must be provided') + if id is None: + raise ValueError('id must be provided') + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='get_endpoint_gateway_ip') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['endpoint_gateway_id', 'id'] + path_param_values = self.encode_path_vars(endpoint_gateway_id, id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/endpoint_gateways/{endpoint_gateway_id}/ips/{id}'.format(**path_param_dict) + request = self.prepare_request(method='GET', + url=url, + headers=headers, + params=params) + + response = self.send(request, **kwargs) + return response + + + def add_endpoint_gateway_ip(self, + endpoint_gateway_id: str, + id: str, + **kwargs + ) -> DetailedResponse: + """ + Bind a reserved IP to an endpoint gateway. + + This request binds the specified reserved IP to the specified endpoint gateway. + The reserved IP: + - must currently be unbound + - must not be in the same zone as any other reserved IP bound to the endpoint + gateway. + + :param str endpoint_gateway_id: The endpoint gateway identifier. + :param str id: The reserved IP identifier. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `ReservedIP` object + """ + + if endpoint_gateway_id is None: + raise ValueError('endpoint_gateway_id must be provided') + if id is None: + raise ValueError('id must be provided') + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='add_endpoint_gateway_ip') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['endpoint_gateway_id', 'id'] + path_param_values = self.encode_path_vars(endpoint_gateway_id, id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/endpoint_gateways/{endpoint_gateway_id}/ips/{id}'.format(**path_param_dict) + request = self.prepare_request(method='PUT', + url=url, + headers=headers, + params=params) + + response = self.send(request, **kwargs) + return response + + + def delete_endpoint_gateway(self, + id: str, + **kwargs + ) -> DetailedResponse: + """ + Delete an endpoint gateway. + + This request deletes an endpoint gateway. This operation cannot be reversed. + Reserved IPs that were bound to the endpoint gateway will be released if their + `auto_delete` property is set to true. + + :param str id: The endpoint gateway identifier. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse + """ + + if id is None: + raise ValueError('id must be provided') + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='delete_endpoint_gateway') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + + path_param_keys = ['id'] + path_param_values = self.encode_path_vars(id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/endpoint_gateways/{id}'.format(**path_param_dict) + request = self.prepare_request(method='DELETE', + url=url, + headers=headers, + params=params) + + response = self.send(request, **kwargs) + return response + + + def get_endpoint_gateway(self, + id: str, + **kwargs + ) -> DetailedResponse: + """ + Retrieve an endpoint gateway. + + This request retrieves a single endpoint gateway specified by the identifier in + the URL. + + :param str id: The endpoint gateway identifier. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `EndpointGateway` object + """ + + if id is None: + raise ValueError('id must be provided') + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='get_endpoint_gateway') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['id'] + path_param_values = self.encode_path_vars(id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/endpoint_gateways/{id}'.format(**path_param_dict) + request = self.prepare_request(method='GET', + url=url, + headers=headers, + params=params) + + response = self.send(request, **kwargs) + return response + + + def update_endpoint_gateway(self, + id: str, + endpoint_gateway_patch: 'EndpointGatewayPatch', + **kwargs + ) -> DetailedResponse: + """ + Update an endpoint gateway. + + This request updates an endpoint gateway's name. + + :param str id: The endpoint gateway identifier. + :param EndpointGatewayPatch endpoint_gateway_patch: The endpoint gateway + patch. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `EndpointGateway` object + """ + + if id is None: + raise ValueError('id must be provided') + if endpoint_gateway_patch is None: + raise ValueError('endpoint_gateway_patch must be provided') + if isinstance(endpoint_gateway_patch, EndpointGatewayPatch): + endpoint_gateway_patch = convert_model(endpoint_gateway_patch) + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='update_endpoint_gateway') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation + } + + data = json.dumps(endpoint_gateway_patch) + headers['content-type'] = 'application/merge-patch+json' + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['id'] + path_param_values = self.encode_path_vars(id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/endpoint_gateways/{id}'.format(**path_param_dict) + request = self.prepare_request(method='PATCH', + url=url, + headers=headers, + params=params, + data=data) + + response = self.send(request, **kwargs) + return response + + ######################### + # Flow log collectors + ######################### + + + def list_flow_log_collectors(self, + *, + start: str = None, + limit: int = None, + resource_group_id: str = None, + name: str = None, + vpc_id: str = None, + vpc_crn: str = None, + vpc_name: str = None, + target_id: str = None, + target_resource_type: str = None, + **kwargs + ) -> DetailedResponse: + """ + List all flow log collectors. + + This request lists all flow log collectors in the region. A flow log collector + summarizes data sent over one or more network interfaces within a VPC, depending + on the chosen target. + + :param str start: (optional) A server-provided token determining what + resource to start the page on. + :param int limit: (optional) The number of resources to return on a page. + :param str resource_group_id: (optional) Filters the collection to + resources in the resource group with the specified identifier. + :param str name: (optional) Filters the collection to resources with the + exact specified name. + :param str vpc_id: (optional) Filters the collection to resources in the + VPC with the specified identifier. + :param str vpc_crn: (optional) Filters the collection to resources in the + VPC with the specified CRN. + :param str vpc_name: (optional) Filters the collection to resources in the + VPC with the exact specified name. + :param str target_id: (optional) Filters the collection to flow log + collectors that target the specified resource. + :param str target_resource_type: (optional) Filters the collection to flow + log collectors that target the specified resource type. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `FlowLogCollectorCollection` object + """ + + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='list_flow_log_collectors') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation, + 'start': start, + 'limit': limit, + 'resource_group.id': resource_group_id, + 'name': name, + 'vpc.id': vpc_id, + 'vpc.crn': vpc_crn, + 'vpc.name': vpc_name, + 'target.id': target_id, + 'target.resource_type': target_resource_type + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + url = '/flow_log_collectors' + request = self.prepare_request(method='GET', + url=url, + headers=headers, + params=params) + + response = self.send(request, **kwargs) + return response + + + def create_flow_log_collector(self, + storage_bucket: 'LegacyCloudObjectStorageBucketIdentity', + target: 'FlowLogCollectorTargetPrototype', + *, + active: bool = None, + name: str = None, + resource_group: 'ResourceGroupIdentity' = None, + **kwargs + ) -> DetailedResponse: + """ + Create a flow log collector. + + This request creates and starts a new flow log collector from a flow log collector + prototype object. The prototype object is structured in the same way as a + retrieved flow log collector, and contains the information necessary to create and + start the new flow log collector. + + :param LegacyCloudObjectStorageBucketIdentity storage_bucket: The Cloud + Object Storage bucket where the collected flows will be logged. + The bucket must exist and an IAM service authorization must grant + `IBM Cloud Flow Logs` resources of `VPC Infrastructure Services` writer + access to the bucket. + :param FlowLogCollectorTargetPrototype target: The target this collector + will collect flow logs for. If the target is an instance, + subnet, or VPC, flow logs will not be collected for any network interfaces + within the + target that are themselves the target of a more specific flow log + collector. + :param bool active: (optional) Indicates whether this collector will be + active upon creation. + :param str name: (optional) The unique user-defined name for this flow log + collector. If unspecified, the name will be a hyphenated list of + randomly-selected words. + :param ResourceGroupIdentity resource_group: (optional) The resource group + to use. If unspecified, the account's [default resource + group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is + used. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `FlowLogCollector` object + """ + + if storage_bucket is None: + raise ValueError('storage_bucket must be provided') + if target is None: + raise ValueError('target must be provided') + storage_bucket = convert_model(storage_bucket) + target = convert_model(target) + if resource_group is not None: + resource_group = convert_model(resource_group) + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='create_flow_log_collector') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation + } + + data = { + 'storage_bucket': storage_bucket, + 'target': target, + 'active': active, + 'name': name, + 'resource_group': resource_group + } + data = {k: v for (k, v) in data.items() if v is not None} + data = json.dumps(data) + headers['content-type'] = 'application/json' + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + url = '/flow_log_collectors' + request = self.prepare_request(method='POST', + url=url, + headers=headers, + params=params, + data=data) + + response = self.send(request, **kwargs) + return response + + + def delete_flow_log_collector(self, + id: str, + **kwargs + ) -> DetailedResponse: + """ + Delete a flow log collector. + + This request stops and deletes a flow log collector. This operation cannot be + reversed. + Collected flow logs remain available within the flow log collector's Cloud Object + Storage bucket. + + :param str id: The flow log collector identifier. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse + """ + + if id is None: + raise ValueError('id must be provided') + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='delete_flow_log_collector') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + + path_param_keys = ['id'] + path_param_values = self.encode_path_vars(id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/flow_log_collectors/{id}'.format(**path_param_dict) + request = self.prepare_request(method='DELETE', + url=url, + headers=headers, + params=params) + + response = self.send(request, **kwargs) + return response + + + def get_flow_log_collector(self, + id: str, + **kwargs + ) -> DetailedResponse: + """ + Retrieve a flow log collector. + + This request retrieves a single flow log collector specified by the identifier in + the URL. + + :param str id: The flow log collector identifier. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `FlowLogCollector` object + """ + + if id is None: + raise ValueError('id must be provided') + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='get_flow_log_collector') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['id'] + path_param_values = self.encode_path_vars(id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/flow_log_collectors/{id}'.format(**path_param_dict) + request = self.prepare_request(method='GET', + url=url, + headers=headers, + params=params) + + response = self.send(request, **kwargs) + return response + + + def update_flow_log_collector(self, + id: str, + flow_log_collector_patch: 'FlowLogCollectorPatch', + **kwargs + ) -> DetailedResponse: + """ + Update a flow log collector. + + This request updates a flow log collector with the information in a provided flow + log collector patch. The flow log collector patch object is structured in the same + way as a retrieved flow log collector and contains only the information to be + updated. + + :param str id: The flow log collector identifier. + :param FlowLogCollectorPatch flow_log_collector_patch: The flow log + collector patch. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `FlowLogCollector` object + """ + + if id is None: + raise ValueError('id must be provided') + if flow_log_collector_patch is None: + raise ValueError('flow_log_collector_patch must be provided') + if isinstance(flow_log_collector_patch, FlowLogCollectorPatch): + flow_log_collector_patch = convert_model(flow_log_collector_patch) + headers = {} + sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='update_flow_log_collector') + headers.update(sdk_headers) + + params = { + 'version': self.version, + 'generation': self.generation + } + + data = json.dumps(flow_log_collector_patch) + headers['content-type'] = 'application/merge-patch+json' + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + headers['Accept'] = 'application/json' + + path_param_keys = ['id'] + path_param_values = self.encode_path_vars(id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/flow_log_collectors/{id}'.format(**path_param_dict) + request = self.prepare_request(method='PATCH', + url=url, + headers=headers, + params=params, + data=data) + + response = self.send(request, **kwargs) + return response + + +class ListSubnetReservedIpsEnums: + """ + Enums for list_subnet_reserved_ips parameters. + """ + + class Sort(str, Enum): + """ + Sorts the returned collection by the specified property name in ascending order. A + `-` may be prepended to the name to sort in descending order. For example, the + value `-created_at` sorts the collection by the `created_at` property in + descending order, and the value `name` sorts it by the `name` property in + ascending order. + """ + ADDRESS = 'address' + CREATED_AT = 'created_at' + NAME = 'name' + + +class ListImagesEnums: + """ + Enums for list_images parameters. + """ + + class Visibility(str, Enum): + """ + Filters the collection to images with the specified `visibility`. + """ + PRIVATE = 'private' + PUBLIC = 'public' + + +class ListSnapshotsEnums: + """ + Enums for list_snapshots parameters. + """ + + class Sort(str, Enum): + """ + Sorts the returned collection by the specified property name in ascending order. A + `-` may be prepended to the name to sort in descending order. For example, the + value `-created_at` sorts the collection by the `created_at` property in + descending order, and the value `name` sorts it by the `name` property in + ascending order. + """ + CREATED_AT = 'created_at' + NAME = 'name' + + +class ListFloatingIpsEnums: + """ + Enums for list_floating_ips parameters. + """ + + class Sort(str, Enum): + """ + Sorts the returned collection by the specified property name in ascending order. A + `-` may be prepended to the name to sort in descending order. For example, the + value `-created_at` sorts the collection by the `created_at` property in + descending order, and the value `name` sorts it by the `name` property in + ascending order. + """ + CREATED_AT = 'created_at' + NAME = 'name' + + +class ListNetworkAclRulesEnums: + """ + Enums for list_network_acl_rules parameters. + """ + + class Direction(str, Enum): + """ + Filters the collection to rules with the specified direction. + """ + INBOUND = 'inbound' + OUTBOUND = 'outbound' + + +class ListVpnGatewaysEnums: + """ + Enums for list_vpn_gateways parameters. + """ + + class Mode(str, Enum): + """ + Filters the collection to VPN gateways with the specified mode. + """ + POLICY = 'policy' + ROUTE = 'route' + + +class ListVpnServersEnums: + """ + Enums for list_vpn_servers parameters. + """ + + class Sort(str, Enum): + """ + Sorts the returned collection by the specified property name in ascending order. A + `-` may be prepended to the name to sort in descending order. For example, the + value `-created_at` sorts the collection by the `created_at` property in + descending order, and the value `name` sorts it by the `name` property in + ascending order. + """ + CREATED_AT = 'created_at' + NAME = 'name' + + +class ListVpnServerClientsEnums: + """ + Enums for list_vpn_server_clients parameters. + """ + + class Sort(str, Enum): + """ + Sorts the returned collection by the specified property name in ascending order. A + `-` may be prepended to the name to sort in descending order. For example, the + value `-created_at` sorts the collection by the `created_at` property in + descending order. + """ + CREATED_AT = 'created_at' + + +class ListVpnServerRoutesEnums: + """ + Enums for list_vpn_server_routes parameters. + """ + + class Sort(str, Enum): + """ + Sorts the returned collection by the specified property name in ascending order. A + `-` may be prepended to the name to sort in descending order. For example, the + value `-created_at` sorts the collection by the `created_at` property in + descending order, and the value `name` sorts it by the `name` property in + ascending order. + """ + CREATED_AT = 'created_at' + NAME = 'name' + + +class ListEndpointGatewayIpsEnums: + """ + Enums for list_endpoint_gateway_ips parameters. + """ + + class Sort(str, Enum): + """ + Sorts the returned collection by the specified property name in ascending order. A + `-` may be prepended to the name to sort in descending order. For example, the + value `-created_at` sorts the collection by the `created_at` property in + descending order, and the value `name` sorts it by the `name` property in + ascending order. + """ + ADDRESS = 'address' + CREATED_AT = 'created_at' + NAME = 'name' + + +class ListFlowLogCollectorsEnums: + """ + Enums for list_flow_log_collectors parameters. + """ + + class TargetResourceType(str, Enum): + """ + Filters the collection to flow log collectors that target the specified resource + type. + """ + INSTANCE = 'instance' + NETWORK_INTERFACE = 'network_interface' + SUBNET = 'subnet' + VPC = 'vpc' + + +############################################################################## +# Models +############################################################################## + + +class AddressPrefix(): + """ + AddressPrefix. + + :attr str cidr: The CIDR block for this prefix. + :attr datetime created_at: The date and time that the prefix was created. + :attr bool has_subnets: Indicates whether subnets exist with addresses from this + prefix. + :attr str href: The URL for this address prefix. + :attr str id: The unique identifier for this address prefix. + :attr bool is_default: Indicates whether this is the default prefix for this + zone in this VPC. If a default prefix was automatically created when the VPC was + created, the prefix is automatically named using a hyphenated list of + randomly-selected words, but may be updated with a user-specified name. + :attr str name: The user-defined name for this address prefix. Names must be + unique within the VPC the address prefix resides in. + :attr ZoneReference zone: The zone this address prefix resides in. + """ + + def __init__(self, + cidr: str, + created_at: datetime, + has_subnets: bool, + href: str, + id: str, + is_default: bool, + name: str, + zone: 'ZoneReference') -> None: + """ + Initialize a AddressPrefix object. + + :param str cidr: The CIDR block for this prefix. + :param datetime created_at: The date and time that the prefix was created. + :param bool has_subnets: Indicates whether subnets exist with addresses + from this prefix. + :param str href: The URL for this address prefix. + :param str id: The unique identifier for this address prefix. + :param bool is_default: Indicates whether this is the default prefix for + this zone in this VPC. If a default prefix was automatically created when + the VPC was created, the prefix is automatically named using a hyphenated + list of randomly-selected words, but may be updated with a user-specified + name. + :param str name: The user-defined name for this address prefix. Names must + be unique within the VPC the address prefix resides in. + :param ZoneReference zone: The zone this address prefix resides in. + """ + self.cidr = cidr + self.created_at = created_at + self.has_subnets = has_subnets + self.href = href + self.id = id + self.is_default = is_default + self.name = name + self.zone = zone + + @classmethod + def from_dict(cls, _dict: Dict) -> 'AddressPrefix': + """Initialize a AddressPrefix object from a json dictionary.""" + args = {} + if 'cidr' in _dict: + args['cidr'] = _dict.get('cidr') + else: + raise ValueError('Required property \'cidr\' not present in AddressPrefix JSON') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) + else: + raise ValueError('Required property \'created_at\' not present in AddressPrefix JSON') + if 'has_subnets' in _dict: + args['has_subnets'] = _dict.get('has_subnets') + else: + raise ValueError('Required property \'has_subnets\' not present in AddressPrefix JSON') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in AddressPrefix JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in AddressPrefix JSON') + if 'is_default' in _dict: + args['is_default'] = _dict.get('is_default') + else: + raise ValueError('Required property \'is_default\' not present in AddressPrefix JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in AddressPrefix JSON') + if 'zone' in _dict: + args['zone'] = ZoneReference.from_dict(_dict.get('zone')) + else: + raise ValueError('Required property \'zone\' not present in AddressPrefix JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a AddressPrefix object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'cidr') and self.cidr is not None: + _dict['cidr'] = self.cidr + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'has_subnets') and self.has_subnets is not None: + _dict['has_subnets'] = self.has_subnets + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'is_default') and self.is_default is not None: + _dict['is_default'] = self.is_default + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'zone') and self.zone is not None: + _dict['zone'] = self.zone.to_dict() + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this AddressPrefix object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'AddressPrefix') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'AddressPrefix') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class AddressPrefixCollection(): + """ + AddressPrefixCollection. + + :attr List[AddressPrefix] address_prefixes: Collection of address prefixes. + :attr AddressPrefixCollectionFirst first: A link to the first page of resources. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr AddressPrefixCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages + except the last page. + :attr int total_count: The total number of resources across all pages. + """ + + def __init__(self, + address_prefixes: List['AddressPrefix'], + first: 'AddressPrefixCollectionFirst', + limit: int, + total_count: int, + *, + next: 'AddressPrefixCollectionNext' = None) -> None: + """ + Initialize a AddressPrefixCollection object. + + :param List[AddressPrefix] address_prefixes: Collection of address + prefixes. + :param AddressPrefixCollectionFirst first: A link to the first page of + resources. + :param int limit: The maximum number of resources that can be returned by + the request. + :param int total_count: The total number of resources across all pages. + :param AddressPrefixCollectionNext next: (optional) A link to the next page + of resources. This property is present for all pages + except the last page. + """ + self.address_prefixes = address_prefixes + self.first = first + self.limit = limit + self.next = next + self.total_count = total_count + + @classmethod + def from_dict(cls, _dict: Dict) -> 'AddressPrefixCollection': + """Initialize a AddressPrefixCollection object from a json dictionary.""" + args = {} + if 'address_prefixes' in _dict: + args['address_prefixes'] = [AddressPrefix.from_dict(x) for x in _dict.get('address_prefixes')] + else: + raise ValueError('Required property \'address_prefixes\' not present in AddressPrefixCollection JSON') + if 'first' in _dict: + args['first'] = AddressPrefixCollectionFirst.from_dict(_dict.get('first')) + else: + raise ValueError('Required property \'first\' not present in AddressPrefixCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') + else: + raise ValueError('Required property \'limit\' not present in AddressPrefixCollection JSON') + if 'next' in _dict: + args['next'] = AddressPrefixCollectionNext.from_dict(_dict.get('next')) + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') + else: + raise ValueError('Required property \'total_count\' not present in AddressPrefixCollection JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a AddressPrefixCollection object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'address_prefixes') and self.address_prefixes is not None: + _dict['address_prefixes'] = [x.to_dict() for x in self.address_prefixes] + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this AddressPrefixCollection object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'AddressPrefixCollection') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'AddressPrefixCollection') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class AddressPrefixCollectionFirst(): + """ + A link to the first page of resources. + + :attr str href: The URL for a page of resources. + """ + + def __init__(self, + href: str) -> None: + """ + Initialize a AddressPrefixCollectionFirst object. + + :param str href: The URL for a page of resources. + """ + self.href = href + + @classmethod + def from_dict(cls, _dict: Dict) -> 'AddressPrefixCollectionFirst': + """Initialize a AddressPrefixCollectionFirst object from a json dictionary.""" + args = {} + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in AddressPrefixCollectionFirst JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a AddressPrefixCollectionFirst object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this AddressPrefixCollectionFirst object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'AddressPrefixCollectionFirst') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'AddressPrefixCollectionFirst') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class AddressPrefixCollectionNext(): + """ + A link to the next page of resources. This property is present for all pages except + the last page. + + :attr str href: The URL for a page of resources. + """ + + def __init__(self, + href: str) -> None: + """ + Initialize a AddressPrefixCollectionNext object. + + :param str href: The URL for a page of resources. + """ + self.href = href + + @classmethod + def from_dict(cls, _dict: Dict) -> 'AddressPrefixCollectionNext': + """Initialize a AddressPrefixCollectionNext object from a json dictionary.""" + args = {} + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in AddressPrefixCollectionNext JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a AddressPrefixCollectionNext object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this AddressPrefixCollectionNext object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'AddressPrefixCollectionNext') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'AddressPrefixCollectionNext') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class AddressPrefixPatch(): + """ + AddressPrefixPatch. + + :attr bool is_default: (optional) Indicates whether this is the default prefix + for this zone in this VPC. Updating to true makes this prefix the default prefix + for this zone in this VPC, provided the VPC currently has no default address + prefix for this zone. Updating to false removes the default prefix for this zone + in this VPC. + :attr str name: (optional) The user-defined name for this address prefix. Names + must be unique within the VPC the address prefix resides in. + """ + + def __init__(self, + *, + is_default: bool = None, + name: str = None) -> None: + """ + Initialize a AddressPrefixPatch object. + + :param bool is_default: (optional) Indicates whether this is the default + prefix for this zone in this VPC. Updating to true makes this prefix the + default prefix for this zone in this VPC, provided the VPC currently has no + default address prefix for this zone. Updating to false removes the default + prefix for this zone in this VPC. + :param str name: (optional) The user-defined name for this address prefix. + Names must be unique within the VPC the address prefix resides in. + """ + self.is_default = is_default + self.name = name + + @classmethod + def from_dict(cls, _dict: Dict) -> 'AddressPrefixPatch': + """Initialize a AddressPrefixPatch object from a json dictionary.""" + args = {} + if 'is_default' in _dict: + args['is_default'] = _dict.get('is_default') + if 'name' in _dict: + args['name'] = _dict.get('name') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a AddressPrefixPatch object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'is_default') and self.is_default is not None: + _dict['is_default'] = self.is_default + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this AddressPrefixPatch object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'AddressPrefixPatch') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'AddressPrefixPatch') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class BackupPolicy(): + """ + BackupPolicy. + + :attr datetime created_at: The date and time that the backup policy was created. + :attr str crn: The CRN for this backup policy. + :attr str href: The URL for this backup policy. + :attr str id: The unique identifier for this backup policy. + :attr datetime last_job_completed_at: (optional) The date and time that the most + recent job for this backup policy completed. + If absent, no job has yet completed for this backup policy. + :attr str lifecycle_state: The lifecycle state of the backup policy. + :attr List[str] match_resource_types: A resource type this backup policy applies + to. Resources that have both a matching type and a matching user tag will be + subject to the backup policy. + The enumerated values for this property will expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the backup policy on which the + unexpected property value was encountered. + :attr List[str] match_user_tags: The user tags this backup policy applies to. + Resources that have both a matching user tag and a matching type will be subject + to the backup policy. + :attr str name: The unique user-defined name for this backup policy. + :attr List[BackupPolicyPlanReference] plans: The plans for the backup policy. + :attr ResourceGroupReference resource_group: The resource group for this backup + policy. + :attr str resource_type: The resource type. + """ + + def __init__(self, + created_at: datetime, + crn: str, + href: str, + id: str, + lifecycle_state: str, + match_resource_types: List[str], + match_user_tags: List[str], + name: str, + plans: List['BackupPolicyPlanReference'], + resource_group: 'ResourceGroupReference', + resource_type: str, + *, + last_job_completed_at: datetime = None) -> None: + """ + Initialize a BackupPolicy object. + + :param datetime created_at: The date and time that the backup policy was + created. + :param str crn: The CRN for this backup policy. + :param str href: The URL for this backup policy. + :param str id: The unique identifier for this backup policy. + :param str lifecycle_state: The lifecycle state of the backup policy. + :param List[str] match_resource_types: A resource type this backup policy + applies to. Resources that have both a matching type and a matching user + tag will be subject to the backup policy. + The enumerated values for this property will expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the backup policy on which the + unexpected property value was encountered. + :param List[str] match_user_tags: The user tags this backup policy applies + to. Resources that have both a matching user tag and a matching type will + be subject to the backup policy. + :param str name: The unique user-defined name for this backup policy. + :param List[BackupPolicyPlanReference] plans: The plans for the backup + policy. + :param ResourceGroupReference resource_group: The resource group for this + backup policy. + :param str resource_type: The resource type. + :param datetime last_job_completed_at: (optional) The date and time that + the most recent job for this backup policy completed. + If absent, no job has yet completed for this backup policy. + """ + self.created_at = created_at + self.crn = crn + self.href = href + self.id = id + self.last_job_completed_at = last_job_completed_at + self.lifecycle_state = lifecycle_state + self.match_resource_types = match_resource_types + self.match_user_tags = match_user_tags + self.name = name + self.plans = plans + self.resource_group = resource_group + self.resource_type = resource_type + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BackupPolicy': + """Initialize a BackupPolicy object from a json dictionary.""" + args = {} + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) + else: + raise ValueError('Required property \'created_at\' not present in BackupPolicy JSON') + if 'crn' in _dict: + args['crn'] = _dict.get('crn') + else: + raise ValueError('Required property \'crn\' not present in BackupPolicy JSON') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in BackupPolicy JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in BackupPolicy JSON') + if 'last_job_completed_at' in _dict: + args['last_job_completed_at'] = string_to_datetime(_dict.get('last_job_completed_at')) + if 'lifecycle_state' in _dict: + args['lifecycle_state'] = _dict.get('lifecycle_state') + else: + raise ValueError('Required property \'lifecycle_state\' not present in BackupPolicy JSON') + if 'match_resource_types' in _dict: + args['match_resource_types'] = _dict.get('match_resource_types') + else: + raise ValueError('Required property \'match_resource_types\' not present in BackupPolicy JSON') + if 'match_user_tags' in _dict: + args['match_user_tags'] = _dict.get('match_user_tags') + else: + raise ValueError('Required property \'match_user_tags\' not present in BackupPolicy JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in BackupPolicy JSON') + if 'plans' in _dict: + args['plans'] = [BackupPolicyPlanReference.from_dict(x) for x in _dict.get('plans')] + else: + raise ValueError('Required property \'plans\' not present in BackupPolicy JSON') + if 'resource_group' in _dict: + args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) + else: + raise ValueError('Required property \'resource_group\' not present in BackupPolicy JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in BackupPolicy JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a BackupPolicy object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'last_job_completed_at') and self.last_job_completed_at is not None: + _dict['last_job_completed_at'] = datetime_to_string(self.last_job_completed_at) + if hasattr(self, 'lifecycle_state') and self.lifecycle_state is not None: + _dict['lifecycle_state'] = self.lifecycle_state + if hasattr(self, 'match_resource_types') and self.match_resource_types is not None: + _dict['match_resource_types'] = self.match_resource_types + if hasattr(self, 'match_user_tags') and self.match_user_tags is not None: + _dict['match_user_tags'] = self.match_user_tags + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'plans') and self.plans is not None: + _dict['plans'] = [x.to_dict() for x in self.plans] + if hasattr(self, 'resource_group') and self.resource_group is not None: + _dict['resource_group'] = self.resource_group.to_dict() + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BackupPolicy object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BackupPolicy') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BackupPolicy') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class LifecycleStateEnum(str, Enum): + """ + The lifecycle state of the backup policy. + """ + DELETING = 'deleting' + FAILED = 'failed' + PENDING = 'pending' + STABLE = 'stable' + SUSPENDED = 'suspended' + UPDATING = 'updating' + WAITING = 'waiting' + + + class MatchResourceTypesEnum(str, Enum): + """ + The resource type. + """ + VOLUME = 'volume' + + + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + BACKUP_POLICY = 'backup_policy' + + +class BackupPolicyCollection(): + """ + BackupPolicyCollection. + + :attr List[BackupPolicy] backup_policies: Collection of backup policies. + :attr BackupPolicyCollectionFirst first: A link to the first page of resources. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr BackupPolicyCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages + except the last page. + :attr int total_count: The total number of resources across all pages. + """ + + def __init__(self, + backup_policies: List['BackupPolicy'], + first: 'BackupPolicyCollectionFirst', + limit: int, + total_count: int, + *, + next: 'BackupPolicyCollectionNext' = None) -> None: + """ + Initialize a BackupPolicyCollection object. + + :param List[BackupPolicy] backup_policies: Collection of backup policies. + :param BackupPolicyCollectionFirst first: A link to the first page of + resources. + :param int limit: The maximum number of resources that can be returned by + the request. + :param int total_count: The total number of resources across all pages. + :param BackupPolicyCollectionNext next: (optional) A link to the next page + of resources. This property is present for all pages + except the last page. + """ + self.backup_policies = backup_policies + self.first = first + self.limit = limit + self.next = next + self.total_count = total_count + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BackupPolicyCollection': + """Initialize a BackupPolicyCollection object from a json dictionary.""" + args = {} + if 'backup_policies' in _dict: + args['backup_policies'] = [BackupPolicy.from_dict(x) for x in _dict.get('backup_policies')] + else: + raise ValueError('Required property \'backup_policies\' not present in BackupPolicyCollection JSON') + if 'first' in _dict: + args['first'] = BackupPolicyCollectionFirst.from_dict(_dict.get('first')) + else: + raise ValueError('Required property \'first\' not present in BackupPolicyCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') + else: + raise ValueError('Required property \'limit\' not present in BackupPolicyCollection JSON') + if 'next' in _dict: + args['next'] = BackupPolicyCollectionNext.from_dict(_dict.get('next')) + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') + else: + raise ValueError('Required property \'total_count\' not present in BackupPolicyCollection JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a BackupPolicyCollection object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'backup_policies') and self.backup_policies is not None: + _dict['backup_policies'] = [x.to_dict() for x in self.backup_policies] + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BackupPolicyCollection object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BackupPolicyCollection') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BackupPolicyCollection') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class BackupPolicyCollectionFirst(): + """ + A link to the first page of resources. + + :attr str href: The URL for a page of resources. + """ + + def __init__(self, + href: str) -> None: + """ + Initialize a BackupPolicyCollectionFirst object. + + :param str href: The URL for a page of resources. + """ + self.href = href + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BackupPolicyCollectionFirst': + """Initialize a BackupPolicyCollectionFirst object from a json dictionary.""" + args = {} + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in BackupPolicyCollectionFirst JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a BackupPolicyCollectionFirst object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BackupPolicyCollectionFirst object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BackupPolicyCollectionFirst') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BackupPolicyCollectionFirst') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class BackupPolicyCollectionNext(): + """ + A link to the next page of resources. This property is present for all pages except + the last page. + + :attr str href: The URL for a page of resources. + """ + + def __init__(self, + href: str) -> None: + """ + Initialize a BackupPolicyCollectionNext object. + + :param str href: The URL for a page of resources. + """ + self.href = href + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BackupPolicyCollectionNext': + """Initialize a BackupPolicyCollectionNext object from a json dictionary.""" + args = {} + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in BackupPolicyCollectionNext JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a BackupPolicyCollectionNext object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BackupPolicyCollectionNext object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BackupPolicyCollectionNext') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BackupPolicyCollectionNext') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class BackupPolicyPatch(): + """ + BackupPolicyPatch. + + :attr List[str] match_user_tags: (optional) The user tags this backup policy + applies to (replacing any existing tags). Resources that have both a matching + user tag and a matching type will be subject to the backup policy. + :attr str name: (optional) The user-defined name for this backup policy. Names + must be unique within the region this backup policy resides in. + """ + + def __init__(self, + *, + match_user_tags: List[str] = None, + name: str = None) -> None: + """ + Initialize a BackupPolicyPatch object. + + :param List[str] match_user_tags: (optional) The user tags this backup + policy applies to (replacing any existing tags). Resources that have both a + matching user tag and a matching type will be subject to the backup policy. + :param str name: (optional) The user-defined name for this backup policy. + Names must be unique within the region this backup policy resides in. + """ + self.match_user_tags = match_user_tags + self.name = name + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BackupPolicyPatch': + """Initialize a BackupPolicyPatch object from a json dictionary.""" + args = {} + if 'match_user_tags' in _dict: + args['match_user_tags'] = _dict.get('match_user_tags') + if 'name' in _dict: + args['name'] = _dict.get('name') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a BackupPolicyPatch object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'match_user_tags') and self.match_user_tags is not None: + _dict['match_user_tags'] = self.match_user_tags + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BackupPolicyPatch object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BackupPolicyPatch') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BackupPolicyPatch') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class BackupPolicyPlan(): + """ + BackupPolicyPlan. + + :attr bool active: Indicates whether the plan is active. + :attr List[str] attach_user_tags: The user tags to attach to backups (snapshots) + created by this plan. + :attr bool copy_user_tags: Indicates whether to copy the source's user tags to + the created backups (snapshots). + :attr datetime created_at: The date and time that the backup policy plan was + created. + :attr str cron_spec: The cron specification for the backup schedule. The backup + policy jobs + (which create and delete backups for this plan) will not start until this time, + and may start for up to 90 minutes after this time. + All backup schedules for plans in the same policy must be at least an hour + apart. + :attr BackupPolicyPlanDeletionTrigger deletion_trigger: + :attr str href: The URL for this backup policy plan. + :attr str id: The unique identifier for this backup policy plan. + :attr str lifecycle_state: The lifecycle state of this backup policy plan. + :attr str name: The unique user-defined name for this backup policy plan. + :attr str resource_type: The resource type. + """ + + def __init__(self, + active: bool, + attach_user_tags: List[str], + copy_user_tags: bool, + created_at: datetime, + cron_spec: str, + deletion_trigger: 'BackupPolicyPlanDeletionTrigger', + href: str, + id: str, + lifecycle_state: str, + name: str, + resource_type: str) -> None: + """ + Initialize a BackupPolicyPlan object. + + :param bool active: Indicates whether the plan is active. + :param List[str] attach_user_tags: The user tags to attach to backups + (snapshots) created by this plan. + :param bool copy_user_tags: Indicates whether to copy the source's user + tags to the created backups (snapshots). + :param datetime created_at: The date and time that the backup policy plan + was created. + :param str cron_spec: The cron specification for the backup schedule. The + backup policy jobs + (which create and delete backups for this plan) will not start until this + time, and may start for up to 90 minutes after this time. + All backup schedules for plans in the same policy must be at least an hour + apart. + :param BackupPolicyPlanDeletionTrigger deletion_trigger: + :param str href: The URL for this backup policy plan. + :param str id: The unique identifier for this backup policy plan. + :param str lifecycle_state: The lifecycle state of this backup policy plan. + :param str name: The unique user-defined name for this backup policy plan. + :param str resource_type: The resource type. + """ + self.active = active + self.attach_user_tags = attach_user_tags + self.copy_user_tags = copy_user_tags + self.created_at = created_at + self.cron_spec = cron_spec + self.deletion_trigger = deletion_trigger + self.href = href + self.id = id + self.lifecycle_state = lifecycle_state + self.name = name + self.resource_type = resource_type + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BackupPolicyPlan': + """Initialize a BackupPolicyPlan object from a json dictionary.""" + args = {} + if 'active' in _dict: + args['active'] = _dict.get('active') + else: + raise ValueError('Required property \'active\' not present in BackupPolicyPlan JSON') + if 'attach_user_tags' in _dict: + args['attach_user_tags'] = _dict.get('attach_user_tags') + else: + raise ValueError('Required property \'attach_user_tags\' not present in BackupPolicyPlan JSON') + if 'copy_user_tags' in _dict: + args['copy_user_tags'] = _dict.get('copy_user_tags') + else: + raise ValueError('Required property \'copy_user_tags\' not present in BackupPolicyPlan JSON') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) + else: + raise ValueError('Required property \'created_at\' not present in BackupPolicyPlan JSON') + if 'cron_spec' in _dict: + args['cron_spec'] = _dict.get('cron_spec') + else: + raise ValueError('Required property \'cron_spec\' not present in BackupPolicyPlan JSON') + if 'deletion_trigger' in _dict: + args['deletion_trigger'] = BackupPolicyPlanDeletionTrigger.from_dict(_dict.get('deletion_trigger')) + else: + raise ValueError('Required property \'deletion_trigger\' not present in BackupPolicyPlan JSON') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in BackupPolicyPlan JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in BackupPolicyPlan JSON') + if 'lifecycle_state' in _dict: + args['lifecycle_state'] = _dict.get('lifecycle_state') + else: + raise ValueError('Required property \'lifecycle_state\' not present in BackupPolicyPlan JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in BackupPolicyPlan JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in BackupPolicyPlan JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a BackupPolicyPlan object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'active') and self.active is not None: + _dict['active'] = self.active + if hasattr(self, 'attach_user_tags') and self.attach_user_tags is not None: + _dict['attach_user_tags'] = self.attach_user_tags + if hasattr(self, 'copy_user_tags') and self.copy_user_tags is not None: + _dict['copy_user_tags'] = self.copy_user_tags + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'cron_spec') and self.cron_spec is not None: + _dict['cron_spec'] = self.cron_spec + if hasattr(self, 'deletion_trigger') and self.deletion_trigger is not None: + _dict['deletion_trigger'] = self.deletion_trigger.to_dict() + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'lifecycle_state') and self.lifecycle_state is not None: + _dict['lifecycle_state'] = self.lifecycle_state + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BackupPolicyPlan object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BackupPolicyPlan') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BackupPolicyPlan') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class LifecycleStateEnum(str, Enum): + """ + The lifecycle state of this backup policy plan. + """ + DELETING = 'deleting' + FAILED = 'failed' + PENDING = 'pending' + STABLE = 'stable' + SUSPENDED = 'suspended' + UPDATING = 'updating' + WAITING = 'waiting' + + + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + BACKUP_POLICY_PLAN = 'backup_policy_plan' + + +class BackupPolicyPlanCollection(): + """ + BackupPolicyPlanCollection. + + :attr List[BackupPolicyPlan] plans: Collection of backup policy plans. + """ + + def __init__(self, + plans: List['BackupPolicyPlan']) -> None: + """ + Initialize a BackupPolicyPlanCollection object. + + :param List[BackupPolicyPlan] plans: Collection of backup policy plans. + """ + self.plans = plans + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BackupPolicyPlanCollection': + """Initialize a BackupPolicyPlanCollection object from a json dictionary.""" + args = {} + if 'plans' in _dict: + args['plans'] = [BackupPolicyPlan.from_dict(x) for x in _dict.get('plans')] + else: + raise ValueError('Required property \'plans\' not present in BackupPolicyPlanCollection JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a BackupPolicyPlanCollection object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'plans') and self.plans is not None: + _dict['plans'] = [x.to_dict() for x in self.plans] + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BackupPolicyPlanCollection object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BackupPolicyPlanCollection') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BackupPolicyPlanCollection') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class BackupPolicyPlanDeletionTrigger(): + """ + BackupPolicyPlanDeletionTrigger. + + :attr int delete_after: The maximum number of days to keep each backup after + creation. + :attr int delete_over_count: (optional) The maximum number of recent backups to + keep. If absent, there is no maximum. + """ + + def __init__(self, + delete_after: int, + *, + delete_over_count: int = None) -> None: + """ + Initialize a BackupPolicyPlanDeletionTrigger object. + + :param int delete_after: The maximum number of days to keep each backup + after creation. + :param int delete_over_count: (optional) The maximum number of recent + backups to keep. If absent, there is no maximum. + """ + self.delete_after = delete_after + self.delete_over_count = delete_over_count + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BackupPolicyPlanDeletionTrigger': + """Initialize a BackupPolicyPlanDeletionTrigger object from a json dictionary.""" + args = {} + if 'delete_after' in _dict: + args['delete_after'] = _dict.get('delete_after') + else: + raise ValueError('Required property \'delete_after\' not present in BackupPolicyPlanDeletionTrigger JSON') + if 'delete_over_count' in _dict: + args['delete_over_count'] = _dict.get('delete_over_count') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a BackupPolicyPlanDeletionTrigger object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'delete_after') and self.delete_after is not None: + _dict['delete_after'] = self.delete_after + if hasattr(self, 'delete_over_count') and self.delete_over_count is not None: + _dict['delete_over_count'] = self.delete_over_count + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BackupPolicyPlanDeletionTrigger object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BackupPolicyPlanDeletionTrigger') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BackupPolicyPlanDeletionTrigger') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class BackupPolicyPlanDeletionTriggerPatch(): + """ + BackupPolicyPlanDeletionTriggerPatch. + + :attr int delete_after: (optional) The maximum number of days to keep each + backup after creation. + :attr int delete_over_count: (optional) The maximum number of recent backups to + keep. Specify `null` to remove any existing maximum. + """ + + def __init__(self, + *, + delete_after: int = None, + delete_over_count: int = None) -> None: + """ + Initialize a BackupPolicyPlanDeletionTriggerPatch object. + + :param int delete_after: (optional) The maximum number of days to keep each + backup after creation. + :param int delete_over_count: (optional) The maximum number of recent + backups to keep. Specify `null` to remove any existing maximum. + """ + self.delete_after = delete_after + self.delete_over_count = delete_over_count + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BackupPolicyPlanDeletionTriggerPatch': + """Initialize a BackupPolicyPlanDeletionTriggerPatch object from a json dictionary.""" + args = {} + if 'delete_after' in _dict: + args['delete_after'] = _dict.get('delete_after') + if 'delete_over_count' in _dict: + args['delete_over_count'] = _dict.get('delete_over_count') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a BackupPolicyPlanDeletionTriggerPatch object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'delete_after') and self.delete_after is not None: + _dict['delete_after'] = self.delete_after + if hasattr(self, 'delete_over_count') and self.delete_over_count is not None: + _dict['delete_over_count'] = self.delete_over_count + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BackupPolicyPlanDeletionTriggerPatch object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BackupPolicyPlanDeletionTriggerPatch') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BackupPolicyPlanDeletionTriggerPatch') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class BackupPolicyPlanDeletionTriggerPrototype(): + """ + BackupPolicyPlanDeletionTriggerPrototype. + + :attr int delete_after: (optional) The maximum number of days to keep each + backup after creation. + :attr int delete_over_count: (optional) The maximum number of recent backups to + keep. If unspecified, there will be no maximum. + """ + + def __init__(self, + *, + delete_after: int = None, + delete_over_count: int = None) -> None: + """ + Initialize a BackupPolicyPlanDeletionTriggerPrototype object. + + :param int delete_after: (optional) The maximum number of days to keep each + backup after creation. + :param int delete_over_count: (optional) The maximum number of recent + backups to keep. If unspecified, there will be no maximum. + """ + self.delete_after = delete_after + self.delete_over_count = delete_over_count + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BackupPolicyPlanDeletionTriggerPrototype': + """Initialize a BackupPolicyPlanDeletionTriggerPrototype object from a json dictionary.""" + args = {} + if 'delete_after' in _dict: + args['delete_after'] = _dict.get('delete_after') + if 'delete_over_count' in _dict: + args['delete_over_count'] = _dict.get('delete_over_count') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a BackupPolicyPlanDeletionTriggerPrototype object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'delete_after') and self.delete_after is not None: + _dict['delete_after'] = self.delete_after + if hasattr(self, 'delete_over_count') and self.delete_over_count is not None: + _dict['delete_over_count'] = self.delete_over_count + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BackupPolicyPlanDeletionTriggerPrototype object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BackupPolicyPlanDeletionTriggerPrototype') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BackupPolicyPlanDeletionTriggerPrototype') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class BackupPolicyPlanPatch(): + """ + BackupPolicyPlanPatch. + + :attr bool active: (optional) Indicates whether the plan is active. + :attr List[str] attach_user_tags: (optional) The user tags to attach to backups + (snapshots) created by this plan. Updating this value does not change the user + tags for backups that have already been created by this plan. + :attr bool copy_user_tags: (optional) Indicates whether to copy the source's + user tags to the created backups (snapshots). + :attr str cron_spec: (optional) The cron specification for the backup schedule. + The backup policy jobs + (which create and delete backups for this plan) will not start until this time, + and may start for up to 90 minutes after this time. + All backup schedules for plans in the same policy must be at least an hour + apart. + :attr BackupPolicyPlanDeletionTriggerPatch deletion_trigger: (optional) + :attr str name: (optional) The user-defined name for this backup policy plan. + Names must be unique within the backup policy this plan resides in. + """ + + def __init__(self, + *, + active: bool = None, + attach_user_tags: List[str] = None, + copy_user_tags: bool = None, + cron_spec: str = None, + deletion_trigger: 'BackupPolicyPlanDeletionTriggerPatch' = None, + name: str = None) -> None: + """ + Initialize a BackupPolicyPlanPatch object. + + :param bool active: (optional) Indicates whether the plan is active. + :param List[str] attach_user_tags: (optional) The user tags to attach to + backups (snapshots) created by this plan. Updating this value does not + change the user tags for backups that have already been created by this + plan. + :param bool copy_user_tags: (optional) Indicates whether to copy the + source's user tags to the created backups (snapshots). + :param str cron_spec: (optional) The cron specification for the backup + schedule. The backup policy jobs + (which create and delete backups for this plan) will not start until this + time, and may start for up to 90 minutes after this time. + All backup schedules for plans in the same policy must be at least an hour + apart. + :param BackupPolicyPlanDeletionTriggerPatch deletion_trigger: (optional) + :param str name: (optional) The user-defined name for this backup policy + plan. Names must be unique within the backup policy this plan resides in. + """ + self.active = active + self.attach_user_tags = attach_user_tags + self.copy_user_tags = copy_user_tags + self.cron_spec = cron_spec + self.deletion_trigger = deletion_trigger + self.name = name + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BackupPolicyPlanPatch': + """Initialize a BackupPolicyPlanPatch object from a json dictionary.""" + args = {} + if 'active' in _dict: + args['active'] = _dict.get('active') + if 'attach_user_tags' in _dict: + args['attach_user_tags'] = _dict.get('attach_user_tags') + if 'copy_user_tags' in _dict: + args['copy_user_tags'] = _dict.get('copy_user_tags') + if 'cron_spec' in _dict: + args['cron_spec'] = _dict.get('cron_spec') + if 'deletion_trigger' in _dict: + args['deletion_trigger'] = BackupPolicyPlanDeletionTriggerPatch.from_dict(_dict.get('deletion_trigger')) + if 'name' in _dict: + args['name'] = _dict.get('name') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a BackupPolicyPlanPatch object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'active') and self.active is not None: + _dict['active'] = self.active + if hasattr(self, 'attach_user_tags') and self.attach_user_tags is not None: + _dict['attach_user_tags'] = self.attach_user_tags + if hasattr(self, 'copy_user_tags') and self.copy_user_tags is not None: + _dict['copy_user_tags'] = self.copy_user_tags + if hasattr(self, 'cron_spec') and self.cron_spec is not None: + _dict['cron_spec'] = self.cron_spec + if hasattr(self, 'deletion_trigger') and self.deletion_trigger is not None: + _dict['deletion_trigger'] = self.deletion_trigger.to_dict() + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BackupPolicyPlanPatch object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BackupPolicyPlanPatch') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BackupPolicyPlanPatch') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class BackupPolicyPlanPrototype(): + """ + BackupPolicyPlanPrototype. + + :attr bool active: (optional) Indicates whether the plan is active. + :attr List[str] attach_user_tags: (optional) User tags to attach to each backup + (snapshot) created by this plan. If unspecified, no user tags will be attached. + :attr bool copy_user_tags: (optional) Indicates whether to copy the source's + user tags to the created backups (snapshots). + :attr str cron_spec: The cron specification for the backup schedule. The backup + policy jobs + (which create and delete backups for this plan) will not start until this time, + and may start for up to 90 minutes after this time. + All backup schedules for plans in the same policy must be at least an hour + apart. + :attr BackupPolicyPlanDeletionTriggerPrototype deletion_trigger: (optional) + :attr str name: (optional) The user-defined name for this backup policy plan. + Names must be unique within the backup policy this plan resides in. If + unspecified, the name will be a hyphenated list of randomly-selected words. + """ + + def __init__(self, + cron_spec: str, + *, + active: bool = None, + attach_user_tags: List[str] = None, + copy_user_tags: bool = None, + deletion_trigger: 'BackupPolicyPlanDeletionTriggerPrototype' = None, + name: str = None) -> None: + """ + Initialize a BackupPolicyPlanPrototype object. + + :param str cron_spec: The cron specification for the backup schedule. The + backup policy jobs + (which create and delete backups for this plan) will not start until this + time, and may start for up to 90 minutes after this time. + All backup schedules for plans in the same policy must be at least an hour + apart. + :param bool active: (optional) Indicates whether the plan is active. + :param List[str] attach_user_tags: (optional) User tags to attach to each + backup (snapshot) created by this plan. If unspecified, no user tags will + be attached. + :param bool copy_user_tags: (optional) Indicates whether to copy the + source's user tags to the created backups (snapshots). + :param BackupPolicyPlanDeletionTriggerPrototype deletion_trigger: + (optional) + :param str name: (optional) The user-defined name for this backup policy + plan. Names must be unique within the backup policy this plan resides in. + If unspecified, the name will be a hyphenated list of randomly-selected + words. + """ + self.active = active + self.attach_user_tags = attach_user_tags + self.copy_user_tags = copy_user_tags + self.cron_spec = cron_spec + self.deletion_trigger = deletion_trigger + self.name = name + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BackupPolicyPlanPrototype': + """Initialize a BackupPolicyPlanPrototype object from a json dictionary.""" + args = {} + if 'active' in _dict: + args['active'] = _dict.get('active') + if 'attach_user_tags' in _dict: + args['attach_user_tags'] = _dict.get('attach_user_tags') + if 'copy_user_tags' in _dict: + args['copy_user_tags'] = _dict.get('copy_user_tags') + if 'cron_spec' in _dict: + args['cron_spec'] = _dict.get('cron_spec') + else: + raise ValueError('Required property \'cron_spec\' not present in BackupPolicyPlanPrototype JSON') + if 'deletion_trigger' in _dict: + args['deletion_trigger'] = BackupPolicyPlanDeletionTriggerPrototype.from_dict(_dict.get('deletion_trigger')) + if 'name' in _dict: + args['name'] = _dict.get('name') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a BackupPolicyPlanPrototype object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'active') and self.active is not None: + _dict['active'] = self.active + if hasattr(self, 'attach_user_tags') and self.attach_user_tags is not None: + _dict['attach_user_tags'] = self.attach_user_tags + if hasattr(self, 'copy_user_tags') and self.copy_user_tags is not None: + _dict['copy_user_tags'] = self.copy_user_tags + if hasattr(self, 'cron_spec') and self.cron_spec is not None: + _dict['cron_spec'] = self.cron_spec + if hasattr(self, 'deletion_trigger') and self.deletion_trigger is not None: + _dict['deletion_trigger'] = self.deletion_trigger.to_dict() + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BackupPolicyPlanPrototype object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BackupPolicyPlanPrototype') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BackupPolicyPlanPrototype') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class BackupPolicyPlanReference(): + """ + BackupPolicyPlanReference. + + :attr BackupPolicyPlanReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str href: The URL for this backup policy plan. + :attr str id: The unique identifier for this backup policy plan. + :attr str name: The unique user-defined name for this backup policy plan. + :attr str resource_type: The resource type. + """ + + def __init__(self, + href: str, + id: str, + name: str, + resource_type: str, + *, + deleted: 'BackupPolicyPlanReferenceDeleted' = None) -> None: + """ + Initialize a BackupPolicyPlanReference object. + + :param str href: The URL for this backup policy plan. + :param str id: The unique identifier for this backup policy plan. + :param str name: The unique user-defined name for this backup policy plan. + :param str resource_type: The resource type. + :param BackupPolicyPlanReferenceDeleted deleted: (optional) If present, + this property indicates the referenced resource has been deleted and + provides + some supplementary information. + """ + self.deleted = deleted + self.href = href + self.id = id + self.name = name + self.resource_type = resource_type + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BackupPolicyPlanReference': + """Initialize a BackupPolicyPlanReference object from a json dictionary.""" + args = {} + if 'deleted' in _dict: + args['deleted'] = BackupPolicyPlanReferenceDeleted.from_dict(_dict.get('deleted')) + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in BackupPolicyPlanReference JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in BackupPolicyPlanReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in BackupPolicyPlanReference JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in BackupPolicyPlanReference JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a BackupPolicyPlanReference object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BackupPolicyPlanReference object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BackupPolicyPlanReference') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BackupPolicyPlanReference') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + BACKUP_POLICY_PLAN = 'backup_policy_plan' + + +class BackupPolicyPlanReferenceDeleted(): + """ + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. + + :attr str more_info: Link to documentation about deleted resources. + """ + + def __init__(self, + more_info: str) -> None: + """ + Initialize a BackupPolicyPlanReferenceDeleted object. + + :param str more_info: Link to documentation about deleted resources. + """ + self.more_info = more_info + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BackupPolicyPlanReferenceDeleted': + """Initialize a BackupPolicyPlanReferenceDeleted object from a json dictionary.""" + args = {} + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') + else: + raise ValueError('Required property \'more_info\' not present in BackupPolicyPlanReferenceDeleted JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a BackupPolicyPlanReferenceDeleted object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BackupPolicyPlanReferenceDeleted object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BackupPolicyPlanReferenceDeleted') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BackupPolicyPlanReferenceDeleted') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class BareMetalServer(): + """ + BareMetalServer. + + :attr int bandwidth: The total bandwidth (in megabits per second) shared across + the bare metal server's network interfaces. + :attr BareMetalServerBootTarget boot_target: The possible resource types for + this property are expected to expand in the future. + :attr BareMetalServerCPU cpu: The bare metal server CPU configuration. + :attr datetime created_at: The date and time that the bare metal server was + created. + :attr str crn: The CRN for this bare metal server. + :attr List[BareMetalServerDisk] disks: The disks for this bare metal server, + including any disks that are associated with the + `boot_target`. + :attr bool enable_secure_boot: Indicates whether secure boot is enabled. If + enabled, the image must support secure boot or the server will fail to boot. + :attr str href: The URL for this bare metal server. + :attr str id: The unique identifier for this bare metal server. + :attr int memory: The amount of memory, truncated to whole gibibytes. + :attr str name: The user-defined name for this bare metal server (and default + system hostname). + :attr List[NetworkInterfaceBareMetalServerContextReference] network_interfaces: + The network interfaces for this bare metal server, including the primary network + interface. + :attr NetworkInterfaceBareMetalServerContextReference primary_network_interface: + Primary network interface. + :attr BareMetalServerProfileReference profile: The profile this bare metal + server uses. + :attr ResourceGroupReference resource_group: The resource group for this bare + metal server. + :attr str resource_type: The resource type. + :attr str status: The status of the bare metal server. + :attr List[BareMetalServerStatusReason] status_reasons: The reasons for the + current status (if any). + The enumerated reason code values for this property will expand in the future. + When processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the resource on which the unexpected + reason code was encountered. + :attr BareMetalServerTrustedPlatformModule trusted_platform_module: + :attr VPCReference vpc: The VPC this bare metal server resides in. + :attr ZoneReference zone: The zone this bare metal server resides in. + """ + + def __init__(self, + bandwidth: int, + boot_target: 'BareMetalServerBootTarget', + cpu: 'BareMetalServerCPU', + created_at: datetime, + crn: str, + disks: List['BareMetalServerDisk'], + enable_secure_boot: bool, + href: str, + id: str, + memory: int, + name: str, + network_interfaces: List['NetworkInterfaceBareMetalServerContextReference'], + primary_network_interface: 'NetworkInterfaceBareMetalServerContextReference', + profile: 'BareMetalServerProfileReference', + resource_group: 'ResourceGroupReference', + resource_type: str, + status: str, + status_reasons: List['BareMetalServerStatusReason'], + trusted_platform_module: 'BareMetalServerTrustedPlatformModule', + vpc: 'VPCReference', + zone: 'ZoneReference') -> None: + """ + Initialize a BareMetalServer object. + + :param int bandwidth: The total bandwidth (in megabits per second) shared + across the bare metal server's network interfaces. + :param BareMetalServerBootTarget boot_target: The possible resource types + for this property are expected to expand in the future. + :param BareMetalServerCPU cpu: The bare metal server CPU configuration. + :param datetime created_at: The date and time that the bare metal server + was created. + :param str crn: The CRN for this bare metal server. + :param List[BareMetalServerDisk] disks: The disks for this bare metal + server, including any disks that are associated with the + `boot_target`. + :param bool enable_secure_boot: Indicates whether secure boot is enabled. + If enabled, the image must support secure boot or the server will fail to + boot. + :param str href: The URL for this bare metal server. + :param str id: The unique identifier for this bare metal server. + :param int memory: The amount of memory, truncated to whole gibibytes. + :param str name: The user-defined name for this bare metal server (and + default system hostname). + :param List[NetworkInterfaceBareMetalServerContextReference] + network_interfaces: The network interfaces for this bare metal server, + including the primary network interface. + :param NetworkInterfaceBareMetalServerContextReference + primary_network_interface: Primary network interface. + :param BareMetalServerProfileReference profile: The profile this bare metal + server uses. + :param ResourceGroupReference resource_group: The resource group for this + bare metal server. + :param str resource_type: The resource type. + :param str status: The status of the bare metal server. + :param List[BareMetalServerStatusReason] status_reasons: The reasons for + the current status (if any). + The enumerated reason code values for this property will expand in the + future. When processing this property, check for and log unknown values. + Optionally halt processing and surface the error, or bypass the resource on + which the unexpected reason code was encountered. + :param BareMetalServerTrustedPlatformModule trusted_platform_module: + :param VPCReference vpc: The VPC this bare metal server resides in. + :param ZoneReference zone: The zone this bare metal server resides in. + """ + self.bandwidth = bandwidth + self.boot_target = boot_target + self.cpu = cpu + self.created_at = created_at + self.crn = crn + self.disks = disks + self.enable_secure_boot = enable_secure_boot + self.href = href + self.id = id + self.memory = memory + self.name = name + self.network_interfaces = network_interfaces + self.primary_network_interface = primary_network_interface + self.profile = profile + self.resource_group = resource_group + self.resource_type = resource_type + self.status = status + self.status_reasons = status_reasons + self.trusted_platform_module = trusted_platform_module + self.vpc = vpc + self.zone = zone + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BareMetalServer': + """Initialize a BareMetalServer object from a json dictionary.""" + args = {} + if 'bandwidth' in _dict: + args['bandwidth'] = _dict.get('bandwidth') + else: + raise ValueError('Required property \'bandwidth\' not present in BareMetalServer JSON') + if 'boot_target' in _dict: + args['boot_target'] = _dict.get('boot_target') + else: + raise ValueError('Required property \'boot_target\' not present in BareMetalServer JSON') + if 'cpu' in _dict: + args['cpu'] = BareMetalServerCPU.from_dict(_dict.get('cpu')) + else: + raise ValueError('Required property \'cpu\' not present in BareMetalServer JSON') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) + else: + raise ValueError('Required property \'created_at\' not present in BareMetalServer JSON') + if 'crn' in _dict: + args['crn'] = _dict.get('crn') + else: + raise ValueError('Required property \'crn\' not present in BareMetalServer JSON') + if 'disks' in _dict: + args['disks'] = [BareMetalServerDisk.from_dict(x) for x in _dict.get('disks')] + else: + raise ValueError('Required property \'disks\' not present in BareMetalServer JSON') + if 'enable_secure_boot' in _dict: + args['enable_secure_boot'] = _dict.get('enable_secure_boot') + else: + raise ValueError('Required property \'enable_secure_boot\' not present in BareMetalServer JSON') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in BareMetalServer JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in BareMetalServer JSON') + if 'memory' in _dict: + args['memory'] = _dict.get('memory') + else: + raise ValueError('Required property \'memory\' not present in BareMetalServer JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in BareMetalServer JSON') + if 'network_interfaces' in _dict: + args['network_interfaces'] = [NetworkInterfaceBareMetalServerContextReference.from_dict(x) for x in _dict.get('network_interfaces')] + else: + raise ValueError('Required property \'network_interfaces\' not present in BareMetalServer JSON') + if 'primary_network_interface' in _dict: + args['primary_network_interface'] = NetworkInterfaceBareMetalServerContextReference.from_dict(_dict.get('primary_network_interface')) + else: + raise ValueError('Required property \'primary_network_interface\' not present in BareMetalServer JSON') + if 'profile' in _dict: + args['profile'] = BareMetalServerProfileReference.from_dict(_dict.get('profile')) + else: + raise ValueError('Required property \'profile\' not present in BareMetalServer JSON') + if 'resource_group' in _dict: + args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) + else: + raise ValueError('Required property \'resource_group\' not present in BareMetalServer JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in BareMetalServer JSON') + if 'status' in _dict: + args['status'] = _dict.get('status') + else: + raise ValueError('Required property \'status\' not present in BareMetalServer JSON') + if 'status_reasons' in _dict: + args['status_reasons'] = [BareMetalServerStatusReason.from_dict(x) for x in _dict.get('status_reasons')] + else: + raise ValueError('Required property \'status_reasons\' not present in BareMetalServer JSON') + if 'trusted_platform_module' in _dict: + args['trusted_platform_module'] = BareMetalServerTrustedPlatformModule.from_dict(_dict.get('trusted_platform_module')) + else: + raise ValueError('Required property \'trusted_platform_module\' not present in BareMetalServer JSON') + if 'vpc' in _dict: + args['vpc'] = VPCReference.from_dict(_dict.get('vpc')) + else: + raise ValueError('Required property \'vpc\' not present in BareMetalServer JSON') + if 'zone' in _dict: + args['zone'] = ZoneReference.from_dict(_dict.get('zone')) + else: + raise ValueError('Required property \'zone\' not present in BareMetalServer JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a BareMetalServer object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'bandwidth') and self.bandwidth is not None: + _dict['bandwidth'] = self.bandwidth + if hasattr(self, 'boot_target') and self.boot_target is not None: + if isinstance(self.boot_target, dict): + _dict['boot_target'] = self.boot_target + else: + _dict['boot_target'] = self.boot_target.to_dict() + if hasattr(self, 'cpu') and self.cpu is not None: + _dict['cpu'] = self.cpu.to_dict() + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'disks') and self.disks is not None: + _dict['disks'] = [x.to_dict() for x in self.disks] + if hasattr(self, 'enable_secure_boot') and self.enable_secure_boot is not None: + _dict['enable_secure_boot'] = self.enable_secure_boot + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'memory') and self.memory is not None: + _dict['memory'] = self.memory + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'network_interfaces') and self.network_interfaces is not None: + _dict['network_interfaces'] = [x.to_dict() for x in self.network_interfaces] + if hasattr(self, 'primary_network_interface') and self.primary_network_interface is not None: + _dict['primary_network_interface'] = self.primary_network_interface.to_dict() + if hasattr(self, 'profile') and self.profile is not None: + _dict['profile'] = self.profile.to_dict() + if hasattr(self, 'resource_group') and self.resource_group is not None: + _dict['resource_group'] = self.resource_group.to_dict() + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'status_reasons') and self.status_reasons is not None: + _dict['status_reasons'] = [x.to_dict() for x in self.status_reasons] + if hasattr(self, 'trusted_platform_module') and self.trusted_platform_module is not None: + _dict['trusted_platform_module'] = self.trusted_platform_module.to_dict() + if hasattr(self, 'vpc') and self.vpc is not None: + _dict['vpc'] = self.vpc.to_dict() + if hasattr(self, 'zone') and self.zone is not None: + _dict['zone'] = self.zone.to_dict() + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BareMetalServer object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BareMetalServer') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BareMetalServer') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + BARE_METAL_SERVER = 'bare_metal_server' + + + class StatusEnum(str, Enum): + """ + The status of the bare metal server. + """ + FAILED = 'failed' + MAINTENANCE = 'maintenance' + PENDING = 'pending' + RESTARTING = 'restarting' + RUNNING = 'running' + STARTING = 'starting' + STOPPED = 'stopped' + STOPPING = 'stopping' + + +class BareMetalServerBootTarget(): + """ + The possible resource types for this property are expected to expand in the future. + + """ + + def __init__(self) -> None: + """ + Initialize a BareMetalServerBootTarget object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['BareMetalServerBootTargetBareMetalServerDiskReference'])) + raise Exception(msg) + +class BareMetalServerCPU(): + """ + The bare metal server CPU configuration. + + :attr str architecture: The CPU architecture. + :attr int core_count: The total number of cores. + :attr int socket_count: The total number of CPU sockets. + :attr int threads_per_core: The total number of hardware threads per core. + """ + + def __init__(self, + architecture: str, + core_count: int, + socket_count: int, + threads_per_core: int) -> None: + """ + Initialize a BareMetalServerCPU object. + + :param str architecture: The CPU architecture. + :param int core_count: The total number of cores. + :param int socket_count: The total number of CPU sockets. + :param int threads_per_core: The total number of hardware threads per core. + """ + self.architecture = architecture + self.core_count = core_count + self.socket_count = socket_count + self.threads_per_core = threads_per_core + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BareMetalServerCPU': + """Initialize a BareMetalServerCPU object from a json dictionary.""" + args = {} + if 'architecture' in _dict: + args['architecture'] = _dict.get('architecture') + else: + raise ValueError('Required property \'architecture\' not present in BareMetalServerCPU JSON') + if 'core_count' in _dict: + args['core_count'] = _dict.get('core_count') + else: + raise ValueError('Required property \'core_count\' not present in BareMetalServerCPU JSON') + if 'socket_count' in _dict: + args['socket_count'] = _dict.get('socket_count') + else: + raise ValueError('Required property \'socket_count\' not present in BareMetalServerCPU JSON') + if 'threads_per_core' in _dict: + args['threads_per_core'] = _dict.get('threads_per_core') + else: + raise ValueError('Required property \'threads_per_core\' not present in BareMetalServerCPU JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a BareMetalServerCPU object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'architecture') and self.architecture is not None: + _dict['architecture'] = self.architecture + if hasattr(self, 'core_count') and self.core_count is not None: + _dict['core_count'] = self.core_count + if hasattr(self, 'socket_count') and self.socket_count is not None: + _dict['socket_count'] = self.socket_count + if hasattr(self, 'threads_per_core') and self.threads_per_core is not None: + _dict['threads_per_core'] = self.threads_per_core + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BareMetalServerCPU object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BareMetalServerCPU') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BareMetalServerCPU') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class BareMetalServerCollection(): + """ + BareMetalServerCollection. + + :attr List[BareMetalServer] bare_metal_servers: Collection of bare metal + servers. + :attr BareMetalServerCollectionFirst first: A link to the first page of + resources. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr BareMetalServerCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages + except the last page. + :attr int total_count: The total number of resources across all pages. + """ + + def __init__(self, + bare_metal_servers: List['BareMetalServer'], + first: 'BareMetalServerCollectionFirst', + limit: int, + total_count: int, + *, + next: 'BareMetalServerCollectionNext' = None) -> None: + """ + Initialize a BareMetalServerCollection object. + + :param List[BareMetalServer] bare_metal_servers: Collection of bare metal + servers. + :param BareMetalServerCollectionFirst first: A link to the first page of + resources. + :param int limit: The maximum number of resources that can be returned by + the request. + :param int total_count: The total number of resources across all pages. + :param BareMetalServerCollectionNext next: (optional) A link to the next + page of resources. This property is present for all pages + except the last page. + """ + self.bare_metal_servers = bare_metal_servers + self.first = first + self.limit = limit + self.next = next + self.total_count = total_count + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BareMetalServerCollection': + """Initialize a BareMetalServerCollection object from a json dictionary.""" + args = {} + if 'bare_metal_servers' in _dict: + args['bare_metal_servers'] = [BareMetalServer.from_dict(x) for x in _dict.get('bare_metal_servers')] + else: + raise ValueError('Required property \'bare_metal_servers\' not present in BareMetalServerCollection JSON') + if 'first' in _dict: + args['first'] = BareMetalServerCollectionFirst.from_dict(_dict.get('first')) + else: + raise ValueError('Required property \'first\' not present in BareMetalServerCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') + else: + raise ValueError('Required property \'limit\' not present in BareMetalServerCollection JSON') + if 'next' in _dict: + args['next'] = BareMetalServerCollectionNext.from_dict(_dict.get('next')) + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') + else: + raise ValueError('Required property \'total_count\' not present in BareMetalServerCollection JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a BareMetalServerCollection object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'bare_metal_servers') and self.bare_metal_servers is not None: + _dict['bare_metal_servers'] = [x.to_dict() for x in self.bare_metal_servers] + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BareMetalServerCollection object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BareMetalServerCollection') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BareMetalServerCollection') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class BareMetalServerCollectionFirst(): + """ + A link to the first page of resources. + + :attr str href: The URL for a page of resources. + """ + + def __init__(self, + href: str) -> None: + """ + Initialize a BareMetalServerCollectionFirst object. + + :param str href: The URL for a page of resources. + """ + self.href = href + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BareMetalServerCollectionFirst': + """Initialize a BareMetalServerCollectionFirst object from a json dictionary.""" + args = {} + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in BareMetalServerCollectionFirst JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a BareMetalServerCollectionFirst object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BareMetalServerCollectionFirst object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BareMetalServerCollectionFirst') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BareMetalServerCollectionFirst') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class BareMetalServerCollectionNext(): + """ + A link to the next page of resources. This property is present for all pages except + the last page. + + :attr str href: The URL for a page of resources. + """ + + def __init__(self, + href: str) -> None: + """ + Initialize a BareMetalServerCollectionNext object. + + :param str href: The URL for a page of resources. + """ + self.href = href + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BareMetalServerCollectionNext': + """Initialize a BareMetalServerCollectionNext object from a json dictionary.""" + args = {} + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in BareMetalServerCollectionNext JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a BareMetalServerCollectionNext object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BareMetalServerCollectionNext object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BareMetalServerCollectionNext') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BareMetalServerCollectionNext') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class BareMetalServerConsoleAccessToken(): + """ + The bare metal server console access token information. + + :attr str access_token: A URL safe single-use token used to access the console + WebSocket. + :attr str console_type: The bare metal server console type for which this token + may be used. + :attr datetime created_at: The date and time that the access token was created. + :attr datetime expires_at: The date and time that the access token will expire. + :attr bool force: Indicates whether to disconnect an existing serial console + session as the serial console cannot be shared. This has no effect on VNC + consoles. + :attr str href: The URL to access this bare metal server console. + """ + + def __init__(self, + access_token: str, + console_type: str, + created_at: datetime, + expires_at: datetime, + force: bool, + href: str) -> None: + """ + Initialize a BareMetalServerConsoleAccessToken object. + + :param str access_token: A URL safe single-use token used to access the + console WebSocket. + :param str console_type: The bare metal server console type for which this + token may be used. + :param datetime created_at: The date and time that the access token was + created. + :param datetime expires_at: The date and time that the access token will + expire. + :param bool force: Indicates whether to disconnect an existing serial + console session as the serial console cannot be shared. This has no effect + on VNC consoles. + :param str href: The URL to access this bare metal server console. + """ + self.access_token = access_token + self.console_type = console_type + self.created_at = created_at + self.expires_at = expires_at + self.force = force + self.href = href + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BareMetalServerConsoleAccessToken': + """Initialize a BareMetalServerConsoleAccessToken object from a json dictionary.""" + args = {} + if 'access_token' in _dict: + args['access_token'] = _dict.get('access_token') + else: + raise ValueError('Required property \'access_token\' not present in BareMetalServerConsoleAccessToken JSON') + if 'console_type' in _dict: + args['console_type'] = _dict.get('console_type') + else: + raise ValueError('Required property \'console_type\' not present in BareMetalServerConsoleAccessToken JSON') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) + else: + raise ValueError('Required property \'created_at\' not present in BareMetalServerConsoleAccessToken JSON') + if 'expires_at' in _dict: + args['expires_at'] = string_to_datetime(_dict.get('expires_at')) + else: + raise ValueError('Required property \'expires_at\' not present in BareMetalServerConsoleAccessToken JSON') + if 'force' in _dict: + args['force'] = _dict.get('force') + else: + raise ValueError('Required property \'force\' not present in BareMetalServerConsoleAccessToken JSON') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in BareMetalServerConsoleAccessToken JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a BareMetalServerConsoleAccessToken object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'access_token') and self.access_token is not None: + _dict['access_token'] = self.access_token + if hasattr(self, 'console_type') and self.console_type is not None: + _dict['console_type'] = self.console_type + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'expires_at') and self.expires_at is not None: + _dict['expires_at'] = datetime_to_string(self.expires_at) + if hasattr(self, 'force') and self.force is not None: + _dict['force'] = self.force + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BareMetalServerConsoleAccessToken object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BareMetalServerConsoleAccessToken') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BareMetalServerConsoleAccessToken') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class ConsoleTypeEnum(str, Enum): + """ + The bare metal server console type for which this token may be used. + """ + SERIAL = 'serial' + VNC = 'vnc' + + +class BareMetalServerDisk(): + """ + BareMetalServerDisk. + + :attr datetime created_at: The date and time that the disk was created. + :attr str href: The URL for this bare metal server disk. + :attr str id: The unique identifier for this bare metal server disk. + :attr str interface_type: The disk interface used for attaching the disk. + The enumerated values for this property are expected to expand in the future. + When processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the resource on which the unexpected + property value was encountered. + :attr str name: The user-defined name for this disk. + :attr str resource_type: The resource type. + :attr int size: The size of the disk in GB (gigabytes). + """ + + def __init__(self, + created_at: datetime, + href: str, + id: str, + interface_type: str, + name: str, + resource_type: str, + size: int) -> None: + """ + Initialize a BareMetalServerDisk object. + + :param datetime created_at: The date and time that the disk was created. + :param str href: The URL for this bare metal server disk. + :param str id: The unique identifier for this bare metal server disk. + :param str interface_type: The disk interface used for attaching the disk. + The enumerated values for this property are expected to expand in the + future. When processing this property, check for and log unknown values. + Optionally halt processing and surface the error, or bypass the resource on + which the unexpected property value was encountered. + :param str name: The user-defined name for this disk. + :param str resource_type: The resource type. + :param int size: The size of the disk in GB (gigabytes). + """ + self.created_at = created_at + self.href = href + self.id = id + self.interface_type = interface_type + self.name = name + self.resource_type = resource_type + self.size = size + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BareMetalServerDisk': + """Initialize a BareMetalServerDisk object from a json dictionary.""" + args = {} + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) + else: + raise ValueError('Required property \'created_at\' not present in BareMetalServerDisk JSON') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in BareMetalServerDisk JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in BareMetalServerDisk JSON') + if 'interface_type' in _dict: + args['interface_type'] = _dict.get('interface_type') + else: + raise ValueError('Required property \'interface_type\' not present in BareMetalServerDisk JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in BareMetalServerDisk JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in BareMetalServerDisk JSON') + if 'size' in _dict: + args['size'] = _dict.get('size') + else: + raise ValueError('Required property \'size\' not present in BareMetalServerDisk JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a BareMetalServerDisk object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'interface_type') and self.interface_type is not None: + _dict['interface_type'] = self.interface_type + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + if hasattr(self, 'size') and self.size is not None: + _dict['size'] = self.size + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BareMetalServerDisk object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BareMetalServerDisk') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BareMetalServerDisk') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class InterfaceTypeEnum(str, Enum): + """ + The disk interface used for attaching the disk. + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the resource on which the unexpected + property value was encountered. + """ + NVME = 'nvme' + SATA = 'sata' + + + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + BARE_METAL_SERVER_DISK = 'bare_metal_server_disk' + + +class BareMetalServerDiskCollection(): + """ + BareMetalServerDiskCollection. + + :attr List[BareMetalServerDisk] disks: Collection of the bare metal server's + disks. + """ + + def __init__(self, + disks: List['BareMetalServerDisk']) -> None: + """ + Initialize a BareMetalServerDiskCollection object. + + :param List[BareMetalServerDisk] disks: Collection of the bare metal + server's disks. + """ + self.disks = disks + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BareMetalServerDiskCollection': + """Initialize a BareMetalServerDiskCollection object from a json dictionary.""" + args = {} + if 'disks' in _dict: + args['disks'] = [BareMetalServerDisk.from_dict(x) for x in _dict.get('disks')] + else: + raise ValueError('Required property \'disks\' not present in BareMetalServerDiskCollection JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a BareMetalServerDiskCollection object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'disks') and self.disks is not None: + _dict['disks'] = [x.to_dict() for x in self.disks] + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BareMetalServerDiskCollection object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BareMetalServerDiskCollection') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BareMetalServerDiskCollection') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class BareMetalServerDiskPatch(): """ - Enums for list_subnet_reserved_ips parameters. + BareMetalServerDiskPatch. + + :attr str name: (optional) The user-defined name for this disk. """ - class Sort(str, Enum): + def __init__(self, + *, + name: str = None) -> None: """ - Sorts the returned collection by the specified property name in ascending order. A - `-` may be prepended to the name to sort in descending order. For example, the - value `-created_at` sorts the collection by the `created_at` property in - descending order, and the value `name` sorts it by the `name` property in - ascending order. + Initialize a BareMetalServerDiskPatch object. + + :param str name: (optional) The user-defined name for this disk. """ - ADDRESS = 'address' - CREATED_AT = 'created_at' - NAME = 'name' + self.name = name + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BareMetalServerDiskPatch': + """Initialize a BareMetalServerDiskPatch object from a json dictionary.""" + args = {} + if 'name' in _dict: + args['name'] = _dict.get('name') + return cls(**args) + @classmethod + def _from_dict(cls, _dict): + """Initialize a BareMetalServerDiskPatch object from a json dictionary.""" + return cls.from_dict(_dict) -class ListImagesEnums: + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BareMetalServerDiskPatch object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BareMetalServerDiskPatch') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BareMetalServerDiskPatch') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class BareMetalServerDiskReferenceDeleted(): """ - Enums for list_images parameters. + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. + + :attr str more_info: Link to documentation about deleted resources. """ - class Visibility(str, Enum): + def __init__(self, + more_info: str) -> None: """ - Filters the collection to images with the specified `visibility`. + Initialize a BareMetalServerDiskReferenceDeleted object. + + :param str more_info: Link to documentation about deleted resources. """ - PRIVATE = 'private' - PUBLIC = 'public' + self.more_info = more_info + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BareMetalServerDiskReferenceDeleted': + """Initialize a BareMetalServerDiskReferenceDeleted object from a json dictionary.""" + args = {} + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') + else: + raise ValueError('Required property \'more_info\' not present in BareMetalServerDiskReferenceDeleted JSON') + return cls(**args) + @classmethod + def _from_dict(cls, _dict): + """Initialize a BareMetalServerDiskReferenceDeleted object from a json dictionary.""" + return cls.from_dict(_dict) -class ListSnapshotsEnums: + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BareMetalServerDiskReferenceDeleted object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BareMetalServerDiskReferenceDeleted') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BareMetalServerDiskReferenceDeleted') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class BareMetalServerInitialization(): """ - Enums for list_snapshots parameters. + BareMetalServerInitialization. + + :attr ImageReference image: The image the bare metal server was provisioned + from. + :attr List[KeyReference] keys: The public SSH keys used at initialization. + :attr List[BareMetalServerInitializationUserAccount] user_accounts: The user + accounts that are created at initialization. There can be multiple account types + distinguished by the `resource_type` property. + """ + + def __init__(self, + image: 'ImageReference', + keys: List['KeyReference'], + user_accounts: List['BareMetalServerInitializationUserAccount']) -> None: + """ + Initialize a BareMetalServerInitialization object. + + :param ImageReference image: The image the bare metal server was + provisioned from. + :param List[KeyReference] keys: The public SSH keys used at initialization. + :param List[BareMetalServerInitializationUserAccount] user_accounts: The + user accounts that are created at initialization. There can be multiple + account types distinguished by the `resource_type` property. + """ + self.image = image + self.keys = keys + self.user_accounts = user_accounts + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BareMetalServerInitialization': + """Initialize a BareMetalServerInitialization object from a json dictionary.""" + args = {} + if 'image' in _dict: + args['image'] = ImageReference.from_dict(_dict.get('image')) + else: + raise ValueError('Required property \'image\' not present in BareMetalServerInitialization JSON') + if 'keys' in _dict: + args['keys'] = [KeyReference.from_dict(x) for x in _dict.get('keys')] + else: + raise ValueError('Required property \'keys\' not present in BareMetalServerInitialization JSON') + if 'user_accounts' in _dict: + args['user_accounts'] = _dict.get('user_accounts') + else: + raise ValueError('Required property \'user_accounts\' not present in BareMetalServerInitialization JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a BareMetalServerInitialization object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'image') and self.image is not None: + _dict['image'] = self.image.to_dict() + if hasattr(self, 'keys') and self.keys is not None: + _dict['keys'] = [x.to_dict() for x in self.keys] + if hasattr(self, 'user_accounts') and self.user_accounts is not None: + user_accounts_list = [] + for x in self.user_accounts: + if isinstance(x, dict): + user_accounts_list.append(x) + else: + user_accounts_list.append(x.to_dict()) + _dict['user_accounts'] = user_accounts_list + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BareMetalServerInitialization object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BareMetalServerInitialization') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BareMetalServerInitialization') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class BareMetalServerInitializationPrototype(): + """ + BareMetalServerInitializationPrototype. + + :attr ImageIdentity image: The image to be used when provisioning the bare metal + server. + :attr List[KeyIdentity] keys: The public SSH keys to install on the bare metal + server. Keys will be made available to the bare metal server as cloud-init + vendor data. For cloud-init enabled images, these keys will also be added as SSH + authorized keys for the administrative user. + For Windows images, at least one key must be specified, and one will be chosen + to encrypt the administrator password. Keys are optional for other images, but + if no keys are specified, the instance will be inaccessible unless the specified + image provides another means of access. + :attr str user_data: (optional) User data to be made available when initializing + the bare metal server. + """ + + def __init__(self, + image: 'ImageIdentity', + keys: List['KeyIdentity'], + *, + user_data: str = None) -> None: + """ + Initialize a BareMetalServerInitializationPrototype object. + + :param ImageIdentity image: The image to be used when provisioning the bare + metal server. + :param List[KeyIdentity] keys: The public SSH keys to install on the bare + metal server. Keys will be made available to the bare metal server as + cloud-init vendor data. For cloud-init enabled images, these keys will also + be added as SSH authorized keys for the administrative user. + For Windows images, at least one key must be specified, and one will be + chosen to encrypt the administrator password. Keys are optional for other + images, but if no keys are specified, the instance will be inaccessible + unless the specified image provides another means of access. + :param str user_data: (optional) User data to be made available when + initializing the bare metal server. + """ + self.image = image + self.keys = keys + self.user_data = user_data + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BareMetalServerInitializationPrototype': + """Initialize a BareMetalServerInitializationPrototype object from a json dictionary.""" + args = {} + if 'image' in _dict: + args['image'] = _dict.get('image') + else: + raise ValueError('Required property \'image\' not present in BareMetalServerInitializationPrototype JSON') + if 'keys' in _dict: + args['keys'] = _dict.get('keys') + else: + raise ValueError('Required property \'keys\' not present in BareMetalServerInitializationPrototype JSON') + if 'user_data' in _dict: + args['user_data'] = _dict.get('user_data') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a BareMetalServerInitializationPrototype object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'image') and self.image is not None: + if isinstance(self.image, dict): + _dict['image'] = self.image + else: + _dict['image'] = self.image.to_dict() + if hasattr(self, 'keys') and self.keys is not None: + keys_list = [] + for x in self.keys: + if isinstance(x, dict): + keys_list.append(x) + else: + keys_list.append(x.to_dict()) + _dict['keys'] = keys_list + if hasattr(self, 'user_data') and self.user_data is not None: + _dict['user_data'] = self.user_data + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this BareMetalServerInitializationPrototype object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BareMetalServerInitializationPrototype') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'BareMetalServerInitializationPrototype') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class BareMetalServerInitializationUserAccount(): + """ + BareMetalServerInitializationUserAccount. + + """ + + def __init__(self) -> None: + """ + Initialize a BareMetalServerInitializationUserAccount object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount'])) + raise Exception(msg) + +class BareMetalServerNetworkInterface(): + """ + BareMetalServerNetworkInterface. + + :attr bool allow_ip_spoofing: Indicates whether source IP spoofing is allowed on + this interface. If false, source IP spoofing is prevented on this interface. If + true, source IP spoofing is allowed on this interface. + :attr datetime created_at: The date and time that the network interface was + created. + :attr bool enable_infrastructure_nat: If `true`: + - The VPC infrastructure performs any needed NAT operations. + - A single floating IP can be assigned to the network interface. + If `false`: + - Packets are passed unmodified to/from the network interface, + allowing the workload to perform any needed NAT operations. + - Multiple floating IPs can be assigned to the network interface. + - `allow_ip_spoofing` must be set to `false`. + :attr List[FloatingIPReference] floating_ips: (optional) The floating IPs + associated with this network interface. + :attr str href: The URL for this network interface. + :attr str id: The unique identifier for this network interface. + :attr str interface_type: The network interface type: + - `pci`: a physical PCI device which can only be created or deleted when the + bare metal + server is stopped + - Has an `allowed_vlans` property which controls the VLANs that will be + permitted + to use the PCI interface + - Cannot directly use an IEEE 802.1q VLAN tag. + - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in + its + array of `allowed_vlans`. + - Must use an IEEE 802.1q tag. + - Has its own security groups and does not inherit those of the PCI device + through + which traffic flows. + :attr str mac_address: The MAC address of the interface. If absent, the value + is not known. + :attr str name: The user-defined name for this network interface. + :attr int port_speed: The network interface port speed in Mbps. + :attr ReservedIPReference primary_ip: + :attr str resource_type: The resource type. + :attr List[SecurityGroupReference] security_groups: The security groups + targeting this network interface. + :attr str status: The status of the network interface. + :attr SubnetReference subnet: The associated subnet. + :attr str type: The type of this bare metal server network interface. """ - class Sort(str, Enum): + def __init__(self, + allow_ip_spoofing: bool, + created_at: datetime, + enable_infrastructure_nat: bool, + href: str, + id: str, + interface_type: str, + mac_address: str, + name: str, + port_speed: int, + primary_ip: 'ReservedIPReference', + resource_type: str, + security_groups: List['SecurityGroupReference'], + status: str, + subnet: 'SubnetReference', + type: str, + *, + floating_ips: List['FloatingIPReference'] = None) -> None: + """ + Initialize a BareMetalServerNetworkInterface object. + + :param bool allow_ip_spoofing: Indicates whether source IP spoofing is + allowed on this interface. If false, source IP spoofing is prevented on + this interface. If true, source IP spoofing is allowed on this interface. + :param datetime created_at: The date and time that the network interface + was created. + :param bool enable_infrastructure_nat: If `true`: + - The VPC infrastructure performs any needed NAT operations. + - A single floating IP can be assigned to the network interface. + If `false`: + - Packets are passed unmodified to/from the network interface, + allowing the workload to perform any needed NAT operations. + - Multiple floating IPs can be assigned to the network interface. + - `allow_ip_spoofing` must be set to `false`. + :param str href: The URL for this network interface. + :param str id: The unique identifier for this network interface. + :param str interface_type: The network interface type: + - `pci`: a physical PCI device which can only be created or deleted when + the bare metal + server is stopped + - Has an `allowed_vlans` property which controls the VLANs that will be + permitted + to use the PCI interface + - Cannot directly use an IEEE 802.1q VLAN tag. + - `vlan`: a virtual device, used through a `pci` device that has the `vlan` + in its + array of `allowed_vlans`. + - Must use an IEEE 802.1q tag. + - Has its own security groups and does not inherit those of the PCI + device through + which traffic flows. + :param str mac_address: The MAC address of the interface. If absent, the + value is not known. + :param str name: The user-defined name for this network interface. + :param int port_speed: The network interface port speed in Mbps. + :param ReservedIPReference primary_ip: + :param str resource_type: The resource type. + :param List[SecurityGroupReference] security_groups: The security groups + targeting this network interface. + :param str status: The status of the network interface. + :param SubnetReference subnet: The associated subnet. + :param str type: The type of this bare metal server network interface. + :param List[FloatingIPReference] floating_ips: (optional) The floating IPs + associated with this network interface. + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['BareMetalServerNetworkInterfaceByPCI', 'BareMetalServerNetworkInterfaceByVLAN'])) + raise Exception(msg) + + @classmethod + def from_dict(cls, _dict: Dict) -> 'BareMetalServerNetworkInterface': + """Initialize a BareMetalServerNetworkInterface object from a json dictionary.""" + disc_class = cls._get_class_by_discriminator(_dict) + if disc_class != cls: + return disc_class.from_dict(_dict) + msg = ("Cannot convert dictionary into an instance of base class 'BareMetalServerNetworkInterface'. " + + "The discriminator value should map to a valid subclass: {1}").format( + ", ".join(['BareMetalServerNetworkInterfaceByPCI', 'BareMetalServerNetworkInterfaceByVLAN'])) + raise Exception(msg) + + @classmethod + def _from_dict(cls, _dict: Dict): + """Initialize a BareMetalServerNetworkInterface object from a json dictionary.""" + return cls.from_dict(_dict) + + @classmethod + def _get_class_by_discriminator(cls, _dict: Dict) -> object: + mapping = {} + mapping['pci'] = 'BareMetalServerNetworkInterfaceByPCI' + mapping['vlan'] = 'BareMetalServerNetworkInterfaceByVLAN' + disc_value = _dict.get('interface_type') + if disc_value is None: + raise ValueError('Discriminator property \'interface_type\' not found in BareMetalServerNetworkInterface JSON') + class_name = mapping.get(disc_value, disc_value) + try: + disc_class = getattr(sys.modules[__name__], class_name) + except AttributeError: + disc_class = cls + if isinstance(disc_class, object): + return disc_class + raise TypeError('%s is not a discriminator class' % class_name) + + class InterfaceTypeEnum(str, Enum): + """ + The network interface type: + - `pci`: a physical PCI device which can only be created or deleted when the bare + metal + server is stopped + - Has an `allowed_vlans` property which controls the VLANs that will be + permitted + to use the PCI interface + - Cannot directly use an IEEE 802.1q VLAN tag. + - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its + array of `allowed_vlans`. + - Must use an IEEE 802.1q tag. + - Has its own security groups and does not inherit those of the PCI device + through + which traffic flows. + """ + PCI = 'pci' + VLAN = 'vlan' + + + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + NETWORK_INTERFACE = 'network_interface' + + + class StatusEnum(str, Enum): + """ + The status of the network interface. + """ + AVAILABLE = 'available' + DELETING = 'deleting' + FAILED = 'failed' + PENDING = 'pending' + + + class TypeEnum(str, Enum): """ - Sorts the returned collection by the specified property name in ascending order. A - `-` may be prepended to the name to sort in descending order. For example, the - value `-created_at` sorts the collection by the `created_at` property in - descending order, and the value `name` sorts it by the `name` property in - ascending order. + The type of this bare metal server network interface. """ - CREATED_AT = 'created_at' - NAME = 'name' + PRIMARY = 'primary' + SECONDARY = 'secondary' -class ListFloatingIpsEnums: +class BareMetalServerNetworkInterfaceCollection(): """ - Enums for list_floating_ips parameters. + BareMetalServerNetworkInterfaceCollection. + + :attr BareMetalServerNetworkInterfaceCollectionFirst first: A link to the first + page of resources. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr List[BareMetalServerNetworkInterface] network_interfaces: Collection of + network interfaces. + :attr BareMetalServerNetworkInterfaceCollectionNext next: (optional) A link to + the next page of resources. This property is present for all pages + except the last page. + :attr int total_count: The total number of resources across all pages. """ - class Sort(str, Enum): + def __init__(self, + first: 'BareMetalServerNetworkInterfaceCollectionFirst', + limit: int, + network_interfaces: List['BareMetalServerNetworkInterface'], + total_count: int, + *, + next: 'BareMetalServerNetworkInterfaceCollectionNext' = None) -> None: """ - Sorts the returned collection by the specified property name in ascending order. A - `-` may be prepended to the name to sort in descending order. For example, the - value `-created_at` sorts the collection by the `created_at` property in - descending order, and the value `name` sorts it by the `name` property in - ascending order. + Initialize a BareMetalServerNetworkInterfaceCollection object. + + :param BareMetalServerNetworkInterfaceCollectionFirst first: A link to the + first page of resources. + :param int limit: The maximum number of resources that can be returned by + the request. + :param List[BareMetalServerNetworkInterface] network_interfaces: Collection + of network interfaces. + :param int total_count: The total number of resources across all pages. + :param BareMetalServerNetworkInterfaceCollectionNext next: (optional) A + link to the next page of resources. This property is present for all pages + except the last page. """ - CREATED_AT = 'created_at' - NAME = 'name' + self.first = first + self.limit = limit + self.network_interfaces = network_interfaces + self.next = next + self.total_count = total_count + @classmethod + def from_dict(cls, _dict: Dict) -> 'BareMetalServerNetworkInterfaceCollection': + """Initialize a BareMetalServerNetworkInterfaceCollection object from a json dictionary.""" + args = {} + if 'first' in _dict: + args['first'] = BareMetalServerNetworkInterfaceCollectionFirst.from_dict(_dict.get('first')) + else: + raise ValueError('Required property \'first\' not present in BareMetalServerNetworkInterfaceCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') + else: + raise ValueError('Required property \'limit\' not present in BareMetalServerNetworkInterfaceCollection JSON') + if 'network_interfaces' in _dict: + args['network_interfaces'] = [BareMetalServerNetworkInterface.from_dict(x) for x in _dict.get('network_interfaces')] + else: + raise ValueError('Required property \'network_interfaces\' not present in BareMetalServerNetworkInterfaceCollection JSON') + if 'next' in _dict: + args['next'] = BareMetalServerNetworkInterfaceCollectionNext.from_dict(_dict.get('next')) + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') + else: + raise ValueError('Required property \'total_count\' not present in BareMetalServerNetworkInterfaceCollection JSON') + return cls(**args) -class ListNetworkAclRulesEnums: - """ - Enums for list_network_acl_rules parameters. - """ + @classmethod + def _from_dict(cls, _dict): + """Initialize a BareMetalServerNetworkInterfaceCollection object from a json dictionary.""" + return cls.from_dict(_dict) - class Direction(str, Enum): - """ - Filters the collection to rules with the specified direction. - """ - INBOUND = 'inbound' - OUTBOUND = 'outbound' + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'network_interfaces') and self.network_interfaces is not None: + _dict['network_interfaces'] = [x.to_dict() for x in self.network_interfaces] + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + return _dict + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() -class ListVpnGatewaysEnums: - """ - Enums for list_vpn_gateways parameters. - """ + def __str__(self) -> str: + """Return a `str` version of this BareMetalServerNetworkInterfaceCollection object.""" + return json.dumps(self.to_dict(), indent=2) - class Mode(str, Enum): - """ - Filters the collection to VPN gateways with the specified mode. - """ - POLICY = 'policy' - ROUTE = 'route' + def __eq__(self, other: 'BareMetalServerNetworkInterfaceCollection') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + def __ne__(self, other: 'BareMetalServerNetworkInterfaceCollection') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other -class ListEndpointGatewayIpsEnums: +class BareMetalServerNetworkInterfaceCollectionFirst(): """ - Enums for list_endpoint_gateway_ips parameters. + A link to the first page of resources. + + :attr str href: The URL for a page of resources. """ - class Sort(str, Enum): + def __init__(self, + href: str) -> None: """ - Sorts the returned collection by the specified property name in ascending order. A - `-` may be prepended to the name to sort in descending order. For example, the - value `-created_at` sorts the collection by the `created_at` property in - descending order, and the value `name` sorts it by the `name` property in - ascending order. + Initialize a BareMetalServerNetworkInterfaceCollectionFirst object. + + :param str href: The URL for a page of resources. """ - ADDRESS = 'address' - CREATED_AT = 'created_at' - NAME = 'name' + self.href = href + @classmethod + def from_dict(cls, _dict: Dict) -> 'BareMetalServerNetworkInterfaceCollectionFirst': + """Initialize a BareMetalServerNetworkInterfaceCollectionFirst object from a json dictionary.""" + args = {} + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in BareMetalServerNetworkInterfaceCollectionFirst JSON') + return cls(**args) -class ListFlowLogCollectorsEnums: - """ - Enums for list_flow_log_collectors parameters. - """ + @classmethod + def _from_dict(cls, _dict): + """Initialize a BareMetalServerNetworkInterfaceCollectionFirst object from a json dictionary.""" + return cls.from_dict(_dict) - class TargetResourceType(str, Enum): - """ - Filters the collection to flow log collectors that target the specified resource - type. - """ - INSTANCE = 'instance' - NETWORK_INTERFACE = 'network_interface' - SUBNET = 'subnet' - VPC = 'vpc' + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + return _dict + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() -############################################################################## -# Models -############################################################################## + def __str__(self) -> str: + """Return a `str` version of this BareMetalServerNetworkInterfaceCollectionFirst object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'BareMetalServerNetworkInterfaceCollectionFirst') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + def __ne__(self, other: 'BareMetalServerNetworkInterfaceCollectionFirst') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other -class AddressPrefix(): +class BareMetalServerNetworkInterfaceCollectionNext(): """ - AddressPrefix. + A link to the next page of resources. This property is present for all pages except + the last page. - :attr str cidr: The CIDR block for this prefix. - :attr datetime created_at: The date and time that the prefix was created. - :attr bool has_subnets: Indicates whether subnets exist with addresses from this - prefix. - :attr str href: The URL for this address prefix. - :attr str id: The unique identifier for this address prefix. - :attr bool is_default: Indicates whether this is the default prefix for this - zone in this VPC. If a default prefix was automatically created when the VPC was - created, the prefix is automatically named using a hyphenated list of - randomly-selected words, but may be updated with a user-specified name. - :attr str name: The user-defined name for this address prefix. Names must be - unique within the VPC the address prefix resides in. - :attr ZoneReference zone: The zone this address prefix resides in. + :attr str href: The URL for a page of resources. """ def __init__(self, - cidr: str, - created_at: datetime, - has_subnets: bool, - href: str, - id: str, - is_default: bool, - name: str, - zone: 'ZoneReference') -> None: + href: str) -> None: """ - Initialize a AddressPrefix object. + Initialize a BareMetalServerNetworkInterfaceCollectionNext object. - :param str cidr: The CIDR block for this prefix. - :param datetime created_at: The date and time that the prefix was created. - :param bool has_subnets: Indicates whether subnets exist with addresses - from this prefix. - :param str href: The URL for this address prefix. - :param str id: The unique identifier for this address prefix. - :param bool is_default: Indicates whether this is the default prefix for - this zone in this VPC. If a default prefix was automatically created when - the VPC was created, the prefix is automatically named using a hyphenated - list of randomly-selected words, but may be updated with a user-specified - name. - :param str name: The user-defined name for this address prefix. Names must - be unique within the VPC the address prefix resides in. - :param ZoneReference zone: The zone this address prefix resides in. + :param str href: The URL for a page of resources. """ - self.cidr = cidr - self.created_at = created_at - self.has_subnets = has_subnets self.href = href - self.id = id - self.is_default = is_default - self.name = name - self.zone = zone @classmethod - def from_dict(cls, _dict: Dict) -> 'AddressPrefix': - """Initialize a AddressPrefix object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'BareMetalServerNetworkInterfaceCollectionNext': + """Initialize a BareMetalServerNetworkInterfaceCollectionNext object from a json dictionary.""" args = {} - if 'cidr' in _dict: - args['cidr'] = _dict.get('cidr') - else: - raise ValueError('Required property \'cidr\' not present in AddressPrefix JSON') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - else: - raise ValueError('Required property \'created_at\' not present in AddressPrefix JSON') - if 'has_subnets' in _dict: - args['has_subnets'] = _dict.get('has_subnets') - else: - raise ValueError('Required property \'has_subnets\' not present in AddressPrefix JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in AddressPrefix JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in AddressPrefix JSON') - if 'is_default' in _dict: - args['is_default'] = _dict.get('is_default') - else: - raise ValueError('Required property \'is_default\' not present in AddressPrefix JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in AddressPrefix JSON') - if 'zone' in _dict: - args['zone'] = ZoneReference.from_dict(_dict.get('zone')) - else: - raise ValueError('Required property \'zone\' not present in AddressPrefix JSON') + raise ValueError('Required property \'href\' not present in BareMetalServerNetworkInterfaceCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a AddressPrefix object from a json dictionary.""" + """Initialize a BareMetalServerNetworkInterfaceCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'cidr') and self.cidr is not None: - _dict['cidr'] = self.cidr - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'has_subnets') and self.has_subnets is not None: - _dict['has_subnets'] = self.has_subnets if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'is_default') and self.is_default is not None: - _dict['is_default'] = self.is_default - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'zone') and self.zone is not None: - _dict['zone'] = self.zone.to_dict() return _dict def _to_dict(self): @@ -16731,102 +21579,104 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this AddressPrefix object.""" + """Return a `str` version of this BareMetalServerNetworkInterfaceCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'AddressPrefix') -> bool: + def __eq__(self, other: 'BareMetalServerNetworkInterfaceCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'AddressPrefix') -> bool: + def __ne__(self, other: 'BareMetalServerNetworkInterfaceCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class AddressPrefixCollection(): +class BareMetalServerNetworkInterfacePatch(): """ - AddressPrefixCollection. + BareMetalServerNetworkInterfacePatch. - :attr List[AddressPrefix] address_prefixes: Collection of address prefixes. - :attr AddressPrefixCollectionFirst first: A link to the first page of resources. - :attr int limit: The maximum number of resources that can be returned by the - request. - :attr AddressPrefixCollectionNext next: (optional) A link to the next page of - resources. This property is present for all pages - except the last page. - :attr int total_count: The total number of resources across all pages. + :attr bool allow_ip_spoofing: (optional) Indicates whether source IP spoofing is + allowed on this interface. If false, source IP spoofing is prevented on this + interface. If true, source IP spoofing is allowed on this interface. + :attr List[int] allowed_vlans: (optional) Indicates what VLAN IDs (for VLAN type + only) can use this physical (PCI type) interface. A given VLAN can only be in + the `allowed_vlans` array for one PCI type adapter per bare metal server. + :attr bool enable_infrastructure_nat: (optional) If `true`: + - The VPC infrastructure performs any needed NAT operations. + - A single floating IP can be assigned to the network interface. + If `false`: + - Packets are passed unmodified to/from the network interface, + allowing the workload to perform any needed NAT operations. + - Multiple floating IPs can be assigned to the network interface. + - `allow_ip_spoofing` must be set to `false`. + :attr str name: (optional) The user-defined name for network interface. Names + must be unique within the instance the network interface resides in. """ def __init__(self, - address_prefixes: List['AddressPrefix'], - first: 'AddressPrefixCollectionFirst', - limit: int, - total_count: int, *, - next: 'AddressPrefixCollectionNext' = None) -> None: + allow_ip_spoofing: bool = None, + allowed_vlans: List[int] = None, + enable_infrastructure_nat: bool = None, + name: str = None) -> None: """ - Initialize a AddressPrefixCollection object. + Initialize a BareMetalServerNetworkInterfacePatch object. - :param List[AddressPrefix] address_prefixes: Collection of address - prefixes. - :param AddressPrefixCollectionFirst first: A link to the first page of - resources. - :param int limit: The maximum number of resources that can be returned by - the request. - :param int total_count: The total number of resources across all pages. - :param AddressPrefixCollectionNext next: (optional) A link to the next page - of resources. This property is present for all pages - except the last page. + :param bool allow_ip_spoofing: (optional) Indicates whether source IP + spoofing is allowed on this interface. If false, source IP spoofing is + prevented on this interface. If true, source IP spoofing is allowed on this + interface. + :param List[int] allowed_vlans: (optional) Indicates what VLAN IDs (for + VLAN type only) can use this physical (PCI type) interface. A given VLAN + can only be in the `allowed_vlans` array for one PCI type adapter per bare + metal server. + :param bool enable_infrastructure_nat: (optional) If `true`: + - The VPC infrastructure performs any needed NAT operations. + - A single floating IP can be assigned to the network interface. + If `false`: + - Packets are passed unmodified to/from the network interface, + allowing the workload to perform any needed NAT operations. + - Multiple floating IPs can be assigned to the network interface. + - `allow_ip_spoofing` must be set to `false`. + :param str name: (optional) The user-defined name for network interface. + Names must be unique within the instance the network interface resides in. """ - self.address_prefixes = address_prefixes - self.first = first - self.limit = limit - self.next = next - self.total_count = total_count + self.allow_ip_spoofing = allow_ip_spoofing + self.allowed_vlans = allowed_vlans + self.enable_infrastructure_nat = enable_infrastructure_nat + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'AddressPrefixCollection': - """Initialize a AddressPrefixCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'BareMetalServerNetworkInterfacePatch': + """Initialize a BareMetalServerNetworkInterfacePatch object from a json dictionary.""" args = {} - if 'address_prefixes' in _dict: - args['address_prefixes'] = [AddressPrefix.from_dict(x) for x in _dict.get('address_prefixes')] - else: - raise ValueError('Required property \'address_prefixes\' not present in AddressPrefixCollection JSON') - if 'first' in _dict: - args['first'] = AddressPrefixCollectionFirst.from_dict(_dict.get('first')) - else: - raise ValueError('Required property \'first\' not present in AddressPrefixCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') - else: - raise ValueError('Required property \'limit\' not present in AddressPrefixCollection JSON') - if 'next' in _dict: - args['next'] = AddressPrefixCollectionNext.from_dict(_dict.get('next')) - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') - else: - raise ValueError('Required property \'total_count\' not present in AddressPrefixCollection JSON') + if 'allow_ip_spoofing' in _dict: + args['allow_ip_spoofing'] = _dict.get('allow_ip_spoofing') + if 'allowed_vlans' in _dict: + args['allowed_vlans'] = _dict.get('allowed_vlans') + if 'enable_infrastructure_nat' in _dict: + args['enable_infrastructure_nat'] = _dict.get('enable_infrastructure_nat') + if 'name' in _dict: + args['name'] = _dict.get('name') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a AddressPrefixCollection object from a json dictionary.""" + """Initialize a BareMetalServerNetworkInterfacePatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'address_prefixes') and self.address_prefixes is not None: - _dict['address_prefixes'] = [x.to_dict() for x in self.address_prefixes] - if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count + if hasattr(self, 'allow_ip_spoofing') and self.allow_ip_spoofing is not None: + _dict['allow_ip_spoofing'] = self.allow_ip_spoofing + if hasattr(self, 'allowed_vlans') and self.allowed_vlans is not None: + _dict['allowed_vlans'] = self.allowed_vlans + if hasattr(self, 'enable_infrastructure_nat') and self.enable_infrastructure_nat is not None: + _dict['enable_infrastructure_nat'] = self.enable_infrastructure_nat + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -16834,112 +21684,217 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this AddressPrefixCollection object.""" + """Return a `str` version of this BareMetalServerNetworkInterfacePatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'AddressPrefixCollection') -> bool: + def __eq__(self, other: 'BareMetalServerNetworkInterfacePatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'AddressPrefixCollection') -> bool: + def __ne__(self, other: 'BareMetalServerNetworkInterfacePatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class AddressPrefixCollectionFirst(): +class BareMetalServerNetworkInterfacePrototype(): """ - A link to the first page of resources. + BareMetalServerNetworkInterfacePrototype. - :attr str href: The URL for a page of resources. + :attr bool allow_ip_spoofing: (optional) Indicates whether source IP spoofing is + allowed on this interface. If false, source IP spoofing is prevented on this + interface. If true, source IP spoofing is allowed on this interface. + :attr bool enable_infrastructure_nat: (optional) If `true`: + - The VPC infrastructure performs any needed NAT operations. + - A single floating IP can be assigned to the network interface. + If `false`: + - Packets are passed unmodified to/from the network interface, + allowing the workload to perform any needed NAT operations. + - Multiple floating IPs can be assigned to the network interface. + - `allow_ip_spoofing` must be set to `false`. + :attr str interface_type: The network interface type: + - `pci`: a physical PCI device which can only be created or deleted when the + bare metal + server is stopped + - Has an `allowed_vlans` property which controls the VLANs that will be + permitted + to use the PCI interface + - Cannot directly use an IEEE 802.1q VLAN tag. + - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in + its + array of `allowed_vlans`. + - Must use an IEEE 802.1q tag. + - Has its own security groups and does not inherit those of the PCI device + through + which traffic flows. + :attr str name: (optional) The user-defined name for network interface. Names + must be unique within the instance the network interface resides in. If + unspecified, the name will be a hyphenated list of randomly-selected words. + :attr NetworkInterfaceIPPrototype primary_ip: (optional) The primary IP address + to bind to the network interface. This can be specified using + an existing reserved IP, or a prototype object for a new reserved IP. + If an existing reserved IP or a prototype object with an address is specified, + it must + be available on the network interface's subnet. Otherwise, an available address + on the + subnet will be automatically selected and reserved. + :attr List[SecurityGroupIdentity] security_groups: (optional) The security + groups to use for this network interface. If unspecified, the VPC's default + security group is used. + :attr SubnetIdentity subnet: The associated subnet. """ def __init__(self, - href: str) -> None: + interface_type: str, + subnet: 'SubnetIdentity', + *, + allow_ip_spoofing: bool = None, + enable_infrastructure_nat: bool = None, + name: str = None, + primary_ip: 'NetworkInterfaceIPPrototype' = None, + security_groups: List['SecurityGroupIdentity'] = None) -> None: """ - Initialize a AddressPrefixCollectionFirst object. + Initialize a BareMetalServerNetworkInterfacePrototype object. - :param str href: The URL for a page of resources. + :param str interface_type: The network interface type: + - `pci`: a physical PCI device which can only be created or deleted when + the bare metal + server is stopped + - Has an `allowed_vlans` property which controls the VLANs that will be + permitted + to use the PCI interface + - Cannot directly use an IEEE 802.1q VLAN tag. + - `vlan`: a virtual device, used through a `pci` device that has the `vlan` + in its + array of `allowed_vlans`. + - Must use an IEEE 802.1q tag. + - Has its own security groups and does not inherit those of the PCI + device through + which traffic flows. + :param SubnetIdentity subnet: The associated subnet. + :param bool allow_ip_spoofing: (optional) Indicates whether source IP + spoofing is allowed on this interface. If false, source IP spoofing is + prevented on this interface. If true, source IP spoofing is allowed on this + interface. + :param bool enable_infrastructure_nat: (optional) If `true`: + - The VPC infrastructure performs any needed NAT operations. + - A single floating IP can be assigned to the network interface. + If `false`: + - Packets are passed unmodified to/from the network interface, + allowing the workload to perform any needed NAT operations. + - Multiple floating IPs can be assigned to the network interface. + - `allow_ip_spoofing` must be set to `false`. + :param str name: (optional) The user-defined name for network interface. + Names must be unique within the instance the network interface resides in. + If unspecified, the name will be a hyphenated list of randomly-selected + words. + :param NetworkInterfaceIPPrototype primary_ip: (optional) The primary IP + address to bind to the network interface. This can be specified using + an existing reserved IP, or a prototype object for a new reserved IP. + If an existing reserved IP or a prototype object with an address is + specified, it must + be available on the network interface's subnet. Otherwise, an available + address on the + subnet will be automatically selected and reserved. + :param List[SecurityGroupIdentity] security_groups: (optional) The security + groups to use for this network interface. If unspecified, the VPC's default + security group is used. """ - self.href = href + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPCIPrototype', 'BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVLANPrototype'])) + raise Exception(msg) @classmethod - def from_dict(cls, _dict: Dict) -> 'AddressPrefixCollectionFirst': - """Initialize a AddressPrefixCollectionFirst object from a json dictionary.""" - args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in AddressPrefixCollectionFirst JSON') - return cls(**args) + def from_dict(cls, _dict: Dict) -> 'BareMetalServerNetworkInterfacePrototype': + """Initialize a BareMetalServerNetworkInterfacePrototype object from a json dictionary.""" + disc_class = cls._get_class_by_discriminator(_dict) + if disc_class != cls: + return disc_class.from_dict(_dict) + msg = ("Cannot convert dictionary into an instance of base class 'BareMetalServerNetworkInterfacePrototype'. " + + "The discriminator value should map to a valid subclass: {1}").format( + ", ".join(['BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPCIPrototype', 'BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVLANPrototype'])) + raise Exception(msg) @classmethod - def _from_dict(cls, _dict): - """Initialize a AddressPrefixCollectionFirst object from a json dictionary.""" + def _from_dict(cls, _dict: Dict): + """Initialize a BareMetalServerNetworkInterfacePrototype object from a json dictionary.""" return cls.from_dict(_dict) - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this AddressPrefixCollectionFirst object.""" - return json.dumps(self.to_dict(), indent=2) + @classmethod + def _get_class_by_discriminator(cls, _dict: Dict) -> object: + mapping = {} + mapping['pci'] = 'BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPCIPrototype' + mapping['vlan'] = 'BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVLANPrototype' + disc_value = _dict.get('interface_type') + if disc_value is None: + raise ValueError('Discriminator property \'interface_type\' not found in BareMetalServerNetworkInterfacePrototype JSON') + class_name = mapping.get(disc_value, disc_value) + try: + disc_class = getattr(sys.modules[__name__], class_name) + except AttributeError: + disc_class = cls + if isinstance(disc_class, object): + return disc_class + raise TypeError('%s is not a discriminator class' % class_name) - def __eq__(self, other: 'AddressPrefixCollectionFirst') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ + class InterfaceTypeEnum(str, Enum): + """ + The network interface type: + - `pci`: a physical PCI device which can only be created or deleted when the bare + metal + server is stopped + - Has an `allowed_vlans` property which controls the VLANs that will be + permitted + to use the PCI interface + - Cannot directly use an IEEE 802.1q VLAN tag. + - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its + array of `allowed_vlans`. + - Must use an IEEE 802.1q tag. + - Has its own security groups and does not inherit those of the PCI device + through + which traffic flows. + """ + PCI = 'pci' + VLAN = 'vlan' - def __ne__(self, other: 'AddressPrefixCollectionFirst') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other -class AddressPrefixCollectionNext(): +class BareMetalServerPatch(): """ - A link to the next page of resources. This property is present for all pages except - the last page. + BareMetalServerPatch. - :attr str href: The URL for a page of resources. + :attr str name: (optional) The user-defined name for this bare metal server (and + default system hostname). """ def __init__(self, - href: str) -> None: + *, + name: str = None) -> None: """ - Initialize a AddressPrefixCollectionNext object. + Initialize a BareMetalServerPatch object. - :param str href: The URL for a page of resources. + :param str name: (optional) The user-defined name for this bare metal + server (and default system hostname). """ - self.href = href + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'AddressPrefixCollectionNext': - """Initialize a AddressPrefixCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'BareMetalServerPatch': + """Initialize a BareMetalServerPatch object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in AddressPrefixCollectionNext JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a AddressPrefixCollectionNext object from a json dictionary.""" + """Initialize a BareMetalServerPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -16947,72 +21902,185 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this AddressPrefixCollectionNext object.""" + """Return a `str` version of this BareMetalServerPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'AddressPrefixCollectionNext') -> bool: + def __eq__(self, other: 'BareMetalServerPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'AddressPrefixCollectionNext') -> bool: + def __ne__(self, other: 'BareMetalServerPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class AddressPrefixPatch(): +class BareMetalServerPrimaryNetworkInterfacePrototype(): """ - AddressPrefixPatch. + BareMetalServerPrimaryNetworkInterfacePrototype. - :attr bool is_default: (optional) Indicates whether this is the default prefix - for this zone in this VPC. Updating to true makes this prefix the default prefix - for this zone in this VPC, provided the VPC currently has no default address - prefix for this zone. Updating to false removes the default prefix for this zone - in this VPC. - :attr str name: (optional) The user-defined name for this address prefix. Names - must be unique within the VPC the address prefix resides in. + :attr bool allow_ip_spoofing: (optional) Indicates whether source IP spoofing is + allowed on this interface. If false, source IP spoofing is prevented on this + interface. If true, source IP spoofing is allowed on this interface. + :attr List[int] allowed_vlans: (optional) Indicates what VLAN IDs (for VLAN type + only) can use this physical (PCI type) interface. A given VLAN can only be in + the `allowed_vlans` array for one PCI type adapter per bare metal server. + :attr bool enable_infrastructure_nat: (optional) If `true`: + - The VPC infrastructure performs any needed NAT operations. + - A single floating IP can be assigned to the network interface. + If `false`: + - Packets are passed unmodified to/from the network interface, + allowing the workload to perform any needed NAT operations. + - Multiple floating IPs can be assigned to the network interface. + - `allow_ip_spoofing` must be set to `false`. + :attr str interface_type: (optional) The network interface type: + - `pci`: a physical PCI device which can only be created or deleted when the + bare metal + server is stopped + - Has an `allowed_vlans` property which controls the VLANs that will be + permitted + to use the PCI interface + - Cannot directly use an IEEE 802.1q VLAN tag. + :attr str name: (optional) The user-defined name for network interface. Names + must be unique within the instance the network interface resides in. If + unspecified, the name will be a hyphenated list of randomly-selected words. + :attr NetworkInterfaceIPPrototype primary_ip: (optional) The primary IP address + to bind to the network interface. This can be specified using + an existing reserved IP, or a prototype object for a new reserved IP. + If an existing reserved IP or a prototype object with an address is specified, + it must + be available on the network interface's subnet. Otherwise, an available address + on the + subnet will be automatically selected and reserved. + :attr List[SecurityGroupIdentity] security_groups: (optional) The security + groups to use for this network interface. If unspecified, the VPC's default + security group is used. + :attr SubnetIdentity subnet: The associated subnet. """ def __init__(self, + subnet: 'SubnetIdentity', *, - is_default: bool = None, - name: str = None) -> None: + allow_ip_spoofing: bool = None, + allowed_vlans: List[int] = None, + enable_infrastructure_nat: bool = None, + interface_type: str = None, + name: str = None, + primary_ip: 'NetworkInterfaceIPPrototype' = None, + security_groups: List['SecurityGroupIdentity'] = None) -> None: """ - Initialize a AddressPrefixPatch object. + Initialize a BareMetalServerPrimaryNetworkInterfacePrototype object. - :param bool is_default: (optional) Indicates whether this is the default - prefix for this zone in this VPC. Updating to true makes this prefix the - default prefix for this zone in this VPC, provided the VPC currently has no - default address prefix for this zone. Updating to false removes the default - prefix for this zone in this VPC. - :param str name: (optional) The user-defined name for this address prefix. - Names must be unique within the VPC the address prefix resides in. + :param SubnetIdentity subnet: The associated subnet. + :param bool allow_ip_spoofing: (optional) Indicates whether source IP + spoofing is allowed on this interface. If false, source IP spoofing is + prevented on this interface. If true, source IP spoofing is allowed on this + interface. + :param List[int] allowed_vlans: (optional) Indicates what VLAN IDs (for + VLAN type only) can use this physical (PCI type) interface. A given VLAN + can only be in the `allowed_vlans` array for one PCI type adapter per bare + metal server. + :param bool enable_infrastructure_nat: (optional) If `true`: + - The VPC infrastructure performs any needed NAT operations. + - A single floating IP can be assigned to the network interface. + If `false`: + - Packets are passed unmodified to/from the network interface, + allowing the workload to perform any needed NAT operations. + - Multiple floating IPs can be assigned to the network interface. + - `allow_ip_spoofing` must be set to `false`. + :param str interface_type: (optional) The network interface type: + - `pci`: a physical PCI device which can only be created or deleted when + the bare metal + server is stopped + - Has an `allowed_vlans` property which controls the VLANs that will be + permitted + to use the PCI interface + - Cannot directly use an IEEE 802.1q VLAN tag. + :param str name: (optional) The user-defined name for network interface. + Names must be unique within the instance the network interface resides in. + If unspecified, the name will be a hyphenated list of randomly-selected + words. + :param NetworkInterfaceIPPrototype primary_ip: (optional) The primary IP + address to bind to the network interface. This can be specified using + an existing reserved IP, or a prototype object for a new reserved IP. + If an existing reserved IP or a prototype object with an address is + specified, it must + be available on the network interface's subnet. Otherwise, an available + address on the + subnet will be automatically selected and reserved. + :param List[SecurityGroupIdentity] security_groups: (optional) The security + groups to use for this network interface. If unspecified, the VPC's default + security group is used. """ - self.is_default = is_default + self.allow_ip_spoofing = allow_ip_spoofing + self.allowed_vlans = allowed_vlans + self.enable_infrastructure_nat = enable_infrastructure_nat + self.interface_type = interface_type self.name = name + self.primary_ip = primary_ip + self.security_groups = security_groups + self.subnet = subnet @classmethod - def from_dict(cls, _dict: Dict) -> 'AddressPrefixPatch': - """Initialize a AddressPrefixPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'BareMetalServerPrimaryNetworkInterfacePrototype': + """Initialize a BareMetalServerPrimaryNetworkInterfacePrototype object from a json dictionary.""" args = {} - if 'is_default' in _dict: - args['is_default'] = _dict.get('is_default') + if 'allow_ip_spoofing' in _dict: + args['allow_ip_spoofing'] = _dict.get('allow_ip_spoofing') + if 'allowed_vlans' in _dict: + args['allowed_vlans'] = _dict.get('allowed_vlans') + if 'enable_infrastructure_nat' in _dict: + args['enable_infrastructure_nat'] = _dict.get('enable_infrastructure_nat') + if 'interface_type' in _dict: + args['interface_type'] = _dict.get('interface_type') if 'name' in _dict: args['name'] = _dict.get('name') + if 'primary_ip' in _dict: + args['primary_ip'] = _dict.get('primary_ip') + if 'security_groups' in _dict: + args['security_groups'] = _dict.get('security_groups') + if 'subnet' in _dict: + args['subnet'] = _dict.get('subnet') + else: + raise ValueError('Required property \'subnet\' not present in BareMetalServerPrimaryNetworkInterfacePrototype JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a AddressPrefixPatch object from a json dictionary.""" + """Initialize a BareMetalServerPrimaryNetworkInterfacePrototype object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'is_default') and self.is_default is not None: - _dict['is_default'] = self.is_default + if hasattr(self, 'allow_ip_spoofing') and self.allow_ip_spoofing is not None: + _dict['allow_ip_spoofing'] = self.allow_ip_spoofing + if hasattr(self, 'allowed_vlans') and self.allowed_vlans is not None: + _dict['allowed_vlans'] = self.allowed_vlans + if hasattr(self, 'enable_infrastructure_nat') and self.enable_infrastructure_nat is not None: + _dict['enable_infrastructure_nat'] = self.enable_infrastructure_nat + if hasattr(self, 'interface_type') and self.interface_type is not None: + _dict['interface_type'] = self.interface_type if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name + if hasattr(self, 'primary_ip') and self.primary_ip is not None: + if isinstance(self.primary_ip, dict): + _dict['primary_ip'] = self.primary_ip + else: + _dict['primary_ip'] = self.primary_ip.to_dict() + if hasattr(self, 'security_groups') and self.security_groups is not None: + security_groups_list = [] + for x in self.security_groups: + if isinstance(x, dict): + security_groups_list.append(x) + else: + security_groups_list.append(x.to_dict()) + _dict['security_groups'] = security_groups_list + if hasattr(self, 'subnet') and self.subnet is not None: + if isinstance(self.subnet, dict): + _dict['subnet'] = self.subnet + else: + _dict['subnet'] = self.subnet.to_dict() return _dict def _to_dict(self): @@ -17020,293 +22088,198 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this AddressPrefixPatch object.""" + """Return a `str` version of this BareMetalServerPrimaryNetworkInterfacePrototype object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'AddressPrefixPatch') -> bool: + def __eq__(self, other: 'BareMetalServerPrimaryNetworkInterfacePrototype') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'AddressPrefixPatch') -> bool: + def __ne__(self, other: 'BareMetalServerPrimaryNetworkInterfacePrototype') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class BareMetalServer(): + class InterfaceTypeEnum(str, Enum): + """ + The network interface type: + - `pci`: a physical PCI device which can only be created or deleted when the bare + metal + server is stopped + - Has an `allowed_vlans` property which controls the VLANs that will be + permitted + to use the PCI interface + - Cannot directly use an IEEE 802.1q VLAN tag. + """ + PCI = 'pci' + + +class BareMetalServerProfile(): """ - BareMetalServer. + BareMetalServerProfile. - :attr int bandwidth: The total bandwidth (in megabits per second) shared across - the bare metal server's network interfaces. - :attr BareMetalServerBootTarget boot_target: The possible resource types for - this property are expected to expand in the future. - :attr BareMetalServerCPU cpu: The bare metal server CPU configuration. - :attr datetime created_at: The date and time that the bare metal server was - created. - :attr str crn: The CRN for this bare metal server. - :attr List[BareMetalServerDisk] disks: The disks for this bare metal server, - including any disks that are associated with the - `boot_target`. - :attr bool enable_secure_boot: Indicates whether secure boot is enabled. If - enabled, the image must support secure boot or the server will fail to boot. - :attr str href: The URL for this bare metal server. - :attr str id: The unique identifier for this bare metal server. - :attr int memory: The amount of memory, truncated to whole gibibytes. - :attr str name: The user-defined name for this bare metal server (and default - system hostname). - :attr List[NetworkInterfaceBareMetalServerContextReference] network_interfaces: - The network interfaces for this bare metal server, including the primary network - interface. - :attr NetworkInterfaceBareMetalServerContextReference primary_network_interface: - Primary network interface. - :attr BareMetalServerProfileReference profile: The profile this bare metal - server uses. - :attr ResourceGroupReference resource_group: The resource group for this bare - metal server. + :attr BareMetalServerProfileBandwidth bandwidth: + :attr BareMetalServerProfileCPUArchitecture cpu_architecture: + :attr BareMetalServerProfileCPUCoreCount cpu_core_count: + :attr BareMetalServerProfileCPUSocketCount cpu_socket_count: + :attr List[BareMetalServerProfileDisk] disks: Collection of the bare metal + server profile's disks. + :attr str family: The product family this bare metal server profile belongs to. + :attr str href: The URL for this bare metal server profile. + :attr BareMetalServerProfileMemory memory: + :attr str name: The name for this bare metal server profile. + :attr BareMetalServerProfileOSArchitecture os_architecture: :attr str resource_type: The resource type. - :attr str status: The status of the bare metal server. - :attr List[BareMetalServerStatusReason] status_reasons: The reasons for the - current status (if any). - The enumerated reason code values for this property will expand in the future. - When processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the resource on which the unexpected - reason code was encountered. - :attr BareMetalServerTrustedPlatformModule trusted_platform_module: - :attr VPCReference vpc: The VPC this bare metal server resides in. - :attr ZoneReference zone: The zone this bare metal server resides in. + :attr BareMetalServerProfileSupportedTrustedPlatformModuleModes + supported_trusted_platform_module_modes: The supported trusted platform module + (TPM) modes for this bare metal server profile. """ def __init__(self, - bandwidth: int, - boot_target: 'BareMetalServerBootTarget', - cpu: 'BareMetalServerCPU', - created_at: datetime, - crn: str, - disks: List['BareMetalServerDisk'], - enable_secure_boot: bool, + bandwidth: 'BareMetalServerProfileBandwidth', + cpu_architecture: 'BareMetalServerProfileCPUArchitecture', + cpu_core_count: 'BareMetalServerProfileCPUCoreCount', + cpu_socket_count: 'BareMetalServerProfileCPUSocketCount', + disks: List['BareMetalServerProfileDisk'], + family: str, href: str, - id: str, - memory: int, + memory: 'BareMetalServerProfileMemory', name: str, - network_interfaces: List['NetworkInterfaceBareMetalServerContextReference'], - primary_network_interface: 'NetworkInterfaceBareMetalServerContextReference', - profile: 'BareMetalServerProfileReference', - resource_group: 'ResourceGroupReference', + os_architecture: 'BareMetalServerProfileOSArchitecture', resource_type: str, - status: str, - status_reasons: List['BareMetalServerStatusReason'], - trusted_platform_module: 'BareMetalServerTrustedPlatformModule', - vpc: 'VPCReference', - zone: 'ZoneReference') -> None: + supported_trusted_platform_module_modes: 'BareMetalServerProfileSupportedTrustedPlatformModuleModes') -> None: """ - Initialize a BareMetalServer object. + Initialize a BareMetalServerProfile object. - :param int bandwidth: The total bandwidth (in megabits per second) shared - across the bare metal server's network interfaces. - :param BareMetalServerBootTarget boot_target: The possible resource types - for this property are expected to expand in the future. - :param BareMetalServerCPU cpu: The bare metal server CPU configuration. - :param datetime created_at: The date and time that the bare metal server - was created. - :param str crn: The CRN for this bare metal server. - :param List[BareMetalServerDisk] disks: The disks for this bare metal - server, including any disks that are associated with the - `boot_target`. - :param bool enable_secure_boot: Indicates whether secure boot is enabled. - If enabled, the image must support secure boot or the server will fail to - boot. - :param str href: The URL for this bare metal server. - :param str id: The unique identifier for this bare metal server. - :param int memory: The amount of memory, truncated to whole gibibytes. - :param str name: The user-defined name for this bare metal server (and - default system hostname). - :param List[NetworkInterfaceBareMetalServerContextReference] - network_interfaces: The network interfaces for this bare metal server, - including the primary network interface. - :param NetworkInterfaceBareMetalServerContextReference - primary_network_interface: Primary network interface. - :param BareMetalServerProfileReference profile: The profile this bare metal - server uses. - :param ResourceGroupReference resource_group: The resource group for this - bare metal server. + :param BareMetalServerProfileBandwidth bandwidth: + :param BareMetalServerProfileCPUArchitecture cpu_architecture: + :param BareMetalServerProfileCPUCoreCount cpu_core_count: + :param BareMetalServerProfileCPUSocketCount cpu_socket_count: + :param List[BareMetalServerProfileDisk] disks: Collection of the bare metal + server profile's disks. + :param str family: The product family this bare metal server profile + belongs to. + :param str href: The URL for this bare metal server profile. + :param BareMetalServerProfileMemory memory: + :param str name: The name for this bare metal server profile. + :param BareMetalServerProfileOSArchitecture os_architecture: :param str resource_type: The resource type. - :param str status: The status of the bare metal server. - :param List[BareMetalServerStatusReason] status_reasons: The reasons for - the current status (if any). - The enumerated reason code values for this property will expand in the - future. When processing this property, check for and log unknown values. - Optionally halt processing and surface the error, or bypass the resource on - which the unexpected reason code was encountered. - :param BareMetalServerTrustedPlatformModule trusted_platform_module: - :param VPCReference vpc: The VPC this bare metal server resides in. - :param ZoneReference zone: The zone this bare metal server resides in. + :param BareMetalServerProfileSupportedTrustedPlatformModuleModes + supported_trusted_platform_module_modes: The supported trusted platform + module (TPM) modes for this bare metal server profile. """ self.bandwidth = bandwidth - self.boot_target = boot_target - self.cpu = cpu - self.created_at = created_at - self.crn = crn + self.cpu_architecture = cpu_architecture + self.cpu_core_count = cpu_core_count + self.cpu_socket_count = cpu_socket_count self.disks = disks - self.enable_secure_boot = enable_secure_boot + self.family = family self.href = href - self.id = id self.memory = memory self.name = name - self.network_interfaces = network_interfaces - self.primary_network_interface = primary_network_interface - self.profile = profile - self.resource_group = resource_group + self.os_architecture = os_architecture self.resource_type = resource_type - self.status = status - self.status_reasons = status_reasons - self.trusted_platform_module = trusted_platform_module - self.vpc = vpc - self.zone = zone + self.supported_trusted_platform_module_modes = supported_trusted_platform_module_modes @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServer': - """Initialize a BareMetalServer object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'BareMetalServerProfile': + """Initialize a BareMetalServerProfile object from a json dictionary.""" args = {} - if 'bandwidth' in _dict: - args['bandwidth'] = _dict.get('bandwidth') - else: - raise ValueError('Required property \'bandwidth\' not present in BareMetalServer JSON') - if 'boot_target' in _dict: - args['boot_target'] = _dict.get('boot_target') + if 'bandwidth' in _dict: + args['bandwidth'] = _dict.get('bandwidth') else: - raise ValueError('Required property \'boot_target\' not present in BareMetalServer JSON') - if 'cpu' in _dict: - args['cpu'] = BareMetalServerCPU.from_dict(_dict.get('cpu')) + raise ValueError('Required property \'bandwidth\' not present in BareMetalServerProfile JSON') + if 'cpu_architecture' in _dict: + args['cpu_architecture'] = BareMetalServerProfileCPUArchitecture.from_dict(_dict.get('cpu_architecture')) else: - raise ValueError('Required property \'cpu\' not present in BareMetalServer JSON') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) + raise ValueError('Required property \'cpu_architecture\' not present in BareMetalServerProfile JSON') + if 'cpu_core_count' in _dict: + args['cpu_core_count'] = _dict.get('cpu_core_count') else: - raise ValueError('Required property \'created_at\' not present in BareMetalServer JSON') - if 'crn' in _dict: - args['crn'] = _dict.get('crn') + raise ValueError('Required property \'cpu_core_count\' not present in BareMetalServerProfile JSON') + if 'cpu_socket_count' in _dict: + args['cpu_socket_count'] = _dict.get('cpu_socket_count') else: - raise ValueError('Required property \'crn\' not present in BareMetalServer JSON') + raise ValueError('Required property \'cpu_socket_count\' not present in BareMetalServerProfile JSON') if 'disks' in _dict: - args['disks'] = [BareMetalServerDisk.from_dict(x) for x in _dict.get('disks')] + args['disks'] = [BareMetalServerProfileDisk.from_dict(x) for x in _dict.get('disks')] else: - raise ValueError('Required property \'disks\' not present in BareMetalServer JSON') - if 'enable_secure_boot' in _dict: - args['enable_secure_boot'] = _dict.get('enable_secure_boot') + raise ValueError('Required property \'disks\' not present in BareMetalServerProfile JSON') + if 'family' in _dict: + args['family'] = _dict.get('family') else: - raise ValueError('Required property \'enable_secure_boot\' not present in BareMetalServer JSON') + raise ValueError('Required property \'family\' not present in BareMetalServerProfile JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in BareMetalServer JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in BareMetalServer JSON') + raise ValueError('Required property \'href\' not present in BareMetalServerProfile JSON') if 'memory' in _dict: args['memory'] = _dict.get('memory') else: - raise ValueError('Required property \'memory\' not present in BareMetalServer JSON') + raise ValueError('Required property \'memory\' not present in BareMetalServerProfile JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in BareMetalServer JSON') - if 'network_interfaces' in _dict: - args['network_interfaces'] = [NetworkInterfaceBareMetalServerContextReference.from_dict(x) for x in _dict.get('network_interfaces')] - else: - raise ValueError('Required property \'network_interfaces\' not present in BareMetalServer JSON') - if 'primary_network_interface' in _dict: - args['primary_network_interface'] = NetworkInterfaceBareMetalServerContextReference.from_dict(_dict.get('primary_network_interface')) - else: - raise ValueError('Required property \'primary_network_interface\' not present in BareMetalServer JSON') - if 'profile' in _dict: - args['profile'] = BareMetalServerProfileReference.from_dict(_dict.get('profile')) - else: - raise ValueError('Required property \'profile\' not present in BareMetalServer JSON') - if 'resource_group' in _dict: - args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) + raise ValueError('Required property \'name\' not present in BareMetalServerProfile JSON') + if 'os_architecture' in _dict: + args['os_architecture'] = BareMetalServerProfileOSArchitecture.from_dict(_dict.get('os_architecture')) else: - raise ValueError('Required property \'resource_group\' not present in BareMetalServer JSON') + raise ValueError('Required property \'os_architecture\' not present in BareMetalServerProfile JSON') if 'resource_type' in _dict: args['resource_type'] = _dict.get('resource_type') else: - raise ValueError('Required property \'resource_type\' not present in BareMetalServer JSON') - if 'status' in _dict: - args['status'] = _dict.get('status') - else: - raise ValueError('Required property \'status\' not present in BareMetalServer JSON') - if 'status_reasons' in _dict: - args['status_reasons'] = [BareMetalServerStatusReason.from_dict(x) for x in _dict.get('status_reasons')] - else: - raise ValueError('Required property \'status_reasons\' not present in BareMetalServer JSON') - if 'trusted_platform_module' in _dict: - args['trusted_platform_module'] = BareMetalServerTrustedPlatformModule.from_dict(_dict.get('trusted_platform_module')) - else: - raise ValueError('Required property \'trusted_platform_module\' not present in BareMetalServer JSON') - if 'vpc' in _dict: - args['vpc'] = VPCReference.from_dict(_dict.get('vpc')) - else: - raise ValueError('Required property \'vpc\' not present in BareMetalServer JSON') - if 'zone' in _dict: - args['zone'] = ZoneReference.from_dict(_dict.get('zone')) + raise ValueError('Required property \'resource_type\' not present in BareMetalServerProfile JSON') + if 'supported_trusted_platform_module_modes' in _dict: + args['supported_trusted_platform_module_modes'] = BareMetalServerProfileSupportedTrustedPlatformModuleModes.from_dict(_dict.get('supported_trusted_platform_module_modes')) else: - raise ValueError('Required property \'zone\' not present in BareMetalServer JSON') + raise ValueError('Required property \'supported_trusted_platform_module_modes\' not present in BareMetalServerProfile JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServer object from a json dictionary.""" + """Initialize a BareMetalServerProfile object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'bandwidth') and self.bandwidth is not None: - _dict['bandwidth'] = self.bandwidth - if hasattr(self, 'boot_target') and self.boot_target is not None: - if isinstance(self.boot_target, dict): - _dict['boot_target'] = self.boot_target + if isinstance(self.bandwidth, dict): + _dict['bandwidth'] = self.bandwidth else: - _dict['boot_target'] = self.boot_target.to_dict() - if hasattr(self, 'cpu') and self.cpu is not None: - _dict['cpu'] = self.cpu.to_dict() - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn + _dict['bandwidth'] = self.bandwidth.to_dict() + if hasattr(self, 'cpu_architecture') and self.cpu_architecture is not None: + _dict['cpu_architecture'] = self.cpu_architecture.to_dict() + if hasattr(self, 'cpu_core_count') and self.cpu_core_count is not None: + if isinstance(self.cpu_core_count, dict): + _dict['cpu_core_count'] = self.cpu_core_count + else: + _dict['cpu_core_count'] = self.cpu_core_count.to_dict() + if hasattr(self, 'cpu_socket_count') and self.cpu_socket_count is not None: + if isinstance(self.cpu_socket_count, dict): + _dict['cpu_socket_count'] = self.cpu_socket_count + else: + _dict['cpu_socket_count'] = self.cpu_socket_count.to_dict() if hasattr(self, 'disks') and self.disks is not None: _dict['disks'] = [x.to_dict() for x in self.disks] - if hasattr(self, 'enable_secure_boot') and self.enable_secure_boot is not None: - _dict['enable_secure_boot'] = self.enable_secure_boot + if hasattr(self, 'family') and self.family is not None: + _dict['family'] = self.family if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id if hasattr(self, 'memory') and self.memory is not None: - _dict['memory'] = self.memory + if isinstance(self.memory, dict): + _dict['memory'] = self.memory + else: + _dict['memory'] = self.memory.to_dict() if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'network_interfaces') and self.network_interfaces is not None: - _dict['network_interfaces'] = [x.to_dict() for x in self.network_interfaces] - if hasattr(self, 'primary_network_interface') and self.primary_network_interface is not None: - _dict['primary_network_interface'] = self.primary_network_interface.to_dict() - if hasattr(self, 'profile') and self.profile is not None: - _dict['profile'] = self.profile.to_dict() - if hasattr(self, 'resource_group') and self.resource_group is not None: - _dict['resource_group'] = self.resource_group.to_dict() + if hasattr(self, 'os_architecture') and self.os_architecture is not None: + _dict['os_architecture'] = self.os_architecture.to_dict() if hasattr(self, 'resource_type') and self.resource_type is not None: _dict['resource_type'] = self.resource_type - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status - if hasattr(self, 'status_reasons') and self.status_reasons is not None: - _dict['status_reasons'] = [x.to_dict() for x in self.status_reasons] - if hasattr(self, 'trusted_platform_module') and self.trusted_platform_module is not None: - _dict['trusted_platform_module'] = self.trusted_platform_module.to_dict() - if hasattr(self, 'vpc') and self.vpc is not None: - _dict['vpc'] = self.vpc.to_dict() - if hasattr(self, 'zone') and self.zone is not None: - _dict['zone'] = self.zone.to_dict() + if hasattr(self, 'supported_trusted_platform_module_modes') and self.supported_trusted_platform_module_modes is not None: + _dict['supported_trusted_platform_module_modes'] = self.supported_trusted_platform_module_modes.to_dict() return _dict def _to_dict(self): @@ -17314,16 +22287,16 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServer object.""" + """Return a `str` version of this BareMetalServerProfile object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServer') -> bool: + def __eq__(self, other: 'BareMetalServerProfile') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServer') -> bool: + def __ne__(self, other: 'BareMetalServerProfile') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other @@ -17331,104 +22304,82 @@ class ResourceTypeEnum(str, Enum): """ The resource type. """ - BARE_METAL_SERVER = 'bare_metal_server' - - - class StatusEnum(str, Enum): - """ - The status of the bare metal server. - """ - FAILED = 'failed' - MAINTENANCE = 'maintenance' - PENDING = 'pending' - RESTARTING = 'restarting' - RUNNING = 'running' - STARTING = 'starting' - STOPPED = 'stopped' - STOPPING = 'stopping' + BARE_METAL_SERVER_PROFILE = 'bare_metal_server_profile' -class BareMetalServerBootTarget(): +class BareMetalServerProfileBandwidth(): """ - The possible resource types for this property are expected to expand in the future. + BareMetalServerProfileBandwidth. """ def __init__(self) -> None: """ - Initialize a BareMetalServerBootTarget object. + Initialize a BareMetalServerProfileBandwidth object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['BareMetalServerBootTargetBareMetalServerDiskReference'])) + ", ".join(['BareMetalServerProfileBandwidthFixed', 'BareMetalServerProfileBandwidthRange', 'BareMetalServerProfileBandwidthEnum', 'BareMetalServerProfileBandwidthDependent'])) raise Exception(msg) -class BareMetalServerCPU(): +class BareMetalServerProfileCPUArchitecture(): """ - The bare metal server CPU configuration. + BareMetalServerProfileCPUArchitecture. - :attr str architecture: The CPU architecture. - :attr int core_count: The total number of cores. - :attr int socket_count: The total number of CPU sockets. - :attr int threads_per_core: The total number of hardware threads per core. + :attr str default: (optional) The default CPU architecture for a bare metal + server with this profile. + :attr str type: The type for this profile field. + :attr str value: The CPU architecture for a bare metal server with this profile. """ def __init__(self, - architecture: str, - core_count: int, - socket_count: int, - threads_per_core: int) -> None: + type: str, + value: str, + *, + default: str = None) -> None: """ - Initialize a BareMetalServerCPU object. + Initialize a BareMetalServerProfileCPUArchitecture object. - :param str architecture: The CPU architecture. - :param int core_count: The total number of cores. - :param int socket_count: The total number of CPU sockets. - :param int threads_per_core: The total number of hardware threads per core. + :param str type: The type for this profile field. + :param str value: The CPU architecture for a bare metal server with this + profile. + :param str default: (optional) The default CPU architecture for a bare + metal server with this profile. """ - self.architecture = architecture - self.core_count = core_count - self.socket_count = socket_count - self.threads_per_core = threads_per_core + self.default = default + self.type = type + self.value = value @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerCPU': - """Initialize a BareMetalServerCPU object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'BareMetalServerProfileCPUArchitecture': + """Initialize a BareMetalServerProfileCPUArchitecture object from a json dictionary.""" args = {} - if 'architecture' in _dict: - args['architecture'] = _dict.get('architecture') - else: - raise ValueError('Required property \'architecture\' not present in BareMetalServerCPU JSON') - if 'core_count' in _dict: - args['core_count'] = _dict.get('core_count') - else: - raise ValueError('Required property \'core_count\' not present in BareMetalServerCPU JSON') - if 'socket_count' in _dict: - args['socket_count'] = _dict.get('socket_count') + if 'default' in _dict: + args['default'] = _dict.get('default') + if 'type' in _dict: + args['type'] = _dict.get('type') else: - raise ValueError('Required property \'socket_count\' not present in BareMetalServerCPU JSON') - if 'threads_per_core' in _dict: - args['threads_per_core'] = _dict.get('threads_per_core') + raise ValueError('Required property \'type\' not present in BareMetalServerProfileCPUArchitecture JSON') + if 'value' in _dict: + args['value'] = _dict.get('value') else: - raise ValueError('Required property \'threads_per_core\' not present in BareMetalServerCPU JSON') + raise ValueError('Required property \'value\' not present in BareMetalServerProfileCPUArchitecture JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerCPU object from a json dictionary.""" + """Initialize a BareMetalServerProfileCPUArchitecture object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'architecture') and self.architecture is not None: - _dict['architecture'] = self.architecture - if hasattr(self, 'core_count') and self.core_count is not None: - _dict['core_count'] = self.core_count - if hasattr(self, 'socket_count') and self.socket_count is not None: - _dict['socket_count'] = self.socket_count - if hasattr(self, 'threads_per_core') and self.threads_per_core is not None: - _dict['threads_per_core'] = self.threads_per_core + if hasattr(self, 'default') and self.default is not None: + _dict['default'] = self.default + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'value') and self.value is not None: + _dict['value'] = self.value return _dict def _to_dict(self): @@ -17436,102 +22387,139 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerCPU object.""" + """Return a `str` version of this BareMetalServerProfileCPUArchitecture object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerCPU') -> bool: + def __eq__(self, other: 'BareMetalServerProfileCPUArchitecture') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerCPU') -> bool: + def __ne__(self, other: 'BareMetalServerProfileCPUArchitecture') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class BareMetalServerCollection(): + class TypeEnum(str, Enum): + """ + The type for this profile field. + """ + FIXED = 'fixed' + + +class BareMetalServerProfileCPUCoreCount(): """ - BareMetalServerCollection. + BareMetalServerProfileCPUCoreCount. - :attr List[BareMetalServer] bare_metal_servers: Collection of bare metal - servers. - :attr BareMetalServerCollectionFirst first: A link to the first page of + """ + + def __init__(self) -> None: + """ + Initialize a BareMetalServerProfileCPUCoreCount object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['BareMetalServerProfileCPUCoreCountFixed', 'BareMetalServerProfileCPUCoreCountRange', 'BareMetalServerProfileCPUCoreCountEnum', 'BareMetalServerProfileCPUCoreCountDependent'])) + raise Exception(msg) + +class BareMetalServerProfileCPUSocketCount(): + """ + BareMetalServerProfileCPUSocketCount. + + """ + + def __init__(self) -> None: + """ + Initialize a BareMetalServerProfileCPUSocketCount object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['BareMetalServerProfileCPUSocketCountFixed', 'BareMetalServerProfileCPUSocketCountRange', 'BareMetalServerProfileCPUSocketCountEnum', 'BareMetalServerProfileCPUSocketCountDependent'])) + raise Exception(msg) + +class BareMetalServerProfileCollection(): + """ + BareMetalServerProfileCollection. + + :attr BareMetalServerProfileCollectionFirst first: A link to the first page of resources. :attr int limit: The maximum number of resources that can be returned by the request. - :attr BareMetalServerCollectionNext next: (optional) A link to the next page of - resources. This property is present for all pages + :attr BareMetalServerProfileCollectionNext next: (optional) A link to the next + page of resources. This property is present for all pages except the last page. + :attr List[BareMetalServerProfile] profiles: Collection of bare metal server + profiles. :attr int total_count: The total number of resources across all pages. """ def __init__(self, - bare_metal_servers: List['BareMetalServer'], - first: 'BareMetalServerCollectionFirst', + first: 'BareMetalServerProfileCollectionFirst', limit: int, + profiles: List['BareMetalServerProfile'], total_count: int, *, - next: 'BareMetalServerCollectionNext' = None) -> None: + next: 'BareMetalServerProfileCollectionNext' = None) -> None: """ - Initialize a BareMetalServerCollection object. + Initialize a BareMetalServerProfileCollection object. - :param List[BareMetalServer] bare_metal_servers: Collection of bare metal - servers. - :param BareMetalServerCollectionFirst first: A link to the first page of - resources. + :param BareMetalServerProfileCollectionFirst first: A link to the first + page of resources. :param int limit: The maximum number of resources that can be returned by the request. + :param List[BareMetalServerProfile] profiles: Collection of bare metal + server profiles. :param int total_count: The total number of resources across all pages. - :param BareMetalServerCollectionNext next: (optional) A link to the next - page of resources. This property is present for all pages + :param BareMetalServerProfileCollectionNext next: (optional) A link to the + next page of resources. This property is present for all pages except the last page. """ - self.bare_metal_servers = bare_metal_servers self.first = first self.limit = limit self.next = next + self.profiles = profiles self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerCollection': - """Initialize a BareMetalServerCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'BareMetalServerProfileCollection': + """Initialize a BareMetalServerProfileCollection object from a json dictionary.""" args = {} - if 'bare_metal_servers' in _dict: - args['bare_metal_servers'] = [BareMetalServer.from_dict(x) for x in _dict.get('bare_metal_servers')] - else: - raise ValueError('Required property \'bare_metal_servers\' not present in BareMetalServerCollection JSON') if 'first' in _dict: - args['first'] = BareMetalServerCollectionFirst.from_dict(_dict.get('first')) + args['first'] = BareMetalServerProfileCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'first\' not present in BareMetalServerCollection JSON') + raise ValueError('Required property \'first\' not present in BareMetalServerProfileCollection JSON') if 'limit' in _dict: args['limit'] = _dict.get('limit') else: - raise ValueError('Required property \'limit\' not present in BareMetalServerCollection JSON') + raise ValueError('Required property \'limit\' not present in BareMetalServerProfileCollection JSON') if 'next' in _dict: - args['next'] = BareMetalServerCollectionNext.from_dict(_dict.get('next')) + args['next'] = BareMetalServerProfileCollectionNext.from_dict(_dict.get('next')) + if 'profiles' in _dict: + args['profiles'] = [BareMetalServerProfile.from_dict(x) for x in _dict.get('profiles')] + else: + raise ValueError('Required property \'profiles\' not present in BareMetalServerProfileCollection JSON') if 'total_count' in _dict: args['total_count'] = _dict.get('total_count') else: - raise ValueError('Required property \'total_count\' not present in BareMetalServerCollection JSON') + raise ValueError('Required property \'total_count\' not present in BareMetalServerProfileCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerCollection object from a json dictionary.""" + """Initialize a BareMetalServerProfileCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'bare_metal_servers') and self.bare_metal_servers is not None: - _dict['bare_metal_servers'] = [x.to_dict() for x in self.bare_metal_servers] if hasattr(self, 'first') and self.first is not None: _dict['first'] = self.first.to_dict() if hasattr(self, 'limit') and self.limit is not None: _dict['limit'] = self.limit if hasattr(self, 'next') and self.next is not None: _dict['next'] = self.next.to_dict() + if hasattr(self, 'profiles') and self.profiles is not None: + _dict['profiles'] = [x.to_dict() for x in self.profiles] if hasattr(self, 'total_count') and self.total_count is not None: _dict['total_count'] = self.total_count return _dict @@ -17541,20 +22529,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerCollection object.""" + """Return a `str` version of this BareMetalServerProfileCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerCollection') -> bool: + def __eq__(self, other: 'BareMetalServerProfileCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerCollection') -> bool: + def __ne__(self, other: 'BareMetalServerProfileCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class BareMetalServerCollectionFirst(): +class BareMetalServerProfileCollectionFirst(): """ A link to the first page of resources. @@ -17564,203 +22552,30 @@ class BareMetalServerCollectionFirst(): def __init__(self, href: str) -> None: """ - Initialize a BareMetalServerCollectionFirst object. - - :param str href: The URL for a page of resources. - """ - self.href = href - - @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerCollectionFirst': - """Initialize a BareMetalServerCollectionFirst object from a json dictionary.""" - args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in BareMetalServerCollectionFirst JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a BareMetalServerCollectionFirst object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this BareMetalServerCollectionFirst object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'BareMetalServerCollectionFirst') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'BareMetalServerCollectionFirst') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - -class BareMetalServerCollectionNext(): - """ - A link to the next page of resources. This property is present for all pages except - the last page. - - :attr str href: The URL for a page of resources. - """ - - def __init__(self, - href: str) -> None: - """ - Initialize a BareMetalServerCollectionNext object. - - :param str href: The URL for a page of resources. - """ - self.href = href - - @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerCollectionNext': - """Initialize a BareMetalServerCollectionNext object from a json dictionary.""" - args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in BareMetalServerCollectionNext JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a BareMetalServerCollectionNext object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this BareMetalServerCollectionNext object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'BareMetalServerCollectionNext') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'BareMetalServerCollectionNext') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - -class BareMetalServerConsoleAccessToken(): - """ - The bare metal server console access token information. - - :attr str access_token: A URL safe single-use token used to access the console - WebSocket. - :attr str console_type: The bare metal server console type for which this token - may be used. - :attr datetime created_at: The date and time that the access token was created. - :attr datetime expires_at: The date and time that the access token will expire. - :attr bool force: Indicates whether to disconnect an existing serial console - session as the serial console cannot be shared. This has no effect on VNC - consoles. - :attr str href: The URL to access this bare metal server console. - """ - - def __init__(self, - access_token: str, - console_type: str, - created_at: datetime, - expires_at: datetime, - force: bool, - href: str) -> None: - """ - Initialize a BareMetalServerConsoleAccessToken object. - - :param str access_token: A URL safe single-use token used to access the - console WebSocket. - :param str console_type: The bare metal server console type for which this - token may be used. - :param datetime created_at: The date and time that the access token was - created. - :param datetime expires_at: The date and time that the access token will - expire. - :param bool force: Indicates whether to disconnect an existing serial - console session as the serial console cannot be shared. This has no effect - on VNC consoles. - :param str href: The URL to access this bare metal server console. + Initialize a BareMetalServerProfileCollectionFirst object. + + :param str href: The URL for a page of resources. """ - self.access_token = access_token - self.console_type = console_type - self.created_at = created_at - self.expires_at = expires_at - self.force = force self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerConsoleAccessToken': - """Initialize a BareMetalServerConsoleAccessToken object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'BareMetalServerProfileCollectionFirst': + """Initialize a BareMetalServerProfileCollectionFirst object from a json dictionary.""" args = {} - if 'access_token' in _dict: - args['access_token'] = _dict.get('access_token') - else: - raise ValueError('Required property \'access_token\' not present in BareMetalServerConsoleAccessToken JSON') - if 'console_type' in _dict: - args['console_type'] = _dict.get('console_type') - else: - raise ValueError('Required property \'console_type\' not present in BareMetalServerConsoleAccessToken JSON') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - else: - raise ValueError('Required property \'created_at\' not present in BareMetalServerConsoleAccessToken JSON') - if 'expires_at' in _dict: - args['expires_at'] = string_to_datetime(_dict.get('expires_at')) - else: - raise ValueError('Required property \'expires_at\' not present in BareMetalServerConsoleAccessToken JSON') - if 'force' in _dict: - args['force'] = _dict.get('force') - else: - raise ValueError('Required property \'force\' not present in BareMetalServerConsoleAccessToken JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in BareMetalServerConsoleAccessToken JSON') + raise ValueError('Required property \'href\' not present in BareMetalServerProfileCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerConsoleAccessToken object from a json dictionary.""" + """Initialize a BareMetalServerProfileCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'access_token') and self.access_token is not None: - _dict['access_token'] = self.access_token - if hasattr(self, 'console_type') and self.console_type is not None: - _dict['console_type'] = self.console_type - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'expires_at') and self.expires_at is not None: - _dict['expires_at'] = datetime_to_string(self.expires_at) - if hasattr(self, 'force') and self.force is not None: - _dict['force'] = self.force if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href return _dict @@ -17770,131 +22585,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerConsoleAccessToken object.""" + """Return a `str` version of this BareMetalServerProfileCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerConsoleAccessToken') -> bool: + def __eq__(self, other: 'BareMetalServerProfileCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerConsoleAccessToken') -> bool: + def __ne__(self, other: 'BareMetalServerProfileCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ConsoleTypeEnum(str, Enum): - """ - The bare metal server console type for which this token may be used. - """ - SERIAL = 'serial' - VNC = 'vnc' - - -class BareMetalServerDisk(): +class BareMetalServerProfileCollectionNext(): """ - BareMetalServerDisk. + A link to the next page of resources. This property is present for all pages except + the last page. - :attr datetime created_at: The date and time that the disk was created. - :attr str href: The URL for this bare metal server disk. - :attr str id: The unique identifier for this bare metal server disk. - :attr str interface_type: The disk interface used for attaching the disk. - The enumerated values for this property are expected to expand in the future. - When processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the resource on which the unexpected - property value was encountered. - :attr str name: The user-defined name for this disk. - :attr str resource_type: The resource type. - :attr int size: The size of the disk in GB (gigabytes). + :attr str href: The URL for a page of resources. """ def __init__(self, - created_at: datetime, - href: str, - id: str, - interface_type: str, - name: str, - resource_type: str, - size: int) -> None: + href: str) -> None: """ - Initialize a BareMetalServerDisk object. + Initialize a BareMetalServerProfileCollectionNext object. - :param datetime created_at: The date and time that the disk was created. - :param str href: The URL for this bare metal server disk. - :param str id: The unique identifier for this bare metal server disk. - :param str interface_type: The disk interface used for attaching the disk. - The enumerated values for this property are expected to expand in the - future. When processing this property, check for and log unknown values. - Optionally halt processing and surface the error, or bypass the resource on - which the unexpected property value was encountered. - :param str name: The user-defined name for this disk. - :param str resource_type: The resource type. - :param int size: The size of the disk in GB (gigabytes). + :param str href: The URL for a page of resources. """ - self.created_at = created_at self.href = href - self.id = id - self.interface_type = interface_type - self.name = name - self.resource_type = resource_type - self.size = size @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerDisk': - """Initialize a BareMetalServerDisk object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'BareMetalServerProfileCollectionNext': + """Initialize a BareMetalServerProfileCollectionNext object from a json dictionary.""" args = {} - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - else: - raise ValueError('Required property \'created_at\' not present in BareMetalServerDisk JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in BareMetalServerDisk JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in BareMetalServerDisk JSON') - if 'interface_type' in _dict: - args['interface_type'] = _dict.get('interface_type') - else: - raise ValueError('Required property \'interface_type\' not present in BareMetalServerDisk JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in BareMetalServerDisk JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in BareMetalServerDisk JSON') - if 'size' in _dict: - args['size'] = _dict.get('size') - else: - raise ValueError('Required property \'size\' not present in BareMetalServerDisk JSON') + raise ValueError('Required property \'href\' not present in BareMetalServerProfileCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerDisk object from a json dictionary.""" + """Initialize a BareMetalServerProfileCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'interface_type') and self.interface_type is not None: - _dict['interface_type'] = self.interface_type - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type - if hasattr(self, 'size') and self.size is not None: - _dict['size'] = self.size return _dict def _to_dict(self): @@ -17902,76 +22642,82 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerDisk object.""" + """Return a `str` version of this BareMetalServerProfileCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerDisk') -> bool: + def __eq__(self, other: 'BareMetalServerProfileCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerDisk') -> bool: + def __ne__(self, other: 'BareMetalServerProfileCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class InterfaceTypeEnum(str, Enum): - """ - The disk interface used for attaching the disk. - The enumerated values for this property are expected to expand in the future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the resource on which the unexpected - property value was encountered. - """ - NVME = 'nvme' - SATA = 'sata' - - - class ResourceTypeEnum(str, Enum): - """ - The resource type. - """ - BARE_METAL_SERVER_DISK = 'bare_metal_server_disk' - - -class BareMetalServerDiskCollection(): +class BareMetalServerProfileDisk(): """ - BareMetalServerDiskCollection. + Disks provided by this profile. - :attr List[BareMetalServerDisk] disks: Collection of the bare metal server's - disks. + :attr BareMetalServerProfileDiskQuantity quantity: + :attr BareMetalServerProfileDiskSize size: + :attr BareMetalServerProfileDiskSupportedInterfaces supported_interface_types: """ def __init__(self, - disks: List['BareMetalServerDisk']) -> None: + quantity: 'BareMetalServerProfileDiskQuantity', + size: 'BareMetalServerProfileDiskSize', + supported_interface_types: 'BareMetalServerProfileDiskSupportedInterfaces') -> None: """ - Initialize a BareMetalServerDiskCollection object. + Initialize a BareMetalServerProfileDisk object. - :param List[BareMetalServerDisk] disks: Collection of the bare metal - server's disks. + :param BareMetalServerProfileDiskQuantity quantity: + :param BareMetalServerProfileDiskSize size: + :param BareMetalServerProfileDiskSupportedInterfaces + supported_interface_types: """ - self.disks = disks + self.quantity = quantity + self.size = size + self.supported_interface_types = supported_interface_types @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerDiskCollection': - """Initialize a BareMetalServerDiskCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'BareMetalServerProfileDisk': + """Initialize a BareMetalServerProfileDisk object from a json dictionary.""" args = {} - if 'disks' in _dict: - args['disks'] = [BareMetalServerDisk.from_dict(x) for x in _dict.get('disks')] + if 'quantity' in _dict: + args['quantity'] = _dict.get('quantity') else: - raise ValueError('Required property \'disks\' not present in BareMetalServerDiskCollection JSON') + raise ValueError('Required property \'quantity\' not present in BareMetalServerProfileDisk JSON') + if 'size' in _dict: + args['size'] = _dict.get('size') + else: + raise ValueError('Required property \'size\' not present in BareMetalServerProfileDisk JSON') + if 'supported_interface_types' in _dict: + args['supported_interface_types'] = BareMetalServerProfileDiskSupportedInterfaces.from_dict(_dict.get('supported_interface_types')) + else: + raise ValueError('Required property \'supported_interface_types\' not present in BareMetalServerProfileDisk JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerDiskCollection object from a json dictionary.""" + """Initialize a BareMetalServerProfileDisk object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'disks') and self.disks is not None: - _dict['disks'] = [x.to_dict() for x in self.disks] + if hasattr(self, 'quantity') and self.quantity is not None: + if isinstance(self.quantity, dict): + _dict['quantity'] = self.quantity + else: + _dict['quantity'] = self.quantity.to_dict() + if hasattr(self, 'size') and self.size is not None: + if isinstance(self.size, dict): + _dict['size'] = self.size + else: + _dict['size'] = self.size.to_dict() + if hasattr(self, 'supported_interface_types') and self.supported_interface_types is not None: + _dict['supported_interface_types'] = self.supported_interface_types.to_dict() return _dict def _to_dict(self): @@ -17979,54 +22725,115 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerDiskCollection object.""" + """Return a `str` version of this BareMetalServerProfileDisk object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerDiskCollection') -> bool: + def __eq__(self, other: 'BareMetalServerProfileDisk') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerDiskCollection') -> bool: + def __ne__(self, other: 'BareMetalServerProfileDisk') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class BareMetalServerDiskPatch(): +class BareMetalServerProfileDiskQuantity(): """ - BareMetalServerDiskPatch. + BareMetalServerProfileDiskQuantity. - :attr str name: (optional) The user-defined name for this disk. + """ + + def __init__(self) -> None: + """ + Initialize a BareMetalServerProfileDiskQuantity object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['BareMetalServerProfileDiskQuantityFixed', 'BareMetalServerProfileDiskQuantityRange', 'BareMetalServerProfileDiskQuantityEnum', 'BareMetalServerProfileDiskQuantityDependent'])) + raise Exception(msg) + +class BareMetalServerProfileDiskSize(): + """ + BareMetalServerProfileDiskSize. + + """ + + def __init__(self) -> None: + """ + Initialize a BareMetalServerProfileDiskSize object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['BareMetalServerProfileDiskSizeFixed', 'BareMetalServerProfileDiskSizeRange', 'BareMetalServerProfileDiskSizeEnum', 'BareMetalServerProfileDiskSizeDependent'])) + raise Exception(msg) + +class BareMetalServerProfileDiskSupportedInterfaces(): + """ + BareMetalServerProfileDiskSupportedInterfaces. + + :attr str default: The disk interface used for attaching the disk. + The enumerated values for this property are expected to expand in the future. + When processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the resource on which the unexpected + property value was encountered. + :attr str type: The type for this profile field. + :attr List[str] values: The supported disk interfaces used for attaching the + disk. """ def __init__(self, - *, - name: str = None) -> None: + default: str, + type: str, + values: List[str]) -> None: """ - Initialize a BareMetalServerDiskPatch object. + Initialize a BareMetalServerProfileDiskSupportedInterfaces object. - :param str name: (optional) The user-defined name for this disk. + :param str default: The disk interface used for attaching the disk. + The enumerated values for this property are expected to expand in the + future. When processing this property, check for and log unknown values. + Optionally halt processing and surface the error, or bypass the resource on + which the unexpected property value was encountered. + :param str type: The type for this profile field. + :param List[str] values: The supported disk interfaces used for attaching + the disk. """ - self.name = name + self.default = default + self.type = type + self.values = values @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerDiskPatch': - """Initialize a BareMetalServerDiskPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'BareMetalServerProfileDiskSupportedInterfaces': + """Initialize a BareMetalServerProfileDiskSupportedInterfaces object from a json dictionary.""" args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') + if 'default' in _dict: + args['default'] = _dict.get('default') + else: + raise ValueError('Required property \'default\' not present in BareMetalServerProfileDiskSupportedInterfaces JSON') + if 'type' in _dict: + args['type'] = _dict.get('type') + else: + raise ValueError('Required property \'type\' not present in BareMetalServerProfileDiskSupportedInterfaces JSON') + if 'values' in _dict: + args['values'] = _dict.get('values') + else: + raise ValueError('Required property \'values\' not present in BareMetalServerProfileDiskSupportedInterfaces JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerDiskPatch object from a json dictionary.""" + """Initialize a BareMetalServerProfileDiskSupportedInterfaces object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name + if hasattr(self, 'default') and self.default is not None: + _dict['default'] = self.default + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'values') and self.values is not None: + _dict['values'] = self.values return _dict def _to_dict(self): @@ -18034,56 +22841,140 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerDiskPatch object.""" + """Return a `str` version of this BareMetalServerProfileDiskSupportedInterfaces object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerDiskPatch') -> bool: + def __eq__(self, other: 'BareMetalServerProfileDiskSupportedInterfaces') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerDiskPatch') -> bool: + def __ne__(self, other: 'BareMetalServerProfileDiskSupportedInterfaces') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class BareMetalServerDiskReferenceDeleted(): + class DefaultEnum(str, Enum): + """ + The disk interface used for attaching the disk. + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the resource on which the unexpected + property value was encountered. + """ + NVME = 'nvme' + SATA = 'sata' + + + class TypeEnum(str, Enum): + """ + The type for this profile field. + """ + ENUM = 'enum' + + + class ValuesEnum(str, Enum): + """ + The disk interface used for attaching the disk. + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the resource on which the unexpected + property value was encountered. + """ + NVME = 'nvme' + SATA = 'sata' + + +class BareMetalServerProfileIdentity(): """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. + Identifies a bare metal server profile by a unique property. - :attr str more_info: Link to documentation about deleted resources. + """ + + def __init__(self) -> None: + """ + Initialize a BareMetalServerProfileIdentity object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['BareMetalServerProfileIdentityByName', 'BareMetalServerProfileIdentityByHref'])) + raise Exception(msg) + +class BareMetalServerProfileMemory(): + """ + BareMetalServerProfileMemory. + + """ + + def __init__(self) -> None: + """ + Initialize a BareMetalServerProfileMemory object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['BareMetalServerProfileMemoryFixed', 'BareMetalServerProfileMemoryRange', 'BareMetalServerProfileMemoryEnum', 'BareMetalServerProfileMemoryDependent'])) + raise Exception(msg) + +class BareMetalServerProfileOSArchitecture(): + """ + BareMetalServerProfileOSArchitecture. + + :attr str default: The default OS architecture for a bare metal server with this + profile. + :attr str type: The type for this profile field. + :attr List[str] values: The supported OS architecture(s) for a bare metal server + with this profile. """ def __init__(self, - more_info: str) -> None: + default: str, + type: str, + values: List[str]) -> None: """ - Initialize a BareMetalServerDiskReferenceDeleted object. + Initialize a BareMetalServerProfileOSArchitecture object. - :param str more_info: Link to documentation about deleted resources. + :param str default: The default OS architecture for a bare metal server + with this profile. + :param str type: The type for this profile field. + :param List[str] values: The supported OS architecture(s) for a bare metal + server with this profile. """ - self.more_info = more_info + self.default = default + self.type = type + self.values = values @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerDiskReferenceDeleted': - """Initialize a BareMetalServerDiskReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'BareMetalServerProfileOSArchitecture': + """Initialize a BareMetalServerProfileOSArchitecture object from a json dictionary.""" args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') + if 'default' in _dict: + args['default'] = _dict.get('default') else: - raise ValueError('Required property \'more_info\' not present in BareMetalServerDiskReferenceDeleted JSON') + raise ValueError('Required property \'default\' not present in BareMetalServerProfileOSArchitecture JSON') + if 'type' in _dict: + args['type'] = _dict.get('type') + else: + raise ValueError('Required property \'type\' not present in BareMetalServerProfileOSArchitecture JSON') + if 'values' in _dict: + args['values'] = _dict.get('values') + else: + raise ValueError('Required property \'values\' not present in BareMetalServerProfileOSArchitecture JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerDiskReferenceDeleted object from a json dictionary.""" + """Initialize a BareMetalServerProfileOSArchitecture object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'default') and self.default is not None: + _dict['default'] = self.default + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'values') and self.values is not None: + _dict['values'] = self.values return _dict def _to_dict(self): @@ -18091,87 +22982,82 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerDiskReferenceDeleted object.""" + """Return a `str` version of this BareMetalServerProfileOSArchitecture object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerDiskReferenceDeleted') -> bool: + def __eq__(self, other: 'BareMetalServerProfileOSArchitecture') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerDiskReferenceDeleted') -> bool: + def __ne__(self, other: 'BareMetalServerProfileOSArchitecture') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class BareMetalServerInitialization(): + class TypeEnum(str, Enum): + """ + The type for this profile field. + """ + ENUM = 'enum' + + +class BareMetalServerProfileReference(): """ - BareMetalServerInitialization. + BareMetalServerProfileReference. - :attr ImageReference image: The image the bare metal server was provisioned - from. - :attr List[KeyReference] keys: The public SSH keys used at initialization. - :attr List[BareMetalServerInitializationUserAccount] user_accounts: The user - accounts that are created at initialization. There can be multiple account types - distinguished by the `resource_type` property. + :attr str href: The URL for this bare metal server profile. + :attr str name: The name for this bare metal server profile. + :attr str resource_type: The resource type. """ def __init__(self, - image: 'ImageReference', - keys: List['KeyReference'], - user_accounts: List['BareMetalServerInitializationUserAccount']) -> None: + href: str, + name: str, + resource_type: str) -> None: """ - Initialize a BareMetalServerInitialization object. + Initialize a BareMetalServerProfileReference object. - :param ImageReference image: The image the bare metal server was - provisioned from. - :param List[KeyReference] keys: The public SSH keys used at initialization. - :param List[BareMetalServerInitializationUserAccount] user_accounts: The - user accounts that are created at initialization. There can be multiple - account types distinguished by the `resource_type` property. + :param str href: The URL for this bare metal server profile. + :param str name: The name for this bare metal server profile. + :param str resource_type: The resource type. """ - self.image = image - self.keys = keys - self.user_accounts = user_accounts + self.href = href + self.name = name + self.resource_type = resource_type @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerInitialization': - """Initialize a BareMetalServerInitialization object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'BareMetalServerProfileReference': + """Initialize a BareMetalServerProfileReference object from a json dictionary.""" args = {} - if 'image' in _dict: - args['image'] = ImageReference.from_dict(_dict.get('image')) + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'image\' not present in BareMetalServerInitialization JSON') - if 'keys' in _dict: - args['keys'] = [KeyReference.from_dict(x) for x in _dict.get('keys')] + raise ValueError('Required property \'href\' not present in BareMetalServerProfileReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') else: - raise ValueError('Required property \'keys\' not present in BareMetalServerInitialization JSON') - if 'user_accounts' in _dict: - args['user_accounts'] = _dict.get('user_accounts') + raise ValueError('Required property \'name\' not present in BareMetalServerProfileReference JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') else: - raise ValueError('Required property \'user_accounts\' not present in BareMetalServerInitialization JSON') + raise ValueError('Required property \'resource_type\' not present in BareMetalServerProfileReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerInitialization object from a json dictionary.""" + """Initialize a BareMetalServerProfileReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'image') and self.image is not None: - _dict['image'] = self.image.to_dict() - if hasattr(self, 'keys') and self.keys is not None: - _dict['keys'] = [x.to_dict() for x in self.keys] - if hasattr(self, 'user_accounts') and self.user_accounts is not None: - user_accounts_list = [] - for x in self.user_accounts: - if isinstance(x, dict): - user_accounts_list.append(x) - else: - user_accounts_list.append(x.to_dict()) - _dict['user_accounts'] = user_accounts_list + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type return _dict def _to_dict(self): @@ -18179,101 +23065,72 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerInitialization object.""" + """Return a `str` version of this BareMetalServerProfileReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerInitialization') -> bool: + def __eq__(self, other: 'BareMetalServerProfileReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerInitialization') -> bool: + def __ne__(self, other: 'BareMetalServerProfileReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class BareMetalServerInitializationPrototype(): + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + BARE_METAL_SERVER_PROFILE = 'bare_metal_server_profile' + + +class BareMetalServerProfileSupportedTrustedPlatformModuleModes(): """ - BareMetalServerInitializationPrototype. + The supported trusted platform module (TPM) modes for this bare metal server profile. - :attr ImageIdentity image: The image to be used when provisioning the bare metal - server. - :attr List[KeyIdentity] keys: The public SSH keys to install on the bare metal - server. Keys will be made available to the bare metal server as cloud-init - vendor data. For cloud-init enabled images, these keys will also be added as SSH - authorized keys for the administrative user. - For Windows images, at least one key must be specified, and one will be chosen - to encrypt the administrator password. Keys are optional for other images, but - if no keys are specified, the instance will be inaccessible unless the specified - image provides another means of access. - :attr str user_data: (optional) User data to be made available when initializing - the bare metal server. + :attr str type: The type for this profile field. + :attr List[str] values: The supported trusted platform module (TPM) modes. """ def __init__(self, - image: 'ImageIdentity', - keys: List['KeyIdentity'], - *, - user_data: str = None) -> None: + type: str, + values: List[str]) -> None: """ - Initialize a BareMetalServerInitializationPrototype object. + Initialize a BareMetalServerProfileSupportedTrustedPlatformModuleModes object. - :param ImageIdentity image: The image to be used when provisioning the bare - metal server. - :param List[KeyIdentity] keys: The public SSH keys to install on the bare - metal server. Keys will be made available to the bare metal server as - cloud-init vendor data. For cloud-init enabled images, these keys will also - be added as SSH authorized keys for the administrative user. - For Windows images, at least one key must be specified, and one will be - chosen to encrypt the administrator password. Keys are optional for other - images, but if no keys are specified, the instance will be inaccessible - unless the specified image provides another means of access. - :param str user_data: (optional) User data to be made available when - initializing the bare metal server. + :param str type: The type for this profile field. + :param List[str] values: The supported trusted platform module (TPM) modes. """ - self.image = image - self.keys = keys - self.user_data = user_data + self.type = type + self.values = values @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerInitializationPrototype': - """Initialize a BareMetalServerInitializationPrototype object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'BareMetalServerProfileSupportedTrustedPlatformModuleModes': + """Initialize a BareMetalServerProfileSupportedTrustedPlatformModuleModes object from a json dictionary.""" args = {} - if 'image' in _dict: - args['image'] = _dict.get('image') + if 'type' in _dict: + args['type'] = _dict.get('type') else: - raise ValueError('Required property \'image\' not present in BareMetalServerInitializationPrototype JSON') - if 'keys' in _dict: - args['keys'] = _dict.get('keys') + raise ValueError('Required property \'type\' not present in BareMetalServerProfileSupportedTrustedPlatformModuleModes JSON') + if 'values' in _dict: + args['values'] = _dict.get('values') else: - raise ValueError('Required property \'keys\' not present in BareMetalServerInitializationPrototype JSON') - if 'user_data' in _dict: - args['user_data'] = _dict.get('user_data') + raise ValueError('Required property \'values\' not present in BareMetalServerProfileSupportedTrustedPlatformModuleModes JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerInitializationPrototype object from a json dictionary.""" + """Initialize a BareMetalServerProfileSupportedTrustedPlatformModuleModes object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'image') and self.image is not None: - if isinstance(self.image, dict): - _dict['image'] = self.image - else: - _dict['image'] = self.image.to_dict() - if hasattr(self, 'keys') and self.keys is not None: - keys_list = [] - for x in self.keys: - if isinstance(x, dict): - keys_list.append(x) - else: - keys_list.append(x.to_dict()) - _dict['keys'] = keys_list - if hasattr(self, 'user_data') and self.user_data is not None: - _dict['user_data'] = self.user_data + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'values') and self.values is not None: + _dict['values'] = self.values return _dict def _to_dict(self): @@ -18281,316 +23138,109 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerInitializationPrototype object.""" + """Return a `str` version of this BareMetalServerProfileSupportedTrustedPlatformModuleModes object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerInitializationPrototype') -> bool: + def __eq__(self, other: 'BareMetalServerProfileSupportedTrustedPlatformModuleModes') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerInitializationPrototype') -> bool: + def __ne__(self, other: 'BareMetalServerProfileSupportedTrustedPlatformModuleModes') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class BareMetalServerInitializationUserAccount(): - """ - BareMetalServerInitializationUserAccount. - - """ - - def __init__(self) -> None: - """ - Initialize a BareMetalServerInitializationUserAccount object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount'])) - raise Exception(msg) - -class BareMetalServerNetworkInterface(): - """ - BareMetalServerNetworkInterface. - - :attr bool allow_ip_spoofing: Indicates whether source IP spoofing is allowed on - this interface. If false, source IP spoofing is prevented on this interface. If - true, source IP spoofing is allowed on this interface. - :attr datetime created_at: The date and time that the network interface was - created. - :attr bool enable_infrastructure_nat: If `true`: - - The VPC infrastructure performs any needed NAT operations. - - A single floating IP can be assigned to the network interface. - If `false`: - - Packets are passed unmodified to/from the network interface, - allowing the workload to perform any needed NAT operations. - - Multiple floating IPs can be assigned to the network interface. - - `allow_ip_spoofing` must be set to `false`. - :attr List[FloatingIPReference] floating_ips: (optional) The floating IPs - associated with this network interface. - :attr str href: The URL for this network interface. - :attr str id: The unique identifier for this network interface. - :attr str interface_type: The network interface type: - - `pci`: a physical PCI device which can only be created or deleted when the - bare metal - server is stopped - - Has an `allowed_vlans` property which controls the VLANs that will be - permitted - to use the PCI interface - - Cannot directly use an IEEE 802.1q VLAN tag. - - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in - its - array of `allowed_vlans`. - - Must use an IEEE 802.1q tag. - - Has its own security groups and does not inherit those of the PCI device - through - which traffic flows. - :attr str mac_address: The MAC address of the interface. If absent, the value - is not known. - :attr str name: The user-defined name for this network interface. - :attr int port_speed: The network interface port speed in Mbps. - :attr ReservedIPReference primary_ip: - :attr str resource_type: The resource type. - :attr List[SecurityGroupReference] security_groups: The security groups - targeting this network interface. - :attr str status: The status of the network interface. - :attr SubnetReference subnet: The associated subnet. - :attr str type: The type of this bare metal server network interface. - """ - - def __init__(self, - allow_ip_spoofing: bool, - created_at: datetime, - enable_infrastructure_nat: bool, - href: str, - id: str, - interface_type: str, - mac_address: str, - name: str, - port_speed: int, - primary_ip: 'ReservedIPReference', - resource_type: str, - security_groups: List['SecurityGroupReference'], - status: str, - subnet: 'SubnetReference', - type: str, - *, - floating_ips: List['FloatingIPReference'] = None) -> None: - """ - Initialize a BareMetalServerNetworkInterface object. - - :param bool allow_ip_spoofing: Indicates whether source IP spoofing is - allowed on this interface. If false, source IP spoofing is prevented on - this interface. If true, source IP spoofing is allowed on this interface. - :param datetime created_at: The date and time that the network interface - was created. - :param bool enable_infrastructure_nat: If `true`: - - The VPC infrastructure performs any needed NAT operations. - - A single floating IP can be assigned to the network interface. - If `false`: - - Packets are passed unmodified to/from the network interface, - allowing the workload to perform any needed NAT operations. - - Multiple floating IPs can be assigned to the network interface. - - `allow_ip_spoofing` must be set to `false`. - :param str href: The URL for this network interface. - :param str id: The unique identifier for this network interface. - :param str interface_type: The network interface type: - - `pci`: a physical PCI device which can only be created or deleted when - the bare metal - server is stopped - - Has an `allowed_vlans` property which controls the VLANs that will be - permitted - to use the PCI interface - - Cannot directly use an IEEE 802.1q VLAN tag. - - `vlan`: a virtual device, used through a `pci` device that has the `vlan` - in its - array of `allowed_vlans`. - - Must use an IEEE 802.1q tag. - - Has its own security groups and does not inherit those of the PCI - device through - which traffic flows. - :param str mac_address: The MAC address of the interface. If absent, the - value is not known. - :param str name: The user-defined name for this network interface. - :param int port_speed: The network interface port speed in Mbps. - :param ReservedIPReference primary_ip: - :param str resource_type: The resource type. - :param List[SecurityGroupReference] security_groups: The security groups - targeting this network interface. - :param str status: The status of the network interface. - :param SubnetReference subnet: The associated subnet. - :param str type: The type of this bare metal server network interface. - :param List[FloatingIPReference] floating_ips: (optional) The floating IPs - associated with this network interface. - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['BareMetalServerNetworkInterfaceByPCI', 'BareMetalServerNetworkInterfaceByVLAN'])) - raise Exception(msg) - - @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerNetworkInterface': - """Initialize a BareMetalServerNetworkInterface object from a json dictionary.""" - disc_class = cls._get_class_by_discriminator(_dict) - if disc_class != cls: - return disc_class.from_dict(_dict) - msg = ("Cannot convert dictionary into an instance of base class 'BareMetalServerNetworkInterface'. " + - "The discriminator value should map to a valid subclass: {1}").format( - ", ".join(['BareMetalServerNetworkInterfaceByPCI', 'BareMetalServerNetworkInterfaceByVLAN'])) - raise Exception(msg) - - @classmethod - def _from_dict(cls, _dict: Dict): - """Initialize a BareMetalServerNetworkInterface object from a json dictionary.""" - return cls.from_dict(_dict) - - @classmethod - def _get_class_by_discriminator(cls, _dict: Dict) -> object: - mapping = {} - mapping['pci'] = 'BareMetalServerNetworkInterfaceByPCI' - mapping['vlan'] = 'BareMetalServerNetworkInterfaceByVLAN' - disc_value = _dict.get('interface_type') - if disc_value is None: - raise ValueError('Discriminator property \'interface_type\' not found in BareMetalServerNetworkInterface JSON') - class_name = mapping.get(disc_value, disc_value) - try: - disc_class = getattr(sys.modules[__name__], class_name) - except AttributeError: - disc_class = cls - if isinstance(disc_class, object): - return disc_class - raise TypeError('%s is not a discriminator class' % class_name) - - class InterfaceTypeEnum(str, Enum): - """ - The network interface type: - - `pci`: a physical PCI device which can only be created or deleted when the bare - metal - server is stopped - - Has an `allowed_vlans` property which controls the VLANs that will be - permitted - to use the PCI interface - - Cannot directly use an IEEE 802.1q VLAN tag. - - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its - array of `allowed_vlans`. - - Must use an IEEE 802.1q tag. - - Has its own security groups and does not inherit those of the PCI device - through - which traffic flows. - """ - PCI = 'pci' - VLAN = 'vlan' - - - class ResourceTypeEnum(str, Enum): - """ - The resource type. - """ - NETWORK_INTERFACE = 'network_interface' - - - class StatusEnum(str, Enum): + class TypeEnum(str, Enum): """ - The status of the network interface. + The type for this profile field. """ - AVAILABLE = 'available' - DELETING = 'deleting' - FAILED = 'failed' - PENDING = 'pending' + ENUM = 'enum' - class TypeEnum(str, Enum): + class ValuesEnum(str, Enum): """ - The type of this bare metal server network interface. + The mode for the trusted platform module (TPM): + - `tpm_2`: Standard TPM 2 capabilities + - `tpm_2_with_txt`: Standard TPM 2 with Intel Trusted Execution Technology (TXT) + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the resource on which the unexpected + property value was encountered. """ - PRIMARY = 'primary' - SECONDARY = 'secondary' + TPM_2 = 'tpm_2' + TPM_2_WITH_TXT = 'tpm_2_with_txt' -class BareMetalServerNetworkInterfaceCollection(): +class BareMetalServerStatusReason(): """ - BareMetalServerNetworkInterfaceCollection. + BareMetalServerStatusReason. - :attr BareMetalServerNetworkInterfaceCollectionFirst first: A link to the first - page of resources. - :attr int limit: The maximum number of resources that can be returned by the - request. - :attr List[BareMetalServerNetworkInterface] network_interfaces: Collection of - network interfaces. - :attr BareMetalServerNetworkInterfaceCollectionNext next: (optional) A link to - the next page of resources. This property is present for all pages - except the last page. - :attr int total_count: The total number of resources across all pages. + :attr str code: The status reason code: + - `cannot_start`: Failed to start due to an internal error + - `cannot_start_capacity`: Insufficient capacity within the selected zone + - `cannot_start_compute`: An error occurred while allocating compute resources + - `cannot_start_ip_address`: An error occurred while allocating an IP address + - `cannot_start_network`: An error occurred while allocating network resources. + :attr str message: An explanation of the status reason. + :attr str more_info: (optional) Link to documentation about this status reason. """ def __init__(self, - first: 'BareMetalServerNetworkInterfaceCollectionFirst', - limit: int, - network_interfaces: List['BareMetalServerNetworkInterface'], - total_count: int, + code: str, + message: str, *, - next: 'BareMetalServerNetworkInterfaceCollectionNext' = None) -> None: + more_info: str = None) -> None: """ - Initialize a BareMetalServerNetworkInterfaceCollection object. + Initialize a BareMetalServerStatusReason object. - :param BareMetalServerNetworkInterfaceCollectionFirst first: A link to the - first page of resources. - :param int limit: The maximum number of resources that can be returned by - the request. - :param List[BareMetalServerNetworkInterface] network_interfaces: Collection - of network interfaces. - :param int total_count: The total number of resources across all pages. - :param BareMetalServerNetworkInterfaceCollectionNext next: (optional) A - link to the next page of resources. This property is present for all pages - except the last page. + :param str code: The status reason code: + - `cannot_start`: Failed to start due to an internal error + - `cannot_start_capacity`: Insufficient capacity within the selected zone + - `cannot_start_compute`: An error occurred while allocating compute + resources + - `cannot_start_ip_address`: An error occurred while allocating an IP + address + - `cannot_start_network`: An error occurred while allocating network + resources. + :param str message: An explanation of the status reason. + :param str more_info: (optional) Link to documentation about this status + reason. """ - self.first = first - self.limit = limit - self.network_interfaces = network_interfaces - self.next = next - self.total_count = total_count + self.code = code + self.message = message + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerNetworkInterfaceCollection': - """Initialize a BareMetalServerNetworkInterfaceCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'BareMetalServerStatusReason': + """Initialize a BareMetalServerStatusReason object from a json dictionary.""" args = {} - if 'first' in _dict: - args['first'] = BareMetalServerNetworkInterfaceCollectionFirst.from_dict(_dict.get('first')) - else: - raise ValueError('Required property \'first\' not present in BareMetalServerNetworkInterfaceCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') - else: - raise ValueError('Required property \'limit\' not present in BareMetalServerNetworkInterfaceCollection JSON') - if 'network_interfaces' in _dict: - args['network_interfaces'] = [BareMetalServerNetworkInterface.from_dict(x) for x in _dict.get('network_interfaces')] + if 'code' in _dict: + args['code'] = _dict.get('code') else: - raise ValueError('Required property \'network_interfaces\' not present in BareMetalServerNetworkInterfaceCollection JSON') - if 'next' in _dict: - args['next'] = BareMetalServerNetworkInterfaceCollectionNext.from_dict(_dict.get('next')) - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') + raise ValueError('Required property \'code\' not present in BareMetalServerStatusReason JSON') + if 'message' in _dict: + args['message'] = _dict.get('message') else: - raise ValueError('Required property \'total_count\' not present in BareMetalServerNetworkInterfaceCollection JSON') + raise ValueError('Required property \'message\' not present in BareMetalServerStatusReason JSON') + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerNetworkInterfaceCollection object from a json dictionary.""" + """Initialize a BareMetalServerStatusReason object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'network_interfaces') and self.network_interfaces is not None: - _dict['network_interfaces'] = [x.to_dict() for x in self.network_interfaces] - if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count + if hasattr(self, 'code') and self.code is not None: + _dict['code'] = self.code + if hasattr(self, 'message') and self.message is not None: + _dict['message'] = self.message + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -18598,55 +23248,95 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerNetworkInterfaceCollection object.""" + """Return a `str` version of this BareMetalServerStatusReason object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerNetworkInterfaceCollection') -> bool: + def __eq__(self, other: 'BareMetalServerStatusReason') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerNetworkInterfaceCollection') -> bool: + def __ne__(self, other: 'BareMetalServerStatusReason') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class BareMetalServerNetworkInterfaceCollectionFirst(): + class CodeEnum(str, Enum): + """ + The status reason code: + - `cannot_start`: Failed to start due to an internal error + - `cannot_start_capacity`: Insufficient capacity within the selected zone + - `cannot_start_compute`: An error occurred while allocating compute resources + - `cannot_start_ip_address`: An error occurred while allocating an IP address + - `cannot_start_network`: An error occurred while allocating network resources. + """ + CANNOT_START = 'cannot_start' + CANNOT_START_CAPACITY = 'cannot_start_capacity' + CANNOT_START_COMPUTE = 'cannot_start_compute' + CANNOT_START_IP_ADDRESS = 'cannot_start_ip_address' + CANNOT_START_NETWORK = 'cannot_start_network' + + +class BareMetalServerTrustedPlatformModule(): """ - A link to the first page of resources. + BareMetalServerTrustedPlatformModule. - :attr str href: The URL for a page of resources. + :attr bool enabled: Indicates whether the trusted platform module (TPM) is + enabled. If enabled, `mode` will also be set. + :attr str mode: (optional) The mode for the trusted platform module (TPM): + - `tpm_2`: Standard TPM 2 capabilities + - `tpm_2_with_txt`: Standard TPM 2 with Intel Trusted Execution Technology (TXT) + The enumerated values for this property are expected to expand in the future. + When processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the resource on which the unexpected + property value was encountered. """ def __init__(self, - href: str) -> None: + enabled: bool, + *, + mode: str = None) -> None: """ - Initialize a BareMetalServerNetworkInterfaceCollectionFirst object. + Initialize a BareMetalServerTrustedPlatformModule object. - :param str href: The URL for a page of resources. + :param bool enabled: Indicates whether the trusted platform module (TPM) is + enabled. If enabled, `mode` will also be set. + :param str mode: (optional) The mode for the trusted platform module (TPM): + - `tpm_2`: Standard TPM 2 capabilities + - `tpm_2_with_txt`: Standard TPM 2 with Intel Trusted Execution Technology + (TXT) + The enumerated values for this property are expected to expand in the + future. When processing this property, check for and log unknown values. + Optionally halt processing and surface the error, or bypass the resource on + which the unexpected property value was encountered. """ - self.href = href + self.enabled = enabled + self.mode = mode @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerNetworkInterfaceCollectionFirst': - """Initialize a BareMetalServerNetworkInterfaceCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'BareMetalServerTrustedPlatformModule': + """Initialize a BareMetalServerTrustedPlatformModule object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') + if 'enabled' in _dict: + args['enabled'] = _dict.get('enabled') else: - raise ValueError('Required property \'href\' not present in BareMetalServerNetworkInterfaceCollectionFirst JSON') + raise ValueError('Required property \'enabled\' not present in BareMetalServerTrustedPlatformModule JSON') + if 'mode' in _dict: + args['mode'] = _dict.get('mode') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerNetworkInterfaceCollectionFirst object from a json dictionary.""" + """Initialize a BareMetalServerTrustedPlatformModule object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'enabled') and self.enabled is not None: + _dict['enabled'] = self.enabled + if hasattr(self, 'mode') and self.mode is not None: + _dict['mode'] = self.mode return _dict def _to_dict(self): @@ -18654,56 +23344,84 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerNetworkInterfaceCollectionFirst object.""" + """Return a `str` version of this BareMetalServerTrustedPlatformModule object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerNetworkInterfaceCollectionFirst') -> bool: + def __eq__(self, other: 'BareMetalServerTrustedPlatformModule') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerNetworkInterfaceCollectionFirst') -> bool: + def __ne__(self, other: 'BareMetalServerTrustedPlatformModule') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class BareMetalServerNetworkInterfaceCollectionNext(): + class ModeEnum(str, Enum): + """ + The mode for the trusted platform module (TPM): + - `tpm_2`: Standard TPM 2 capabilities + - `tpm_2_with_txt`: Standard TPM 2 with Intel Trusted Execution Technology (TXT) + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the resource on which the unexpected + property value was encountered. + """ + TPM_2 = 'tpm_2' + TPM_2_WITH_TXT = 'tpm_2_with_txt' + + +class CertificateInstanceIdentity(): """ - A link to the next page of resources. This property is present for all pages except - the last page. + Identifies a certificate instance by a unique property. - :attr str href: The URL for a page of resources. + """ + + def __init__(self) -> None: + """ + Initialize a CertificateInstanceIdentity object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['CertificateInstanceIdentityByCRN'])) + raise Exception(msg) + +class CertificateInstanceReference(): + """ + CertificateInstanceReference. + + :attr str crn: The CRN for this certificate instance. """ def __init__(self, - href: str) -> None: + crn: str) -> None: """ - Initialize a BareMetalServerNetworkInterfaceCollectionNext object. + Initialize a CertificateInstanceReference object. - :param str href: The URL for a page of resources. + :param str crn: The CRN for this certificate instance. """ - self.href = href + self.crn = crn @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerNetworkInterfaceCollectionNext': - """Initialize a BareMetalServerNetworkInterfaceCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'CertificateInstanceReference': + """Initialize a CertificateInstanceReference object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') + if 'crn' in _dict: + args['crn'] = _dict.get('crn') else: - raise ValueError('Required property \'href\' not present in BareMetalServerNetworkInterfaceCollectionNext JSON') + raise ValueError('Required property \'crn\' not present in CertificateInstanceReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerNetworkInterfaceCollectionNext object from a json dictionary.""" + """Initialize a CertificateInstanceReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn return _dict def _to_dict(self): @@ -18711,322 +23429,428 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerNetworkInterfaceCollectionNext object.""" + """Return a `str` version of this CertificateInstanceReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerNetworkInterfaceCollectionNext') -> bool: + def __eq__(self, other: 'CertificateInstanceReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerNetworkInterfaceCollectionNext') -> bool: + def __ne__(self, other: 'CertificateInstanceReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class BareMetalServerNetworkInterfacePatch(): +class DedicatedHost(): """ - BareMetalServerNetworkInterfacePatch. + DedicatedHost. - :attr bool allow_ip_spoofing: (optional) Indicates whether source IP spoofing is - allowed on this interface. If false, source IP spoofing is prevented on this - interface. If true, source IP spoofing is allowed on this interface. - :attr List[int] allowed_vlans: (optional) Indicates what VLAN IDs (for VLAN type - only) can use this physical (PCI type) interface. A given VLAN can only be in - the `allowed_vlans` array for one PCI type adapter per bare metal server. - :attr bool enable_infrastructure_nat: (optional) If `true`: - - The VPC infrastructure performs any needed NAT operations. - - A single floating IP can be assigned to the network interface. - If `false`: - - Packets are passed unmodified to/from the network interface, - allowing the workload to perform any needed NAT operations. - - Multiple floating IPs can be assigned to the network interface. - - `allow_ip_spoofing` must be set to `false`. - :attr str name: (optional) The user-defined name for network interface. Names - must be unique within the instance the network interface resides in. + :attr int available_memory: The amount of memory in gibibytes that is currently + available for instances. + :attr VCPU available_vcpu: The available VCPU for the dedicated host. + :attr datetime created_at: The date and time that the dedicated host was + created. + :attr str crn: The CRN for this dedicated host. + :attr List[DedicatedHostDisk] disks: Collection of the dedicated host's disks. + :attr DedicatedHostGroupReference group: The dedicated host group this dedicated + host is in. + :attr str href: The URL for this dedicated host. + :attr str id: The unique identifier for this dedicated host. + :attr bool instance_placement_enabled: If set to true, instances can be placed + on this dedicated host. + :attr List[InstanceReference] instances: The instances that are allocated to + this dedicated host. + :attr str lifecycle_state: The lifecycle state of the dedicated host. + :attr int memory: The total amount of memory in gibibytes for this host. + :attr str name: The unique user-defined name for this dedicated host. + :attr DedicatedHostProfileReference profile: The profile this dedicated host + uses. + :attr bool provisionable: Indicates whether this dedicated host is available for + instance creation. + :attr ResourceGroupReference resource_group: The resource group for this + dedicated host. + :attr str resource_type: The resource type. + :attr int socket_count: The total number of sockets for this host. + :attr str state: The administrative state of the dedicated host. + The enumerated values for this property are expected to expand in the future. + When processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the dedicated host on which the + unexpected property value was encountered. + :attr List[InstanceProfileReference] supported_instance_profiles: The instance + profiles usable by instances placed on this dedicated host. + :attr VCPU vcpu: The total VCPU of the dedicated host. + :attr ZoneReference zone: The zone this dedicated host resides in. """ def __init__(self, - *, - allow_ip_spoofing: bool = None, - allowed_vlans: List[int] = None, - enable_infrastructure_nat: bool = None, - name: str = None) -> None: + available_memory: int, + available_vcpu: 'VCPU', + created_at: datetime, + crn: str, + disks: List['DedicatedHostDisk'], + group: 'DedicatedHostGroupReference', + href: str, + id: str, + instance_placement_enabled: bool, + instances: List['InstanceReference'], + lifecycle_state: str, + memory: int, + name: str, + profile: 'DedicatedHostProfileReference', + provisionable: bool, + resource_group: 'ResourceGroupReference', + resource_type: str, + socket_count: int, + state: str, + supported_instance_profiles: List['InstanceProfileReference'], + vcpu: 'VCPU', + zone: 'ZoneReference') -> None: """ - Initialize a BareMetalServerNetworkInterfacePatch object. + Initialize a DedicatedHost object. - :param bool allow_ip_spoofing: (optional) Indicates whether source IP - spoofing is allowed on this interface. If false, source IP spoofing is - prevented on this interface. If true, source IP spoofing is allowed on this - interface. - :param List[int] allowed_vlans: (optional) Indicates what VLAN IDs (for - VLAN type only) can use this physical (PCI type) interface. A given VLAN - can only be in the `allowed_vlans` array for one PCI type adapter per bare - metal server. - :param bool enable_infrastructure_nat: (optional) If `true`: - - The VPC infrastructure performs any needed NAT operations. - - A single floating IP can be assigned to the network interface. - If `false`: - - Packets are passed unmodified to/from the network interface, - allowing the workload to perform any needed NAT operations. - - Multiple floating IPs can be assigned to the network interface. - - `allow_ip_spoofing` must be set to `false`. - :param str name: (optional) The user-defined name for network interface. - Names must be unique within the instance the network interface resides in. + :param int available_memory: The amount of memory in gibibytes that is + currently available for instances. + :param VCPU available_vcpu: The available VCPU for the dedicated host. + :param datetime created_at: The date and time that the dedicated host was + created. + :param str crn: The CRN for this dedicated host. + :param List[DedicatedHostDisk] disks: Collection of the dedicated host's + disks. + :param DedicatedHostGroupReference group: The dedicated host group this + dedicated host is in. + :param str href: The URL for this dedicated host. + :param str id: The unique identifier for this dedicated host. + :param bool instance_placement_enabled: If set to true, instances can be + placed on this dedicated host. + :param List[InstanceReference] instances: The instances that are allocated + to this dedicated host. + :param str lifecycle_state: The lifecycle state of the dedicated host. + :param int memory: The total amount of memory in gibibytes for this host. + :param str name: The unique user-defined name for this dedicated host. + :param DedicatedHostProfileReference profile: The profile this dedicated + host uses. + :param bool provisionable: Indicates whether this dedicated host is + available for instance creation. + :param ResourceGroupReference resource_group: The resource group for this + dedicated host. + :param str resource_type: The resource type. + :param int socket_count: The total number of sockets for this host. + :param str state: The administrative state of the dedicated host. + The enumerated values for this property are expected to expand in the + future. When processing this property, check for and log unknown values. + Optionally halt processing and surface the error, or bypass the dedicated + host on which the unexpected property value was encountered. + :param List[InstanceProfileReference] supported_instance_profiles: The + instance profiles usable by instances placed on this dedicated host. + :param VCPU vcpu: The total VCPU of the dedicated host. + :param ZoneReference zone: The zone this dedicated host resides in. """ - self.allow_ip_spoofing = allow_ip_spoofing - self.allowed_vlans = allowed_vlans - self.enable_infrastructure_nat = enable_infrastructure_nat + self.available_memory = available_memory + self.available_vcpu = available_vcpu + self.created_at = created_at + self.crn = crn + self.disks = disks + self.group = group + self.href = href + self.id = id + self.instance_placement_enabled = instance_placement_enabled + self.instances = instances + self.lifecycle_state = lifecycle_state + self.memory = memory self.name = name + self.profile = profile + self.provisionable = provisionable + self.resource_group = resource_group + self.resource_type = resource_type + self.socket_count = socket_count + self.state = state + self.supported_instance_profiles = supported_instance_profiles + self.vcpu = vcpu + self.zone = zone @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerNetworkInterfacePatch': - """Initialize a BareMetalServerNetworkInterfacePatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHost': + """Initialize a DedicatedHost object from a json dictionary.""" args = {} - if 'allow_ip_spoofing' in _dict: - args['allow_ip_spoofing'] = _dict.get('allow_ip_spoofing') - if 'allowed_vlans' in _dict: - args['allowed_vlans'] = _dict.get('allowed_vlans') - if 'enable_infrastructure_nat' in _dict: - args['enable_infrastructure_nat'] = _dict.get('enable_infrastructure_nat') + if 'available_memory' in _dict: + args['available_memory'] = _dict.get('available_memory') + else: + raise ValueError('Required property \'available_memory\' not present in DedicatedHost JSON') + if 'available_vcpu' in _dict: + args['available_vcpu'] = VCPU.from_dict(_dict.get('available_vcpu')) + else: + raise ValueError('Required property \'available_vcpu\' not present in DedicatedHost JSON') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) + else: + raise ValueError('Required property \'created_at\' not present in DedicatedHost JSON') + if 'crn' in _dict: + args['crn'] = _dict.get('crn') + else: + raise ValueError('Required property \'crn\' not present in DedicatedHost JSON') + if 'disks' in _dict: + args['disks'] = [DedicatedHostDisk.from_dict(x) for x in _dict.get('disks')] + else: + raise ValueError('Required property \'disks\' not present in DedicatedHost JSON') + if 'group' in _dict: + args['group'] = DedicatedHostGroupReference.from_dict(_dict.get('group')) + else: + raise ValueError('Required property \'group\' not present in DedicatedHost JSON') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in DedicatedHost JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in DedicatedHost JSON') + if 'instance_placement_enabled' in _dict: + args['instance_placement_enabled'] = _dict.get('instance_placement_enabled') + else: + raise ValueError('Required property \'instance_placement_enabled\' not present in DedicatedHost JSON') + if 'instances' in _dict: + args['instances'] = [InstanceReference.from_dict(x) for x in _dict.get('instances')] + else: + raise ValueError('Required property \'instances\' not present in DedicatedHost JSON') + if 'lifecycle_state' in _dict: + args['lifecycle_state'] = _dict.get('lifecycle_state') + else: + raise ValueError('Required property \'lifecycle_state\' not present in DedicatedHost JSON') + if 'memory' in _dict: + args['memory'] = _dict.get('memory') + else: + raise ValueError('Required property \'memory\' not present in DedicatedHost JSON') if 'name' in _dict: args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in DedicatedHost JSON') + if 'profile' in _dict: + args['profile'] = DedicatedHostProfileReference.from_dict(_dict.get('profile')) + else: + raise ValueError('Required property \'profile\' not present in DedicatedHost JSON') + if 'provisionable' in _dict: + args['provisionable'] = _dict.get('provisionable') + else: + raise ValueError('Required property \'provisionable\' not present in DedicatedHost JSON') + if 'resource_group' in _dict: + args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) + else: + raise ValueError('Required property \'resource_group\' not present in DedicatedHost JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in DedicatedHost JSON') + if 'socket_count' in _dict: + args['socket_count'] = _dict.get('socket_count') + else: + raise ValueError('Required property \'socket_count\' not present in DedicatedHost JSON') + if 'state' in _dict: + args['state'] = _dict.get('state') + else: + raise ValueError('Required property \'state\' not present in DedicatedHost JSON') + if 'supported_instance_profiles' in _dict: + args['supported_instance_profiles'] = [InstanceProfileReference.from_dict(x) for x in _dict.get('supported_instance_profiles')] + else: + raise ValueError('Required property \'supported_instance_profiles\' not present in DedicatedHost JSON') + if 'vcpu' in _dict: + args['vcpu'] = VCPU.from_dict(_dict.get('vcpu')) + else: + raise ValueError('Required property \'vcpu\' not present in DedicatedHost JSON') + if 'zone' in _dict: + args['zone'] = ZoneReference.from_dict(_dict.get('zone')) + else: + raise ValueError('Required property \'zone\' not present in DedicatedHost JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerNetworkInterfacePatch object from a json dictionary.""" + """Initialize a DedicatedHost object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'allow_ip_spoofing') and self.allow_ip_spoofing is not None: - _dict['allow_ip_spoofing'] = self.allow_ip_spoofing - if hasattr(self, 'allowed_vlans') and self.allowed_vlans is not None: - _dict['allowed_vlans'] = self.allowed_vlans - if hasattr(self, 'enable_infrastructure_nat') and self.enable_infrastructure_nat is not None: - _dict['enable_infrastructure_nat'] = self.enable_infrastructure_nat + if hasattr(self, 'available_memory') and self.available_memory is not None: + _dict['available_memory'] = self.available_memory + if hasattr(self, 'available_vcpu') and self.available_vcpu is not None: + _dict['available_vcpu'] = self.available_vcpu.to_dict() + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'disks') and self.disks is not None: + _dict['disks'] = [x.to_dict() for x in self.disks] + if hasattr(self, 'group') and self.group is not None: + _dict['group'] = self.group.to_dict() + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'instance_placement_enabled') and self.instance_placement_enabled is not None: + _dict['instance_placement_enabled'] = self.instance_placement_enabled + if hasattr(self, 'instances') and self.instances is not None: + _dict['instances'] = [x.to_dict() for x in self.instances] + if hasattr(self, 'lifecycle_state') and self.lifecycle_state is not None: + _dict['lifecycle_state'] = self.lifecycle_state + if hasattr(self, 'memory') and self.memory is not None: + _dict['memory'] = self.memory if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this BareMetalServerNetworkInterfacePatch object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'BareMetalServerNetworkInterfacePatch') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'BareMetalServerNetworkInterfacePatch') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - -class BareMetalServerNetworkInterfacePrototype(): - """ - BareMetalServerNetworkInterfacePrototype. - - :attr bool allow_ip_spoofing: (optional) Indicates whether source IP spoofing is - allowed on this interface. If false, source IP spoofing is prevented on this - interface. If true, source IP spoofing is allowed on this interface. - :attr bool enable_infrastructure_nat: (optional) If `true`: - - The VPC infrastructure performs any needed NAT operations. - - A single floating IP can be assigned to the network interface. - If `false`: - - Packets are passed unmodified to/from the network interface, - allowing the workload to perform any needed NAT operations. - - Multiple floating IPs can be assigned to the network interface. - - `allow_ip_spoofing` must be set to `false`. - :attr str interface_type: The network interface type: - - `pci`: a physical PCI device which can only be created or deleted when the - bare metal - server is stopped - - Has an `allowed_vlans` property which controls the VLANs that will be - permitted - to use the PCI interface - - Cannot directly use an IEEE 802.1q VLAN tag. - - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in - its - array of `allowed_vlans`. - - Must use an IEEE 802.1q tag. - - Has its own security groups and does not inherit those of the PCI device - through - which traffic flows. - :attr str name: (optional) The user-defined name for network interface. Names - must be unique within the instance the network interface resides in. If - unspecified, the name will be a hyphenated list of randomly-selected words. - :attr NetworkInterfaceIPPrototype primary_ip: (optional) The primary IP address - to bind to the network interface. This can be specified using - an existing reserved IP, or a prototype object for a new reserved IP. - If an existing reserved IP or a prototype object with an address is specified, - it must - be available on the network interface's subnet. Otherwise, an available address - on the - subnet will be automatically selected and reserved. - :attr List[SecurityGroupIdentity] security_groups: (optional) The security - groups to use for this network interface. If unspecified, the VPC's default - security group is used. - :attr SubnetIdentity subnet: The associated subnet. - """ - - def __init__(self, - interface_type: str, - subnet: 'SubnetIdentity', - *, - allow_ip_spoofing: bool = None, - enable_infrastructure_nat: bool = None, - name: str = None, - primary_ip: 'NetworkInterfaceIPPrototype' = None, - security_groups: List['SecurityGroupIdentity'] = None) -> None: - """ - Initialize a BareMetalServerNetworkInterfacePrototype object. - - :param str interface_type: The network interface type: - - `pci`: a physical PCI device which can only be created or deleted when - the bare metal - server is stopped - - Has an `allowed_vlans` property which controls the VLANs that will be - permitted - to use the PCI interface - - Cannot directly use an IEEE 802.1q VLAN tag. - - `vlan`: a virtual device, used through a `pci` device that has the `vlan` - in its - array of `allowed_vlans`. - - Must use an IEEE 802.1q tag. - - Has its own security groups and does not inherit those of the PCI - device through - which traffic flows. - :param SubnetIdentity subnet: The associated subnet. - :param bool allow_ip_spoofing: (optional) Indicates whether source IP - spoofing is allowed on this interface. If false, source IP spoofing is - prevented on this interface. If true, source IP spoofing is allowed on this - interface. - :param bool enable_infrastructure_nat: (optional) If `true`: - - The VPC infrastructure performs any needed NAT operations. - - A single floating IP can be assigned to the network interface. - If `false`: - - Packets are passed unmodified to/from the network interface, - allowing the workload to perform any needed NAT operations. - - Multiple floating IPs can be assigned to the network interface. - - `allow_ip_spoofing` must be set to `false`. - :param str name: (optional) The user-defined name for network interface. - Names must be unique within the instance the network interface resides in. - If unspecified, the name will be a hyphenated list of randomly-selected - words. - :param NetworkInterfaceIPPrototype primary_ip: (optional) The primary IP - address to bind to the network interface. This can be specified using - an existing reserved IP, or a prototype object for a new reserved IP. - If an existing reserved IP or a prototype object with an address is - specified, it must - be available on the network interface's subnet. Otherwise, an available - address on the - subnet will be automatically selected and reserved. - :param List[SecurityGroupIdentity] security_groups: (optional) The security - groups to use for this network interface. If unspecified, the VPC's default - security group is used. + if hasattr(self, 'profile') and self.profile is not None: + _dict['profile'] = self.profile.to_dict() + if hasattr(self, 'provisionable') and self.provisionable is not None: + _dict['provisionable'] = self.provisionable + if hasattr(self, 'resource_group') and self.resource_group is not None: + _dict['resource_group'] = self.resource_group.to_dict() + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + if hasattr(self, 'socket_count') and self.socket_count is not None: + _dict['socket_count'] = self.socket_count + if hasattr(self, 'state') and self.state is not None: + _dict['state'] = self.state + if hasattr(self, 'supported_instance_profiles') and self.supported_instance_profiles is not None: + _dict['supported_instance_profiles'] = [x.to_dict() for x in self.supported_instance_profiles] + if hasattr(self, 'vcpu') and self.vcpu is not None: + _dict['vcpu'] = self.vcpu.to_dict() + if hasattr(self, 'zone') and self.zone is not None: + _dict['zone'] = self.zone.to_dict() + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this DedicatedHost object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'DedicatedHost') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'DedicatedHost') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class LifecycleStateEnum(str, Enum): """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPCIPrototype', 'BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVLANPrototype'])) - raise Exception(msg) + The lifecycle state of the dedicated host. + """ + DELETING = 'deleting' + FAILED = 'failed' + PENDING = 'pending' + STABLE = 'stable' + SUSPENDED = 'suspended' + UPDATING = 'updating' + WAITING = 'waiting' - @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerNetworkInterfacePrototype': - """Initialize a BareMetalServerNetworkInterfacePrototype object from a json dictionary.""" - disc_class = cls._get_class_by_discriminator(_dict) - if disc_class != cls: - return disc_class.from_dict(_dict) - msg = ("Cannot convert dictionary into an instance of base class 'BareMetalServerNetworkInterfacePrototype'. " + - "The discriminator value should map to a valid subclass: {1}").format( - ", ".join(['BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPCIPrototype', 'BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVLANPrototype'])) - raise Exception(msg) - @classmethod - def _from_dict(cls, _dict: Dict): - """Initialize a BareMetalServerNetworkInterfacePrototype object from a json dictionary.""" - return cls.from_dict(_dict) + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + DEDICATED_HOST = 'dedicated_host' - @classmethod - def _get_class_by_discriminator(cls, _dict: Dict) -> object: - mapping = {} - mapping['pci'] = 'BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPCIPrototype' - mapping['vlan'] = 'BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVLANPrototype' - disc_value = _dict.get('interface_type') - if disc_value is None: - raise ValueError('Discriminator property \'interface_type\' not found in BareMetalServerNetworkInterfacePrototype JSON') - class_name = mapping.get(disc_value, disc_value) - try: - disc_class = getattr(sys.modules[__name__], class_name) - except AttributeError: - disc_class = cls - if isinstance(disc_class, object): - return disc_class - raise TypeError('%s is not a discriminator class' % class_name) - class InterfaceTypeEnum(str, Enum): + class StateEnum(str, Enum): """ - The network interface type: - - `pci`: a physical PCI device which can only be created or deleted when the bare - metal - server is stopped - - Has an `allowed_vlans` property which controls the VLANs that will be - permitted - to use the PCI interface - - Cannot directly use an IEEE 802.1q VLAN tag. - - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its - array of `allowed_vlans`. - - Must use an IEEE 802.1q tag. - - Has its own security groups and does not inherit those of the PCI device - through - which traffic flows. + The administrative state of the dedicated host. + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the dedicated host on which the + unexpected property value was encountered. """ - PCI = 'pci' - VLAN = 'vlan' + AVAILABLE = 'available' + DEGRADED = 'degraded' + MIGRATING = 'migrating' + UNAVAILABLE = 'unavailable' -class BareMetalServerPatch(): +class DedicatedHostCollection(): """ - BareMetalServerPatch. + DedicatedHostCollection. - :attr str name: (optional) The user-defined name for this bare metal server (and - default system hostname). + :attr List[DedicatedHost] dedicated_hosts: Collection of dedicated hosts. + :attr DedicatedHostCollectionFirst first: A link to the first page of resources. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr DedicatedHostCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages + except the last page. + :attr int total_count: The total number of resources across all pages. """ def __init__(self, + dedicated_hosts: List['DedicatedHost'], + first: 'DedicatedHostCollectionFirst', + limit: int, + total_count: int, *, - name: str = None) -> None: + next: 'DedicatedHostCollectionNext' = None) -> None: """ - Initialize a BareMetalServerPatch object. + Initialize a DedicatedHostCollection object. - :param str name: (optional) The user-defined name for this bare metal - server (and default system hostname). + :param List[DedicatedHost] dedicated_hosts: Collection of dedicated hosts. + :param DedicatedHostCollectionFirst first: A link to the first page of + resources. + :param int limit: The maximum number of resources that can be returned by + the request. + :param int total_count: The total number of resources across all pages. + :param DedicatedHostCollectionNext next: (optional) A link to the next page + of resources. This property is present for all pages + except the last page. """ - self.name = name + self.dedicated_hosts = dedicated_hosts + self.first = first + self.limit = limit + self.next = next + self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerPatch': - """Initialize a BareMetalServerPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostCollection': + """Initialize a DedicatedHostCollection object from a json dictionary.""" args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') + if 'dedicated_hosts' in _dict: + args['dedicated_hosts'] = [DedicatedHost.from_dict(x) for x in _dict.get('dedicated_hosts')] + else: + raise ValueError('Required property \'dedicated_hosts\' not present in DedicatedHostCollection JSON') + if 'first' in _dict: + args['first'] = DedicatedHostCollectionFirst.from_dict(_dict.get('first')) + else: + raise ValueError('Required property \'first\' not present in DedicatedHostCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') + else: + raise ValueError('Required property \'limit\' not present in DedicatedHostCollection JSON') + if 'next' in _dict: + args['next'] = DedicatedHostCollectionNext.from_dict(_dict.get('next')) + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') + else: + raise ValueError('Required property \'total_count\' not present in DedicatedHostCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerPatch object from a json dictionary.""" + """Initialize a DedicatedHostCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name + if hasattr(self, 'dedicated_hosts') and self.dedicated_hosts is not None: + _dict['dedicated_hosts'] = [x.to_dict() for x in self.dedicated_hosts] + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count return _dict def _to_dict(self): @@ -19034,185 +23858,55 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerPatch object.""" + """Return a `str` version of this DedicatedHostCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerPatch') -> bool: + def __eq__(self, other: 'DedicatedHostCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerPatch') -> bool: + def __ne__(self, other: 'DedicatedHostCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class BareMetalServerPrimaryNetworkInterfacePrototype(): +class DedicatedHostCollectionFirst(): """ - BareMetalServerPrimaryNetworkInterfacePrototype. + A link to the first page of resources. - :attr bool allow_ip_spoofing: (optional) Indicates whether source IP spoofing is - allowed on this interface. If false, source IP spoofing is prevented on this - interface. If true, source IP spoofing is allowed on this interface. - :attr List[int] allowed_vlans: (optional) Indicates what VLAN IDs (for VLAN type - only) can use this physical (PCI type) interface. A given VLAN can only be in - the `allowed_vlans` array for one PCI type adapter per bare metal server. - :attr bool enable_infrastructure_nat: (optional) If `true`: - - The VPC infrastructure performs any needed NAT operations. - - A single floating IP can be assigned to the network interface. - If `false`: - - Packets are passed unmodified to/from the network interface, - allowing the workload to perform any needed NAT operations. - - Multiple floating IPs can be assigned to the network interface. - - `allow_ip_spoofing` must be set to `false`. - :attr str interface_type: (optional) The network interface type: - - `pci`: a physical PCI device which can only be created or deleted when the - bare metal - server is stopped - - Has an `allowed_vlans` property which controls the VLANs that will be - permitted - to use the PCI interface - - Cannot directly use an IEEE 802.1q VLAN tag. - :attr str name: (optional) The user-defined name for network interface. Names - must be unique within the instance the network interface resides in. If - unspecified, the name will be a hyphenated list of randomly-selected words. - :attr NetworkInterfaceIPPrototype primary_ip: (optional) The primary IP address - to bind to the network interface. This can be specified using - an existing reserved IP, or a prototype object for a new reserved IP. - If an existing reserved IP or a prototype object with an address is specified, - it must - be available on the network interface's subnet. Otherwise, an available address - on the - subnet will be automatically selected and reserved. - :attr List[SecurityGroupIdentity] security_groups: (optional) The security - groups to use for this network interface. If unspecified, the VPC's default - security group is used. - :attr SubnetIdentity subnet: The associated subnet. + :attr str href: The URL for a page of resources. """ def __init__(self, - subnet: 'SubnetIdentity', - *, - allow_ip_spoofing: bool = None, - allowed_vlans: List[int] = None, - enable_infrastructure_nat: bool = None, - interface_type: str = None, - name: str = None, - primary_ip: 'NetworkInterfaceIPPrototype' = None, - security_groups: List['SecurityGroupIdentity'] = None) -> None: + href: str) -> None: """ - Initialize a BareMetalServerPrimaryNetworkInterfacePrototype object. + Initialize a DedicatedHostCollectionFirst object. - :param SubnetIdentity subnet: The associated subnet. - :param bool allow_ip_spoofing: (optional) Indicates whether source IP - spoofing is allowed on this interface. If false, source IP spoofing is - prevented on this interface. If true, source IP spoofing is allowed on this - interface. - :param List[int] allowed_vlans: (optional) Indicates what VLAN IDs (for - VLAN type only) can use this physical (PCI type) interface. A given VLAN - can only be in the `allowed_vlans` array for one PCI type adapter per bare - metal server. - :param bool enable_infrastructure_nat: (optional) If `true`: - - The VPC infrastructure performs any needed NAT operations. - - A single floating IP can be assigned to the network interface. - If `false`: - - Packets are passed unmodified to/from the network interface, - allowing the workload to perform any needed NAT operations. - - Multiple floating IPs can be assigned to the network interface. - - `allow_ip_spoofing` must be set to `false`. - :param str interface_type: (optional) The network interface type: - - `pci`: a physical PCI device which can only be created or deleted when - the bare metal - server is stopped - - Has an `allowed_vlans` property which controls the VLANs that will be - permitted - to use the PCI interface - - Cannot directly use an IEEE 802.1q VLAN tag. - :param str name: (optional) The user-defined name for network interface. - Names must be unique within the instance the network interface resides in. - If unspecified, the name will be a hyphenated list of randomly-selected - words. - :param NetworkInterfaceIPPrototype primary_ip: (optional) The primary IP - address to bind to the network interface. This can be specified using - an existing reserved IP, or a prototype object for a new reserved IP. - If an existing reserved IP or a prototype object with an address is - specified, it must - be available on the network interface's subnet. Otherwise, an available - address on the - subnet will be automatically selected and reserved. - :param List[SecurityGroupIdentity] security_groups: (optional) The security - groups to use for this network interface. If unspecified, the VPC's default - security group is used. + :param str href: The URL for a page of resources. """ - self.allow_ip_spoofing = allow_ip_spoofing - self.allowed_vlans = allowed_vlans - self.enable_infrastructure_nat = enable_infrastructure_nat - self.interface_type = interface_type - self.name = name - self.primary_ip = primary_ip - self.security_groups = security_groups - self.subnet = subnet + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerPrimaryNetworkInterfacePrototype': - """Initialize a BareMetalServerPrimaryNetworkInterfacePrototype object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostCollectionFirst': + """Initialize a DedicatedHostCollectionFirst object from a json dictionary.""" args = {} - if 'allow_ip_spoofing' in _dict: - args['allow_ip_spoofing'] = _dict.get('allow_ip_spoofing') - if 'allowed_vlans' in _dict: - args['allowed_vlans'] = _dict.get('allowed_vlans') - if 'enable_infrastructure_nat' in _dict: - args['enable_infrastructure_nat'] = _dict.get('enable_infrastructure_nat') - if 'interface_type' in _dict: - args['interface_type'] = _dict.get('interface_type') - if 'name' in _dict: - args['name'] = _dict.get('name') - if 'primary_ip' in _dict: - args['primary_ip'] = _dict.get('primary_ip') - if 'security_groups' in _dict: - args['security_groups'] = _dict.get('security_groups') - if 'subnet' in _dict: - args['subnet'] = _dict.get('subnet') + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'subnet\' not present in BareMetalServerPrimaryNetworkInterfacePrototype JSON') + raise ValueError('Required property \'href\' not present in DedicatedHostCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerPrimaryNetworkInterfacePrototype object from a json dictionary.""" + """Initialize a DedicatedHostCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'allow_ip_spoofing') and self.allow_ip_spoofing is not None: - _dict['allow_ip_spoofing'] = self.allow_ip_spoofing - if hasattr(self, 'allowed_vlans') and self.allowed_vlans is not None: - _dict['allowed_vlans'] = self.allowed_vlans - if hasattr(self, 'enable_infrastructure_nat') and self.enable_infrastructure_nat is not None: - _dict['enable_infrastructure_nat'] = self.enable_infrastructure_nat - if hasattr(self, 'interface_type') and self.interface_type is not None: - _dict['interface_type'] = self.interface_type - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'primary_ip') and self.primary_ip is not None: - if isinstance(self.primary_ip, dict): - _dict['primary_ip'] = self.primary_ip - else: - _dict['primary_ip'] = self.primary_ip.to_dict() - if hasattr(self, 'security_groups') and self.security_groups is not None: - security_groups_list = [] - for x in self.security_groups: - if isinstance(x, dict): - security_groups_list.append(x) - else: - security_groups_list.append(x.to_dict()) - _dict['security_groups'] = security_groups_list - if hasattr(self, 'subnet') and self.subnet is not None: - if isinstance(self.subnet, dict): - _dict['subnet'] = self.subnet - else: - _dict['subnet'] = self.subnet.to_dict() + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -19220,198 +23914,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerPrimaryNetworkInterfacePrototype object.""" + """Return a `str` version of this DedicatedHostCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerPrimaryNetworkInterfacePrototype') -> bool: + def __eq__(self, other: 'DedicatedHostCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerPrimaryNetworkInterfacePrototype') -> bool: + def __ne__(self, other: 'DedicatedHostCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class InterfaceTypeEnum(str, Enum): - """ - The network interface type: - - `pci`: a physical PCI device which can only be created or deleted when the bare - metal - server is stopped - - Has an `allowed_vlans` property which controls the VLANs that will be - permitted - to use the PCI interface - - Cannot directly use an IEEE 802.1q VLAN tag. - """ - PCI = 'pci' - - -class BareMetalServerProfile(): +class DedicatedHostCollectionNext(): """ - BareMetalServerProfile. + A link to the next page of resources. This property is present for all pages except + the last page. - :attr BareMetalServerProfileBandwidth bandwidth: - :attr BareMetalServerProfileCPUArchitecture cpu_architecture: - :attr BareMetalServerProfileCPUCoreCount cpu_core_count: - :attr BareMetalServerProfileCPUSocketCount cpu_socket_count: - :attr List[BareMetalServerProfileDisk] disks: Collection of the bare metal - server profile's disks. - :attr str family: The product family this bare metal server profile belongs to. - :attr str href: The URL for this bare metal server profile. - :attr BareMetalServerProfileMemory memory: - :attr str name: The name for this bare metal server profile. - :attr BareMetalServerProfileOSArchitecture os_architecture: - :attr str resource_type: The resource type. - :attr BareMetalServerProfileSupportedTrustedPlatformModuleModes - supported_trusted_platform_module_modes: The supported trusted platform module - (TPM) modes for this bare metal server profile. + :attr str href: The URL for a page of resources. """ def __init__(self, - bandwidth: 'BareMetalServerProfileBandwidth', - cpu_architecture: 'BareMetalServerProfileCPUArchitecture', - cpu_core_count: 'BareMetalServerProfileCPUCoreCount', - cpu_socket_count: 'BareMetalServerProfileCPUSocketCount', - disks: List['BareMetalServerProfileDisk'], - family: str, - href: str, - memory: 'BareMetalServerProfileMemory', - name: str, - os_architecture: 'BareMetalServerProfileOSArchitecture', - resource_type: str, - supported_trusted_platform_module_modes: 'BareMetalServerProfileSupportedTrustedPlatformModuleModes') -> None: + href: str) -> None: """ - Initialize a BareMetalServerProfile object. + Initialize a DedicatedHostCollectionNext object. - :param BareMetalServerProfileBandwidth bandwidth: - :param BareMetalServerProfileCPUArchitecture cpu_architecture: - :param BareMetalServerProfileCPUCoreCount cpu_core_count: - :param BareMetalServerProfileCPUSocketCount cpu_socket_count: - :param List[BareMetalServerProfileDisk] disks: Collection of the bare metal - server profile's disks. - :param str family: The product family this bare metal server profile - belongs to. - :param str href: The URL for this bare metal server profile. - :param BareMetalServerProfileMemory memory: - :param str name: The name for this bare metal server profile. - :param BareMetalServerProfileOSArchitecture os_architecture: - :param str resource_type: The resource type. - :param BareMetalServerProfileSupportedTrustedPlatformModuleModes - supported_trusted_platform_module_modes: The supported trusted platform - module (TPM) modes for this bare metal server profile. + :param str href: The URL for a page of resources. """ - self.bandwidth = bandwidth - self.cpu_architecture = cpu_architecture - self.cpu_core_count = cpu_core_count - self.cpu_socket_count = cpu_socket_count - self.disks = disks - self.family = family self.href = href - self.memory = memory - self.name = name - self.os_architecture = os_architecture - self.resource_type = resource_type - self.supported_trusted_platform_module_modes = supported_trusted_platform_module_modes @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerProfile': - """Initialize a BareMetalServerProfile object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostCollectionNext': + """Initialize a DedicatedHostCollectionNext object from a json dictionary.""" args = {} - if 'bandwidth' in _dict: - args['bandwidth'] = _dict.get('bandwidth') - else: - raise ValueError('Required property \'bandwidth\' not present in BareMetalServerProfile JSON') - if 'cpu_architecture' in _dict: - args['cpu_architecture'] = BareMetalServerProfileCPUArchitecture.from_dict(_dict.get('cpu_architecture')) - else: - raise ValueError('Required property \'cpu_architecture\' not present in BareMetalServerProfile JSON') - if 'cpu_core_count' in _dict: - args['cpu_core_count'] = _dict.get('cpu_core_count') - else: - raise ValueError('Required property \'cpu_core_count\' not present in BareMetalServerProfile JSON') - if 'cpu_socket_count' in _dict: - args['cpu_socket_count'] = _dict.get('cpu_socket_count') - else: - raise ValueError('Required property \'cpu_socket_count\' not present in BareMetalServerProfile JSON') - if 'disks' in _dict: - args['disks'] = [BareMetalServerProfileDisk.from_dict(x) for x in _dict.get('disks')] - else: - raise ValueError('Required property \'disks\' not present in BareMetalServerProfile JSON') - if 'family' in _dict: - args['family'] = _dict.get('family') - else: - raise ValueError('Required property \'family\' not present in BareMetalServerProfile JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in BareMetalServerProfile JSON') - if 'memory' in _dict: - args['memory'] = _dict.get('memory') - else: - raise ValueError('Required property \'memory\' not present in BareMetalServerProfile JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in BareMetalServerProfile JSON') - if 'os_architecture' in _dict: - args['os_architecture'] = BareMetalServerProfileOSArchitecture.from_dict(_dict.get('os_architecture')) - else: - raise ValueError('Required property \'os_architecture\' not present in BareMetalServerProfile JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in BareMetalServerProfile JSON') - if 'supported_trusted_platform_module_modes' in _dict: - args['supported_trusted_platform_module_modes'] = BareMetalServerProfileSupportedTrustedPlatformModuleModes.from_dict(_dict.get('supported_trusted_platform_module_modes')) - else: - raise ValueError('Required property \'supported_trusted_platform_module_modes\' not present in BareMetalServerProfile JSON') + raise ValueError('Required property \'href\' not present in DedicatedHostCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerProfile object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'bandwidth') and self.bandwidth is not None: - if isinstance(self.bandwidth, dict): - _dict['bandwidth'] = self.bandwidth - else: - _dict['bandwidth'] = self.bandwidth.to_dict() - if hasattr(self, 'cpu_architecture') and self.cpu_architecture is not None: - _dict['cpu_architecture'] = self.cpu_architecture.to_dict() - if hasattr(self, 'cpu_core_count') and self.cpu_core_count is not None: - if isinstance(self.cpu_core_count, dict): - _dict['cpu_core_count'] = self.cpu_core_count - else: - _dict['cpu_core_count'] = self.cpu_core_count.to_dict() - if hasattr(self, 'cpu_socket_count') and self.cpu_socket_count is not None: - if isinstance(self.cpu_socket_count, dict): - _dict['cpu_socket_count'] = self.cpu_socket_count - else: - _dict['cpu_socket_count'] = self.cpu_socket_count.to_dict() - if hasattr(self, 'disks') and self.disks is not None: - _dict['disks'] = [x.to_dict() for x in self.disks] - if hasattr(self, 'family') and self.family is not None: - _dict['family'] = self.family + """Initialize a DedicatedHostCollectionNext object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href - if hasattr(self, 'memory') and self.memory is not None: - if isinstance(self.memory, dict): - _dict['memory'] = self.memory - else: - _dict['memory'] = self.memory.to_dict() - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'os_architecture') and self.os_architecture is not None: - _dict['os_architecture'] = self.os_architecture.to_dict() - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type - if hasattr(self, 'supported_trusted_platform_module_modes') and self.supported_trusted_platform_module_modes is not None: - _dict['supported_trusted_platform_module_modes'] = self.supported_trusted_platform_module_modes.to_dict() return _dict def _to_dict(self): @@ -19419,99 +23971,182 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerProfile object.""" + """Return a `str` version of this DedicatedHostCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerProfile') -> bool: + def __eq__(self, other: 'DedicatedHostCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerProfile') -> bool: + def __ne__(self, other: 'DedicatedHostCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ResourceTypeEnum(str, Enum): - """ - The resource type. - """ - BARE_METAL_SERVER_PROFILE = 'bare_metal_server_profile' - - -class BareMetalServerProfileBandwidth(): - """ - BareMetalServerProfileBandwidth. - - """ - - def __init__(self) -> None: - """ - Initialize a BareMetalServerProfileBandwidth object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['BareMetalServerProfileBandwidthFixed', 'BareMetalServerProfileBandwidthRange', 'BareMetalServerProfileBandwidthEnum', 'BareMetalServerProfileBandwidthDependent'])) - raise Exception(msg) - -class BareMetalServerProfileCPUArchitecture(): +class DedicatedHostDisk(): """ - BareMetalServerProfileCPUArchitecture. + DedicatedHostDisk. - :attr str default: (optional) The default CPU architecture for a bare metal - server with this profile. - :attr str type: The type for this profile field. - :attr str value: The CPU architecture for a bare metal server with this profile. + :attr int available: The remaining space left for instance placement in GB + (gigabytes). + :attr datetime created_at: The date and time that the disk was created. + :attr str href: The URL for this disk. + :attr str id: The unique identifier for this disk. + :attr List[InstanceDiskReference] instance_disks: Instance disks that are on + this dedicated host disk. + :attr str interface_type: The disk interface used for attaching the disk + The enumerated values for this property are expected to expand in the future. + When processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the resource on which the unexpected + property value was encountered. + :attr str lifecycle_state: (optional) The lifecycle state of this dedicated host + disk. + :attr str name: The user-defined or system-provided name for this disk. + :attr bool provisionable: Indicates whether this dedicated host disk is + available for instance disk creation. + :attr str resource_type: The resource type. + :attr int size: The size of the disk in GB (gigabytes). + :attr List[str] supported_instance_interface_types: The instance disk interfaces + supported for this dedicated host disk. """ def __init__(self, - type: str, - value: str, + available: int, + created_at: datetime, + href: str, + id: str, + instance_disks: List['InstanceDiskReference'], + interface_type: str, + name: str, + provisionable: bool, + resource_type: str, + size: int, + supported_instance_interface_types: List[str], *, - default: str = None) -> None: + lifecycle_state: str = None) -> None: """ - Initialize a BareMetalServerProfileCPUArchitecture object. + Initialize a DedicatedHostDisk object. - :param str type: The type for this profile field. - :param str value: The CPU architecture for a bare metal server with this - profile. - :param str default: (optional) The default CPU architecture for a bare - metal server with this profile. + :param int available: The remaining space left for instance placement in GB + (gigabytes). + :param datetime created_at: The date and time that the disk was created. + :param str href: The URL for this disk. + :param str id: The unique identifier for this disk. + :param List[InstanceDiskReference] instance_disks: Instance disks that are + on this dedicated host disk. + :param str interface_type: The disk interface used for attaching the disk + The enumerated values for this property are expected to expand in the + future. When processing this property, check for and log unknown values. + Optionally halt processing and surface the error, or bypass the resource on + which the unexpected property value was encountered. + :param str name: The user-defined or system-provided name for this disk. + :param bool provisionable: Indicates whether this dedicated host disk is + available for instance disk creation. + :param str resource_type: The resource type. + :param int size: The size of the disk in GB (gigabytes). + :param List[str] supported_instance_interface_types: The instance disk + interfaces supported for this dedicated host disk. + :param str lifecycle_state: (optional) The lifecycle state of this + dedicated host disk. """ - self.default = default - self.type = type - self.value = value + self.available = available + self.created_at = created_at + self.href = href + self.id = id + self.instance_disks = instance_disks + self.interface_type = interface_type + self.lifecycle_state = lifecycle_state + self.name = name + self.provisionable = provisionable + self.resource_type = resource_type + self.size = size + self.supported_instance_interface_types = supported_instance_interface_types @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerProfileCPUArchitecture': - """Initialize a BareMetalServerProfileCPUArchitecture object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostDisk': + """Initialize a DedicatedHostDisk object from a json dictionary.""" args = {} - if 'default' in _dict: - args['default'] = _dict.get('default') - if 'type' in _dict: - args['type'] = _dict.get('type') + if 'available' in _dict: + args['available'] = _dict.get('available') else: - raise ValueError('Required property \'type\' not present in BareMetalServerProfileCPUArchitecture JSON') - if 'value' in _dict: - args['value'] = _dict.get('value') + raise ValueError('Required property \'available\' not present in DedicatedHostDisk JSON') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError('Required property \'value\' not present in BareMetalServerProfileCPUArchitecture JSON') + raise ValueError('Required property \'created_at\' not present in DedicatedHostDisk JSON') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in DedicatedHostDisk JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in DedicatedHostDisk JSON') + if 'instance_disks' in _dict: + args['instance_disks'] = [InstanceDiskReference.from_dict(x) for x in _dict.get('instance_disks')] + else: + raise ValueError('Required property \'instance_disks\' not present in DedicatedHostDisk JSON') + if 'interface_type' in _dict: + args['interface_type'] = _dict.get('interface_type') + else: + raise ValueError('Required property \'interface_type\' not present in DedicatedHostDisk JSON') + if 'lifecycle_state' in _dict: + args['lifecycle_state'] = _dict.get('lifecycle_state') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in DedicatedHostDisk JSON') + if 'provisionable' in _dict: + args['provisionable'] = _dict.get('provisionable') + else: + raise ValueError('Required property \'provisionable\' not present in DedicatedHostDisk JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in DedicatedHostDisk JSON') + if 'size' in _dict: + args['size'] = _dict.get('size') + else: + raise ValueError('Required property \'size\' not present in DedicatedHostDisk JSON') + if 'supported_instance_interface_types' in _dict: + args['supported_instance_interface_types'] = _dict.get('supported_instance_interface_types') + else: + raise ValueError('Required property \'supported_instance_interface_types\' not present in DedicatedHostDisk JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerProfileCPUArchitecture object from a json dictionary.""" + """Initialize a DedicatedHostDisk object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'default') and self.default is not None: - _dict['default'] = self.default - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type - if hasattr(self, 'value') and self.value is not None: - _dict['value'] = self.value + if hasattr(self, 'available') and self.available is not None: + _dict['available'] = self.available + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'instance_disks') and self.instance_disks is not None: + _dict['instance_disks'] = [x.to_dict() for x in self.instance_disks] + if hasattr(self, 'interface_type') and self.interface_type is not None: + _dict['interface_type'] = self.interface_type + if hasattr(self, 'lifecycle_state') and self.lifecycle_state is not None: + _dict['lifecycle_state'] = self.lifecycle_state + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'provisionable') and self.provisionable is not None: + _dict['provisionable'] = self.provisionable + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + if hasattr(self, 'size') and self.size is not None: + _dict['size'] = self.size + if hasattr(self, 'supported_instance_interface_types') and self.supported_instance_interface_types is not None: + _dict['supported_instance_interface_types'] = self.supported_instance_interface_types return _dict def _to_dict(self): @@ -19519,141 +24154,99 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerProfileCPUArchitecture object.""" + """Return a `str` version of this DedicatedHostDisk object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerProfileCPUArchitecture') -> bool: + def __eq__(self, other: 'DedicatedHostDisk') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerProfileCPUArchitecture') -> bool: + def __ne__(self, other: 'DedicatedHostDisk') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class TypeEnum(str, Enum): + class InterfaceTypeEnum(str, Enum): """ - The type for this profile field. + The disk interface used for attaching the disk + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the resource on which the unexpected + property value was encountered. """ - FIXED = 'fixed' + NVME = 'nvme' -class BareMetalServerProfileCPUCoreCount(): - """ - BareMetalServerProfileCPUCoreCount. + class LifecycleStateEnum(str, Enum): + """ + The lifecycle state of this dedicated host disk. + """ + DELETING = 'deleting' + FAILED = 'failed' + PENDING = 'pending' + STABLE = 'stable' + SUSPENDED = 'suspended' + UPDATING = 'updating' + WAITING = 'waiting' - """ - def __init__(self) -> None: + class ResourceTypeEnum(str, Enum): """ - Initialize a BareMetalServerProfileCPUCoreCount object. - + The resource type. """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['BareMetalServerProfileCPUCoreCountFixed', 'BareMetalServerProfileCPUCoreCountRange', 'BareMetalServerProfileCPUCoreCountEnum', 'BareMetalServerProfileCPUCoreCountDependent'])) - raise Exception(msg) - -class BareMetalServerProfileCPUSocketCount(): - """ - BareMetalServerProfileCPUSocketCount. + DEDICATED_HOST_DISK = 'dedicated_host_disk' - """ - def __init__(self) -> None: + class SupportedInstanceInterfaceTypesEnum(str, Enum): """ - Initialize a BareMetalServerProfileCPUSocketCount object. - + The disk interface used for attaching the disk. + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the resource on which the unexpected + property value was encountered. """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['BareMetalServerProfileCPUSocketCountFixed', 'BareMetalServerProfileCPUSocketCountRange', 'BareMetalServerProfileCPUSocketCountEnum', 'BareMetalServerProfileCPUSocketCountDependent'])) - raise Exception(msg) + NVME = 'nvme' + VIRTIO_BLK = 'virtio_blk' -class BareMetalServerProfileCollection(): + +class DedicatedHostDiskCollection(): """ - BareMetalServerProfileCollection. + DedicatedHostDiskCollection. - :attr BareMetalServerProfileCollectionFirst first: A link to the first page of - resources. - :attr int limit: The maximum number of resources that can be returned by the - request. - :attr BareMetalServerProfileCollectionNext next: (optional) A link to the next - page of resources. This property is present for all pages - except the last page. - :attr List[BareMetalServerProfile] profiles: Collection of bare metal server - profiles. - :attr int total_count: The total number of resources across all pages. + :attr List[DedicatedHostDisk] disks: Collection of the dedicated host's disks. """ def __init__(self, - first: 'BareMetalServerProfileCollectionFirst', - limit: int, - profiles: List['BareMetalServerProfile'], - total_count: int, - *, - next: 'BareMetalServerProfileCollectionNext' = None) -> None: + disks: List['DedicatedHostDisk']) -> None: """ - Initialize a BareMetalServerProfileCollection object. + Initialize a DedicatedHostDiskCollection object. - :param BareMetalServerProfileCollectionFirst first: A link to the first - page of resources. - :param int limit: The maximum number of resources that can be returned by - the request. - :param List[BareMetalServerProfile] profiles: Collection of bare metal - server profiles. - :param int total_count: The total number of resources across all pages. - :param BareMetalServerProfileCollectionNext next: (optional) A link to the - next page of resources. This property is present for all pages - except the last page. + :param List[DedicatedHostDisk] disks: Collection of the dedicated host's + disks. """ - self.first = first - self.limit = limit - self.next = next - self.profiles = profiles - self.total_count = total_count + self.disks = disks @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerProfileCollection': - """Initialize a BareMetalServerProfileCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostDiskCollection': + """Initialize a DedicatedHostDiskCollection object from a json dictionary.""" args = {} - if 'first' in _dict: - args['first'] = BareMetalServerProfileCollectionFirst.from_dict(_dict.get('first')) - else: - raise ValueError('Required property \'first\' not present in BareMetalServerProfileCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') - else: - raise ValueError('Required property \'limit\' not present in BareMetalServerProfileCollection JSON') - if 'next' in _dict: - args['next'] = BareMetalServerProfileCollectionNext.from_dict(_dict.get('next')) - if 'profiles' in _dict: - args['profiles'] = [BareMetalServerProfile.from_dict(x) for x in _dict.get('profiles')] - else: - raise ValueError('Required property \'profiles\' not present in BareMetalServerProfileCollection JSON') - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') + if 'disks' in _dict: + args['disks'] = [DedicatedHostDisk.from_dict(x) for x in _dict.get('disks')] else: - raise ValueError('Required property \'total_count\' not present in BareMetalServerProfileCollection JSON') + raise ValueError('Required property \'disks\' not present in DedicatedHostDiskCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerProfileCollection object from a json dictionary.""" + """Initialize a DedicatedHostDiskCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'profiles') and self.profiles is not None: - _dict['profiles'] = [x.to_dict() for x in self.profiles] - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count + if hasattr(self, 'disks') and self.disks is not None: + _dict['disks'] = [x.to_dict() for x in self.disks] return _dict def _to_dict(self): @@ -19661,55 +24254,54 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerProfileCollection object.""" + """Return a `str` version of this DedicatedHostDiskCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerProfileCollection') -> bool: + def __eq__(self, other: 'DedicatedHostDiskCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerProfileCollection') -> bool: + def __ne__(self, other: 'DedicatedHostDiskCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class BareMetalServerProfileCollectionFirst(): +class DedicatedHostDiskPatch(): """ - A link to the first page of resources. + DedicatedHostDiskPatch. - :attr str href: The URL for a page of resources. + :attr str name: (optional) The user-defined name for this disk. """ def __init__(self, - href: str) -> None: + *, + name: str = None) -> None: """ - Initialize a BareMetalServerProfileCollectionFirst object. + Initialize a DedicatedHostDiskPatch object. - :param str href: The URL for a page of resources. + :param str name: (optional) The user-defined name for this disk. """ - self.href = href + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerProfileCollectionFirst': - """Initialize a BareMetalServerProfileCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostDiskPatch': + """Initialize a DedicatedHostDiskPatch object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in BareMetalServerProfileCollectionFirst JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerProfileCollectionFirst object from a json dictionary.""" + """Initialize a DedicatedHostDiskPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -19717,56 +24309,176 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerProfileCollectionFirst object.""" + """Return a `str` version of this DedicatedHostDiskPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerProfileCollectionFirst') -> bool: + def __eq__(self, other: 'DedicatedHostDiskPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerProfileCollectionFirst') -> bool: + def __ne__(self, other: 'DedicatedHostDiskPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class BareMetalServerProfileCollectionNext(): +class DedicatedHostGroup(): """ - A link to the next page of resources. This property is present for all pages except - the last page. + DedicatedHostGroup. - :attr str href: The URL for a page of resources. + :attr str class_: The dedicated host profile class for hosts in this group. + :attr datetime created_at: The date and time that the dedicated host group was + created. + :attr str crn: The CRN for this dedicated host group. + :attr List[DedicatedHostReference] dedicated_hosts: The dedicated hosts that are + in this dedicated host group. + :attr str family: The dedicated host profile family for hosts in this group. + :attr str href: The URL for this dedicated host group. + :attr str id: The unique identifier for this dedicated host group. + :attr str name: The unique user-defined name for this dedicated host group. + :attr ResourceGroupReference resource_group: The resource group for this + dedicated host group. + :attr str resource_type: The resource type. + :attr List[InstanceProfileReference] supported_instance_profiles: The instance + profiles usable by instances placed on this dedicated host group. + :attr ZoneReference zone: The zone this dedicated host group resides in. """ def __init__(self, - href: str) -> None: + class_: str, + created_at: datetime, + crn: str, + dedicated_hosts: List['DedicatedHostReference'], + family: str, + href: str, + id: str, + name: str, + resource_group: 'ResourceGroupReference', + resource_type: str, + supported_instance_profiles: List['InstanceProfileReference'], + zone: 'ZoneReference') -> None: """ - Initialize a BareMetalServerProfileCollectionNext object. + Initialize a DedicatedHostGroup object. - :param str href: The URL for a page of resources. + :param str class_: The dedicated host profile class for hosts in this + group. + :param datetime created_at: The date and time that the dedicated host group + was created. + :param str crn: The CRN for this dedicated host group. + :param List[DedicatedHostReference] dedicated_hosts: The dedicated hosts + that are in this dedicated host group. + :param str family: The dedicated host profile family for hosts in this + group. + :param str href: The URL for this dedicated host group. + :param str id: The unique identifier for this dedicated host group. + :param str name: The unique user-defined name for this dedicated host + group. + :param ResourceGroupReference resource_group: The resource group for this + dedicated host group. + :param str resource_type: The resource type. + :param List[InstanceProfileReference] supported_instance_profiles: The + instance profiles usable by instances placed on this dedicated host group. + :param ZoneReference zone: The zone this dedicated host group resides in. """ + self.class_ = class_ + self.created_at = created_at + self.crn = crn + self.dedicated_hosts = dedicated_hosts + self.family = family self.href = href + self.id = id + self.name = name + self.resource_group = resource_group + self.resource_type = resource_type + self.supported_instance_profiles = supported_instance_profiles + self.zone = zone @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerProfileCollectionNext': - """Initialize a BareMetalServerProfileCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostGroup': + """Initialize a DedicatedHostGroup object from a json dictionary.""" args = {} + if 'class' in _dict: + args['class_'] = _dict.get('class') + else: + raise ValueError('Required property \'class\' not present in DedicatedHostGroup JSON') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) + else: + raise ValueError('Required property \'created_at\' not present in DedicatedHostGroup JSON') + if 'crn' in _dict: + args['crn'] = _dict.get('crn') + else: + raise ValueError('Required property \'crn\' not present in DedicatedHostGroup JSON') + if 'dedicated_hosts' in _dict: + args['dedicated_hosts'] = [DedicatedHostReference.from_dict(x) for x in _dict.get('dedicated_hosts')] + else: + raise ValueError('Required property \'dedicated_hosts\' not present in DedicatedHostGroup JSON') + if 'family' in _dict: + args['family'] = _dict.get('family') + else: + raise ValueError('Required property \'family\' not present in DedicatedHostGroup JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in BareMetalServerProfileCollectionNext JSON') + raise ValueError('Required property \'href\' not present in DedicatedHostGroup JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in DedicatedHostGroup JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in DedicatedHostGroup JSON') + if 'resource_group' in _dict: + args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) + else: + raise ValueError('Required property \'resource_group\' not present in DedicatedHostGroup JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in DedicatedHostGroup JSON') + if 'supported_instance_profiles' in _dict: + args['supported_instance_profiles'] = [InstanceProfileReference.from_dict(x) for x in _dict.get('supported_instance_profiles')] + else: + raise ValueError('Required property \'supported_instance_profiles\' not present in DedicatedHostGroup JSON') + if 'zone' in _dict: + args['zone'] = ZoneReference.from_dict(_dict.get('zone')) + else: + raise ValueError('Required property \'zone\' not present in DedicatedHostGroup JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerProfileCollectionNext object from a json dictionary.""" + """Initialize a DedicatedHostGroup object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'class_') and self.class_ is not None: + _dict['class'] = self.class_ + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'dedicated_hosts') and self.dedicated_hosts is not None: + _dict['dedicated_hosts'] = [x.to_dict() for x in self.dedicated_hosts] + if hasattr(self, 'family') and self.family is not None: + _dict['family'] = self.family if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'resource_group') and self.resource_group is not None: + _dict['resource_group'] = self.resource_group.to_dict() + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + if hasattr(self, 'supported_instance_profiles') and self.supported_instance_profiles is not None: + _dict['supported_instance_profiles'] = [x.to_dict() for x in self.supported_instance_profiles] + if hasattr(self, 'zone') and self.zone is not None: + _dict['zone'] = self.zone.to_dict() return _dict def _to_dict(self): @@ -19774,82 +24486,119 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerProfileCollectionNext object.""" + """Return a `str` version of this DedicatedHostGroup object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerProfileCollectionNext') -> bool: + def __eq__(self, other: 'DedicatedHostGroup') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerProfileCollectionNext') -> bool: + def __ne__(self, other: 'DedicatedHostGroup') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class BareMetalServerProfileDisk(): + class FamilyEnum(str, Enum): + """ + The dedicated host profile family for hosts in this group. + """ + BALANCED = 'balanced' + COMPUTE = 'compute' + MEMORY = 'memory' + + + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + DEDICATED_HOST_GROUP = 'dedicated_host_group' + + +class DedicatedHostGroupCollection(): """ - Disks provided by this profile. + DedicatedHostGroupCollection. - :attr BareMetalServerProfileDiskQuantity quantity: - :attr BareMetalServerProfileDiskSize size: - :attr BareMetalServerProfileDiskSupportedInterfaces supported_interface_types: + :attr DedicatedHostGroupCollectionFirst first: A link to the first page of + resources. + :attr List[DedicatedHostGroup] groups: Collection of dedicated host groups. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr DedicatedHostGroupCollectionNext next: (optional) A link to the next page + of resources. This property is present for all pages + except the last page. + :attr int total_count: The total number of resources across all pages. """ def __init__(self, - quantity: 'BareMetalServerProfileDiskQuantity', - size: 'BareMetalServerProfileDiskSize', - supported_interface_types: 'BareMetalServerProfileDiskSupportedInterfaces') -> None: + first: 'DedicatedHostGroupCollectionFirst', + groups: List['DedicatedHostGroup'], + limit: int, + total_count: int, + *, + next: 'DedicatedHostGroupCollectionNext' = None) -> None: """ - Initialize a BareMetalServerProfileDisk object. + Initialize a DedicatedHostGroupCollection object. - :param BareMetalServerProfileDiskQuantity quantity: - :param BareMetalServerProfileDiskSize size: - :param BareMetalServerProfileDiskSupportedInterfaces - supported_interface_types: + :param DedicatedHostGroupCollectionFirst first: A link to the first page of + resources. + :param List[DedicatedHostGroup] groups: Collection of dedicated host + groups. + :param int limit: The maximum number of resources that can be returned by + the request. + :param int total_count: The total number of resources across all pages. + :param DedicatedHostGroupCollectionNext next: (optional) A link to the next + page of resources. This property is present for all pages + except the last page. """ - self.quantity = quantity - self.size = size - self.supported_interface_types = supported_interface_types + self.first = first + self.groups = groups + self.limit = limit + self.next = next + self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerProfileDisk': - """Initialize a BareMetalServerProfileDisk object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostGroupCollection': + """Initialize a DedicatedHostGroupCollection object from a json dictionary.""" args = {} - if 'quantity' in _dict: - args['quantity'] = _dict.get('quantity') + if 'first' in _dict: + args['first'] = DedicatedHostGroupCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'quantity\' not present in BareMetalServerProfileDisk JSON') - if 'size' in _dict: - args['size'] = _dict.get('size') + raise ValueError('Required property \'first\' not present in DedicatedHostGroupCollection JSON') + if 'groups' in _dict: + args['groups'] = [DedicatedHostGroup.from_dict(x) for x in _dict.get('groups')] else: - raise ValueError('Required property \'size\' not present in BareMetalServerProfileDisk JSON') - if 'supported_interface_types' in _dict: - args['supported_interface_types'] = BareMetalServerProfileDiskSupportedInterfaces.from_dict(_dict.get('supported_interface_types')) + raise ValueError('Required property \'groups\' not present in DedicatedHostGroupCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') else: - raise ValueError('Required property \'supported_interface_types\' not present in BareMetalServerProfileDisk JSON') + raise ValueError('Required property \'limit\' not present in DedicatedHostGroupCollection JSON') + if 'next' in _dict: + args['next'] = DedicatedHostGroupCollectionNext.from_dict(_dict.get('next')) + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') + else: + raise ValueError('Required property \'total_count\' not present in DedicatedHostGroupCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerProfileDisk object from a json dictionary.""" + """Initialize a DedicatedHostGroupCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'quantity') and self.quantity is not None: - if isinstance(self.quantity, dict): - _dict['quantity'] = self.quantity - else: - _dict['quantity'] = self.quantity.to_dict() - if hasattr(self, 'size') and self.size is not None: - if isinstance(self.size, dict): - _dict['size'] = self.size - else: - _dict['size'] = self.size.to_dict() - if hasattr(self, 'supported_interface_types') and self.supported_interface_types is not None: - _dict['supported_interface_types'] = self.supported_interface_types.to_dict() + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'groups') and self.groups is not None: + _dict['groups'] = [x.to_dict() for x in self.groups] + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count return _dict def _to_dict(self): @@ -19857,115 +24606,55 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerProfileDisk object.""" + """Return a `str` version of this DedicatedHostGroupCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerProfileDisk') -> bool: + def __eq__(self, other: 'DedicatedHostGroupCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerProfileDisk') -> bool: + def __ne__(self, other: 'DedicatedHostGroupCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class BareMetalServerProfileDiskQuantity(): - """ - BareMetalServerProfileDiskQuantity. - - """ - - def __init__(self) -> None: - """ - Initialize a BareMetalServerProfileDiskQuantity object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['BareMetalServerProfileDiskQuantityFixed', 'BareMetalServerProfileDiskQuantityRange', 'BareMetalServerProfileDiskQuantityEnum', 'BareMetalServerProfileDiskQuantityDependent'])) - raise Exception(msg) - -class BareMetalServerProfileDiskSize(): - """ - BareMetalServerProfileDiskSize. - - """ - - def __init__(self) -> None: - """ - Initialize a BareMetalServerProfileDiskSize object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['BareMetalServerProfileDiskSizeFixed', 'BareMetalServerProfileDiskSizeRange', 'BareMetalServerProfileDiskSizeEnum', 'BareMetalServerProfileDiskSizeDependent'])) - raise Exception(msg) - -class BareMetalServerProfileDiskSupportedInterfaces(): +class DedicatedHostGroupCollectionFirst(): """ - BareMetalServerProfileDiskSupportedInterfaces. + A link to the first page of resources. - :attr str default: The disk interface used for attaching the disk. - The enumerated values for this property are expected to expand in the future. - When processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the resource on which the unexpected - property value was encountered. - :attr str type: The type for this profile field. - :attr List[str] values: The supported disk interfaces used for attaching the - disk. + :attr str href: The URL for a page of resources. """ def __init__(self, - default: str, - type: str, - values: List[str]) -> None: + href: str) -> None: """ - Initialize a BareMetalServerProfileDiskSupportedInterfaces object. + Initialize a DedicatedHostGroupCollectionFirst object. - :param str default: The disk interface used for attaching the disk. - The enumerated values for this property are expected to expand in the - future. When processing this property, check for and log unknown values. - Optionally halt processing and surface the error, or bypass the resource on - which the unexpected property value was encountered. - :param str type: The type for this profile field. - :param List[str] values: The supported disk interfaces used for attaching - the disk. + :param str href: The URL for a page of resources. """ - self.default = default - self.type = type - self.values = values + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerProfileDiskSupportedInterfaces': - """Initialize a BareMetalServerProfileDiskSupportedInterfaces object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostGroupCollectionFirst': + """Initialize a DedicatedHostGroupCollectionFirst object from a json dictionary.""" args = {} - if 'default' in _dict: - args['default'] = _dict.get('default') - else: - raise ValueError('Required property \'default\' not present in BareMetalServerProfileDiskSupportedInterfaces JSON') - if 'type' in _dict: - args['type'] = _dict.get('type') - else: - raise ValueError('Required property \'type\' not present in BareMetalServerProfileDiskSupportedInterfaces JSON') - if 'values' in _dict: - args['values'] = _dict.get('values') + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'values\' not present in BareMetalServerProfileDiskSupportedInterfaces JSON') + raise ValueError('Required property \'href\' not present in DedicatedHostGroupCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerProfileDiskSupportedInterfaces object from a json dictionary.""" + """Initialize a DedicatedHostGroupCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'default') and self.default is not None: - _dict['default'] = self.default - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type - if hasattr(self, 'values') and self.values is not None: - _dict['values'] = self.values + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -19973,140 +24662,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerProfileDiskSupportedInterfaces object.""" + """Return a `str` version of this DedicatedHostGroupCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerProfileDiskSupportedInterfaces') -> bool: + def __eq__(self, other: 'DedicatedHostGroupCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerProfileDiskSupportedInterfaces') -> bool: + def __ne__(self, other: 'DedicatedHostGroupCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class DefaultEnum(str, Enum): - """ - The disk interface used for attaching the disk. - The enumerated values for this property are expected to expand in the future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the resource on which the unexpected - property value was encountered. - """ - NVME = 'nvme' - SATA = 'sata' - - - class TypeEnum(str, Enum): - """ - The type for this profile field. - """ - ENUM = 'enum' - - - class ValuesEnum(str, Enum): - """ - The disk interface used for attaching the disk. - The enumerated values for this property are expected to expand in the future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the resource on which the unexpected - property value was encountered. - """ - NVME = 'nvme' - SATA = 'sata' - - -class BareMetalServerProfileIdentity(): - """ - Identifies a bare metal server profile by a unique property. - - """ - - def __init__(self) -> None: - """ - Initialize a BareMetalServerProfileIdentity object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['BareMetalServerProfileIdentityByName', 'BareMetalServerProfileIdentityByHref'])) - raise Exception(msg) - -class BareMetalServerProfileMemory(): - """ - BareMetalServerProfileMemory. - - """ - - def __init__(self) -> None: - """ - Initialize a BareMetalServerProfileMemory object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['BareMetalServerProfileMemoryFixed', 'BareMetalServerProfileMemoryRange', 'BareMetalServerProfileMemoryEnum', 'BareMetalServerProfileMemoryDependent'])) - raise Exception(msg) - -class BareMetalServerProfileOSArchitecture(): +class DedicatedHostGroupCollectionNext(): """ - BareMetalServerProfileOSArchitecture. + A link to the next page of resources. This property is present for all pages except + the last page. - :attr str default: The default OS architecture for a bare metal server with this - profile. - :attr str type: The type for this profile field. - :attr List[str] values: The supported OS architecture(s) for a bare metal server - with this profile. + :attr str href: The URL for a page of resources. """ def __init__(self, - default: str, - type: str, - values: List[str]) -> None: + href: str) -> None: """ - Initialize a BareMetalServerProfileOSArchitecture object. + Initialize a DedicatedHostGroupCollectionNext object. - :param str default: The default OS architecture for a bare metal server - with this profile. - :param str type: The type for this profile field. - :param List[str] values: The supported OS architecture(s) for a bare metal - server with this profile. + :param str href: The URL for a page of resources. """ - self.default = default - self.type = type - self.values = values + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerProfileOSArchitecture': - """Initialize a BareMetalServerProfileOSArchitecture object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostGroupCollectionNext': + """Initialize a DedicatedHostGroupCollectionNext object from a json dictionary.""" args = {} - if 'default' in _dict: - args['default'] = _dict.get('default') - else: - raise ValueError('Required property \'default\' not present in BareMetalServerProfileOSArchitecture JSON') - if 'type' in _dict: - args['type'] = _dict.get('type') - else: - raise ValueError('Required property \'type\' not present in BareMetalServerProfileOSArchitecture JSON') - if 'values' in _dict: - args['values'] = _dict.get('values') + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'values\' not present in BareMetalServerProfileOSArchitecture JSON') + raise ValueError('Required property \'href\' not present in DedicatedHostGroupCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerProfileOSArchitecture object from a json dictionary.""" + """Initialize a DedicatedHostGroupCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'default') and self.default is not None: - _dict['default'] = self.default - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type - if hasattr(self, 'values') and self.values is not None: - _dict['values'] = self.values + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -20114,82 +24719,71 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerProfileOSArchitecture object.""" + """Return a `str` version of this DedicatedHostGroupCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerProfileOSArchitecture') -> bool: + def __eq__(self, other: 'DedicatedHostGroupCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerProfileOSArchitecture') -> bool: + def __ne__(self, other: 'DedicatedHostGroupCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class TypeEnum(str, Enum): - """ - The type for this profile field. +class DedicatedHostGroupIdentity(): + """ + Identifies a dedicated host group by a unique property. + + """ + + def __init__(self) -> None: """ - ENUM = 'enum' + Initialize a DedicatedHostGroupIdentity object. + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['DedicatedHostGroupIdentityById', 'DedicatedHostGroupIdentityByCRN', 'DedicatedHostGroupIdentityByHref'])) + raise Exception(msg) -class BareMetalServerProfileReference(): +class DedicatedHostGroupPatch(): """ - BareMetalServerProfileReference. + DedicatedHostGroupPatch. - :attr str href: The URL for this bare metal server profile. - :attr str name: The name for this bare metal server profile. - :attr str resource_type: The resource type. + :attr str name: (optional) The unique user-defined name for this dedicated host + group. """ def __init__(self, - href: str, - name: str, - resource_type: str) -> None: + *, + name: str = None) -> None: """ - Initialize a BareMetalServerProfileReference object. + Initialize a DedicatedHostGroupPatch object. - :param str href: The URL for this bare metal server profile. - :param str name: The name for this bare metal server profile. - :param str resource_type: The resource type. + :param str name: (optional) The unique user-defined name for this dedicated + host group. """ - self.href = href self.name = name - self.resource_type = resource_type @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerProfileReference': - """Initialize a BareMetalServerProfileReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostGroupPatch': + """Initialize a DedicatedHostGroupPatch object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in BareMetalServerProfileReference JSON') if 'name' in _dict: args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in BareMetalServerProfileReference JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in BareMetalServerProfileReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerProfileReference object from a json dictionary.""" + """Initialize a DedicatedHostGroupPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type return _dict def _to_dict(self): @@ -20197,72 +24791,69 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerProfileReference object.""" + """Return a `str` version of this DedicatedHostGroupPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerProfileReference') -> bool: + def __eq__(self, other: 'DedicatedHostGroupPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerProfileReference') -> bool: + def __ne__(self, other: 'DedicatedHostGroupPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ResourceTypeEnum(str, Enum): - """ - The resource type. - """ - BARE_METAL_SERVER_PROFILE = 'bare_metal_server_profile' - - -class BareMetalServerProfileSupportedTrustedPlatformModuleModes(): +class DedicatedHostGroupPrototypeDedicatedHostByZoneContext(): """ - The supported trusted platform module (TPM) modes for this bare metal server profile. + DedicatedHostGroupPrototypeDedicatedHostByZoneContext. - :attr str type: The type for this profile field. - :attr List[str] values: The supported trusted platform module (TPM) modes. + :attr str name: (optional) The unique user-defined name for this dedicated host + group. + :attr ResourceGroupIdentity resource_group: (optional) The resource group to + use. If unspecified, the host's resource group is used. """ def __init__(self, - type: str, - values: List[str]) -> None: + *, + name: str = None, + resource_group: 'ResourceGroupIdentity' = None) -> None: """ - Initialize a BareMetalServerProfileSupportedTrustedPlatformModuleModes object. + Initialize a DedicatedHostGroupPrototypeDedicatedHostByZoneContext object. - :param str type: The type for this profile field. - :param List[str] values: The supported trusted platform module (TPM) modes. + :param str name: (optional) The unique user-defined name for this dedicated + host group. + :param ResourceGroupIdentity resource_group: (optional) The resource group + to use. If unspecified, the host's resource group is used. """ - self.type = type - self.values = values + self.name = name + self.resource_group = resource_group @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerProfileSupportedTrustedPlatformModuleModes': - """Initialize a BareMetalServerProfileSupportedTrustedPlatformModuleModes object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostGroupPrototypeDedicatedHostByZoneContext': + """Initialize a DedicatedHostGroupPrototypeDedicatedHostByZoneContext object from a json dictionary.""" args = {} - if 'type' in _dict: - args['type'] = _dict.get('type') - else: - raise ValueError('Required property \'type\' not present in BareMetalServerProfileSupportedTrustedPlatformModuleModes JSON') - if 'values' in _dict: - args['values'] = _dict.get('values') - else: - raise ValueError('Required property \'values\' not present in BareMetalServerProfileSupportedTrustedPlatformModuleModes JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + if 'resource_group' in _dict: + args['resource_group'] = _dict.get('resource_group') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerProfileSupportedTrustedPlatformModuleModes object from a json dictionary.""" + """Initialize a DedicatedHostGroupPrototypeDedicatedHostByZoneContext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type - if hasattr(self, 'values') and self.values is not None: - _dict['values'] = self.values + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'resource_group') and self.resource_group is not None: + if isinstance(self.resource_group, dict): + _dict['resource_group'] = self.resource_group + else: + _dict['resource_group'] = self.resource_group.to_dict() return _dict def _to_dict(self): @@ -20270,109 +24861,110 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerProfileSupportedTrustedPlatformModuleModes object.""" + """Return a `str` version of this DedicatedHostGroupPrototypeDedicatedHostByZoneContext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerProfileSupportedTrustedPlatformModuleModes') -> bool: + def __eq__(self, other: 'DedicatedHostGroupPrototypeDedicatedHostByZoneContext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerProfileSupportedTrustedPlatformModuleModes') -> bool: + def __ne__(self, other: 'DedicatedHostGroupPrototypeDedicatedHostByZoneContext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class TypeEnum(str, Enum): - """ - The type for this profile field. - """ - ENUM = 'enum' - - - class ValuesEnum(str, Enum): - """ - The mode for the trusted platform module (TPM): - - `tpm_2`: Standard TPM 2 capabilities - - `tpm_2_with_txt`: Standard TPM 2 with Intel Trusted Execution Technology (TXT) - The enumerated values for this property are expected to expand in the future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the resource on which the unexpected - property value was encountered. - """ - TPM_2 = 'tpm_2' - TPM_2_WITH_TXT = 'tpm_2_with_txt' - - -class BareMetalServerStatusReason(): +class DedicatedHostGroupReference(): """ - BareMetalServerStatusReason. + DedicatedHostGroupReference. - :attr str code: The status reason code: - - `cannot_start`: Failed to start due to an internal error - - `cannot_start_capacity`: Insufficient capacity within the selected zone - - `cannot_start_compute`: An error occurred while allocating compute resources - - `cannot_start_ip_address`: An error occurred while allocating an IP address - - `cannot_start_network`: An error occurred while allocating network resources. - :attr str message: An explanation of the status reason. - :attr str more_info: (optional) Link to documentation about this status reason. + :attr str crn: The CRN for this dedicated host group. + :attr DedicatedHostGroupReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str href: The URL for this dedicated host group. + :attr str id: The unique identifier for this dedicated host group. + :attr str name: The unique user-defined name for this dedicated host group. + :attr str resource_type: The resource type. """ def __init__(self, - code: str, - message: str, + crn: str, + href: str, + id: str, + name: str, + resource_type: str, *, - more_info: str = None) -> None: + deleted: 'DedicatedHostGroupReferenceDeleted' = None) -> None: """ - Initialize a BareMetalServerStatusReason object. + Initialize a DedicatedHostGroupReference object. - :param str code: The status reason code: - - `cannot_start`: Failed to start due to an internal error - - `cannot_start_capacity`: Insufficient capacity within the selected zone - - `cannot_start_compute`: An error occurred while allocating compute - resources - - `cannot_start_ip_address`: An error occurred while allocating an IP - address - - `cannot_start_network`: An error occurred while allocating network - resources. - :param str message: An explanation of the status reason. - :param str more_info: (optional) Link to documentation about this status - reason. + :param str crn: The CRN for this dedicated host group. + :param str href: The URL for this dedicated host group. + :param str id: The unique identifier for this dedicated host group. + :param str name: The unique user-defined name for this dedicated host + group. + :param str resource_type: The resource type. + :param DedicatedHostGroupReferenceDeleted deleted: (optional) If present, + this property indicates the referenced resource has been deleted and + provides + some supplementary information. """ - self.code = code - self.message = message - self.more_info = more_info + self.crn = crn + self.deleted = deleted + self.href = href + self.id = id + self.name = name + self.resource_type = resource_type @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerStatusReason': - """Initialize a BareMetalServerStatusReason object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostGroupReference': + """Initialize a DedicatedHostGroupReference object from a json dictionary.""" args = {} - if 'code' in _dict: - args['code'] = _dict.get('code') + if 'crn' in _dict: + args['crn'] = _dict.get('crn') else: - raise ValueError('Required property \'code\' not present in BareMetalServerStatusReason JSON') - if 'message' in _dict: - args['message'] = _dict.get('message') + raise ValueError('Required property \'crn\' not present in DedicatedHostGroupReference JSON') + if 'deleted' in _dict: + args['deleted'] = DedicatedHostGroupReferenceDeleted.from_dict(_dict.get('deleted')) + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'message\' not present in BareMetalServerStatusReason JSON') - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') + raise ValueError('Required property \'href\' not present in DedicatedHostGroupReference JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in DedicatedHostGroupReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in DedicatedHostGroupReference JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in DedicatedHostGroupReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerStatusReason object from a json dictionary.""" + """Initialize a DedicatedHostGroupReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'code') and self.code is not None: - _dict['code'] = self.code - if hasattr(self, 'message') and self.message is not None: - _dict['message'] = self.message - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type return _dict def _to_dict(self): @@ -20380,95 +24972,63 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerStatusReason object.""" + """Return a `str` version of this DedicatedHostGroupReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerStatusReason') -> bool: + def __eq__(self, other: 'DedicatedHostGroupReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerStatusReason') -> bool: + def __ne__(self, other: 'DedicatedHostGroupReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class CodeEnum(str, Enum): + class ResourceTypeEnum(str, Enum): """ - The status reason code: - - `cannot_start`: Failed to start due to an internal error - - `cannot_start_capacity`: Insufficient capacity within the selected zone - - `cannot_start_compute`: An error occurred while allocating compute resources - - `cannot_start_ip_address`: An error occurred while allocating an IP address - - `cannot_start_network`: An error occurred while allocating network resources. + The resource type. """ - CANNOT_START = 'cannot_start' - CANNOT_START_CAPACITY = 'cannot_start_capacity' - CANNOT_START_COMPUTE = 'cannot_start_compute' - CANNOT_START_IP_ADDRESS = 'cannot_start_ip_address' - CANNOT_START_NETWORK = 'cannot_start_network' + DEDICATED_HOST_GROUP = 'dedicated_host_group' -class BareMetalServerTrustedPlatformModule(): +class DedicatedHostGroupReferenceDeleted(): """ - BareMetalServerTrustedPlatformModule. + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. - :attr bool enabled: Indicates whether the trusted platform module (TPM) is - enabled. If enabled, `mode` will also be set. - :attr str mode: (optional) The mode for the trusted platform module (TPM): - - `tpm_2`: Standard TPM 2 capabilities - - `tpm_2_with_txt`: Standard TPM 2 with Intel Trusted Execution Technology (TXT) - The enumerated values for this property are expected to expand in the future. - When processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the resource on which the unexpected - property value was encountered. + :attr str more_info: Link to documentation about deleted resources. """ def __init__(self, - enabled: bool, - *, - mode: str = None) -> None: + more_info: str) -> None: """ - Initialize a BareMetalServerTrustedPlatformModule object. + Initialize a DedicatedHostGroupReferenceDeleted object. - :param bool enabled: Indicates whether the trusted platform module (TPM) is - enabled. If enabled, `mode` will also be set. - :param str mode: (optional) The mode for the trusted platform module (TPM): - - `tpm_2`: Standard TPM 2 capabilities - - `tpm_2_with_txt`: Standard TPM 2 with Intel Trusted Execution Technology - (TXT) - The enumerated values for this property are expected to expand in the - future. When processing this property, check for and log unknown values. - Optionally halt processing and surface the error, or bypass the resource on - which the unexpected property value was encountered. + :param str more_info: Link to documentation about deleted resources. """ - self.enabled = enabled - self.mode = mode + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'BareMetalServerTrustedPlatformModule': - """Initialize a BareMetalServerTrustedPlatformModule object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostGroupReferenceDeleted': + """Initialize a DedicatedHostGroupReferenceDeleted object from a json dictionary.""" args = {} - if 'enabled' in _dict: - args['enabled'] = _dict.get('enabled') + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'enabled\' not present in BareMetalServerTrustedPlatformModule JSON') - if 'mode' in _dict: - args['mode'] = _dict.get('mode') + raise ValueError('Required property \'more_info\' not present in DedicatedHostGroupReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a BareMetalServerTrustedPlatformModule object from a json dictionary.""" + """Initialize a DedicatedHostGroupReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'enabled') and self.enabled is not None: - _dict['enabled'] = self.enabled - if hasattr(self, 'mode') and self.mode is not None: - _dict['mode'] = self.mode + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -20476,84 +25036,65 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this BareMetalServerTrustedPlatformModule object.""" + """Return a `str` version of this DedicatedHostGroupReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'BareMetalServerTrustedPlatformModule') -> bool: + def __eq__(self, other: 'DedicatedHostGroupReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'BareMetalServerTrustedPlatformModule') -> bool: + def __ne__(self, other: 'DedicatedHostGroupReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ModeEnum(str, Enum): - """ - The mode for the trusted platform module (TPM): - - `tpm_2`: Standard TPM 2 capabilities - - `tpm_2_with_txt`: Standard TPM 2 with Intel Trusted Execution Technology (TXT) - The enumerated values for this property are expected to expand in the future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the resource on which the unexpected - property value was encountered. - """ - TPM_2 = 'tpm_2' - TPM_2_WITH_TXT = 'tpm_2_with_txt' - - -class CertificateInstanceIdentity(): - """ - Identifies a certificate instance by a unique property. - - """ - - def __init__(self) -> None: - """ - Initialize a CertificateInstanceIdentity object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['CertificateInstanceIdentityByCRN'])) - raise Exception(msg) - -class CertificateInstanceReference(): +class DedicatedHostPatch(): """ - CertificateInstanceReference. + DedicatedHostPatch. - :attr str crn: The CRN for this certificate instance. + :attr bool instance_placement_enabled: (optional) If set to true, instances can + be placed on this dedicated host. + :attr str name: (optional) The unique user-defined name for this dedicated host. """ def __init__(self, - crn: str) -> None: + *, + instance_placement_enabled: bool = None, + name: str = None) -> None: """ - Initialize a CertificateInstanceReference object. + Initialize a DedicatedHostPatch object. - :param str crn: The CRN for this certificate instance. + :param bool instance_placement_enabled: (optional) If set to true, + instances can be placed on this dedicated host. + :param str name: (optional) The unique user-defined name for this dedicated + host. """ - self.crn = crn + self.instance_placement_enabled = instance_placement_enabled + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'CertificateInstanceReference': - """Initialize a CertificateInstanceReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostPatch': + """Initialize a DedicatedHostPatch object from a json dictionary.""" args = {} - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in CertificateInstanceReference JSON') + if 'instance_placement_enabled' in _dict: + args['instance_placement_enabled'] = _dict.get('instance_placement_enabled') + if 'name' in _dict: + args['name'] = _dict.get('name') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a CertificateInstanceReference object from a json dictionary.""" + """Initialize a DedicatedHostPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn + if hasattr(self, 'instance_placement_enabled') and self.instance_placement_enabled is not None: + _dict['instance_placement_enabled'] = self.instance_placement_enabled + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -20561,292 +25102,169 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this CertificateInstanceReference object.""" + """Return a `str` version of this DedicatedHostPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'CertificateInstanceReference') -> bool: + def __eq__(self, other: 'DedicatedHostPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'CertificateInstanceReference') -> bool: + def __ne__(self, other: 'DedicatedHostPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class DedicatedHost(): +class DedicatedHostProfile(): """ - DedicatedHost. + DedicatedHostProfile. - :attr int available_memory: The amount of memory in gibibytes that is currently - available for instances. - :attr VCPU available_vcpu: The available VCPU for the dedicated host. - :attr datetime created_at: The date and time that the dedicated host was - created. - :attr str crn: The CRN for this dedicated host. - :attr List[DedicatedHostDisk] disks: Collection of the dedicated host's disks. - :attr DedicatedHostGroupReference group: The dedicated host group this dedicated - host is in. - :attr str href: The URL for this dedicated host. - :attr str id: The unique identifier for this dedicated host. - :attr bool instance_placement_enabled: If set to true, instances can be placed - on this dedicated host. - :attr List[InstanceReference] instances: The instances that are allocated to - this dedicated host. - :attr str lifecycle_state: The lifecycle state of the dedicated host. - :attr int memory: The total amount of memory in gibibytes for this host. - :attr str name: The unique user-defined name for this dedicated host. - :attr DedicatedHostProfileReference profile: The profile this dedicated host - uses. - :attr bool provisionable: Indicates whether this dedicated host is available for - instance creation. - :attr ResourceGroupReference resource_group: The resource group for this - dedicated host. - :attr str resource_type: The resource type. - :attr int socket_count: The total number of sockets for this host. - :attr str state: The administrative state of the dedicated host. + :attr str class_: The product class this dedicated host profile belongs to. + :attr List[DedicatedHostProfileDisk] disks: Collection of the dedicated host + profile's disks. + :attr str family: The product family this dedicated host profile belongs to The enumerated values for this property are expected to expand in the future. When processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the dedicated host on which the - unexpected property value was encountered. + processing and surface the error, or bypass the resource on which the unexpected + property value was encountered. + :attr str href: The URL for this dedicated host. + :attr DedicatedHostProfileMemory memory: + :attr str name: The globally unique name for this dedicated host profile. + :attr DedicatedHostProfileSocket socket_count: :attr List[InstanceProfileReference] supported_instance_profiles: The instance - profiles usable by instances placed on this dedicated host. - :attr VCPU vcpu: The total VCPU of the dedicated host. - :attr ZoneReference zone: The zone this dedicated host resides in. + profiles usable by instances placed on dedicated hosts with this profile. + :attr DedicatedHostProfileVCPUArchitecture vcpu_architecture: + :attr DedicatedHostProfileVCPU vcpu_count: """ def __init__(self, - available_memory: int, - available_vcpu: 'VCPU', - created_at: datetime, - crn: str, - disks: List['DedicatedHostDisk'], - group: 'DedicatedHostGroupReference', + class_: str, + disks: List['DedicatedHostProfileDisk'], + family: str, href: str, - id: str, - instance_placement_enabled: bool, - instances: List['InstanceReference'], - lifecycle_state: str, - memory: int, + memory: 'DedicatedHostProfileMemory', name: str, - profile: 'DedicatedHostProfileReference', - provisionable: bool, - resource_group: 'ResourceGroupReference', - resource_type: str, - socket_count: int, - state: str, + socket_count: 'DedicatedHostProfileSocket', supported_instance_profiles: List['InstanceProfileReference'], - vcpu: 'VCPU', - zone: 'ZoneReference') -> None: + vcpu_architecture: 'DedicatedHostProfileVCPUArchitecture', + vcpu_count: 'DedicatedHostProfileVCPU') -> None: """ - Initialize a DedicatedHost object. + Initialize a DedicatedHostProfile object. - :param int available_memory: The amount of memory in gibibytes that is - currently available for instances. - :param VCPU available_vcpu: The available VCPU for the dedicated host. - :param datetime created_at: The date and time that the dedicated host was - created. - :param str crn: The CRN for this dedicated host. - :param List[DedicatedHostDisk] disks: Collection of the dedicated host's - disks. - :param DedicatedHostGroupReference group: The dedicated host group this - dedicated host is in. - :param str href: The URL for this dedicated host. - :param str id: The unique identifier for this dedicated host. - :param bool instance_placement_enabled: If set to true, instances can be - placed on this dedicated host. - :param List[InstanceReference] instances: The instances that are allocated - to this dedicated host. - :param str lifecycle_state: The lifecycle state of the dedicated host. - :param int memory: The total amount of memory in gibibytes for this host. - :param str name: The unique user-defined name for this dedicated host. - :param DedicatedHostProfileReference profile: The profile this dedicated - host uses. - :param bool provisionable: Indicates whether this dedicated host is - available for instance creation. - :param ResourceGroupReference resource_group: The resource group for this - dedicated host. - :param str resource_type: The resource type. - :param int socket_count: The total number of sockets for this host. - :param str state: The administrative state of the dedicated host. + :param str class_: The product class this dedicated host profile belongs + to. + :param List[DedicatedHostProfileDisk] disks: Collection of the dedicated + host profile's disks. + :param str family: The product family this dedicated host profile belongs + to The enumerated values for this property are expected to expand in the future. When processing this property, check for and log unknown values. - Optionally halt processing and surface the error, or bypass the dedicated - host on which the unexpected property value was encountered. + Optionally halt processing and surface the error, or bypass the resource on + which the unexpected property value was encountered. + :param str href: The URL for this dedicated host. + :param DedicatedHostProfileMemory memory: + :param str name: The globally unique name for this dedicated host profile. + :param DedicatedHostProfileSocket socket_count: :param List[InstanceProfileReference] supported_instance_profiles: The - instance profiles usable by instances placed on this dedicated host. - :param VCPU vcpu: The total VCPU of the dedicated host. - :param ZoneReference zone: The zone this dedicated host resides in. + instance profiles usable by instances placed on dedicated hosts with this + profile. + :param DedicatedHostProfileVCPUArchitecture vcpu_architecture: + :param DedicatedHostProfileVCPU vcpu_count: """ - self.available_memory = available_memory - self.available_vcpu = available_vcpu - self.created_at = created_at - self.crn = crn + self.class_ = class_ self.disks = disks - self.group = group + self.family = family self.href = href - self.id = id - self.instance_placement_enabled = instance_placement_enabled - self.instances = instances - self.lifecycle_state = lifecycle_state self.memory = memory self.name = name - self.profile = profile - self.provisionable = provisionable - self.resource_group = resource_group - self.resource_type = resource_type self.socket_count = socket_count - self.state = state self.supported_instance_profiles = supported_instance_profiles - self.vcpu = vcpu - self.zone = zone + self.vcpu_architecture = vcpu_architecture + self.vcpu_count = vcpu_count @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHost': - """Initialize a DedicatedHost object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostProfile': + """Initialize a DedicatedHostProfile object from a json dictionary.""" args = {} - if 'available_memory' in _dict: - args['available_memory'] = _dict.get('available_memory') - else: - raise ValueError('Required property \'available_memory\' not present in DedicatedHost JSON') - if 'available_vcpu' in _dict: - args['available_vcpu'] = VCPU.from_dict(_dict.get('available_vcpu')) - else: - raise ValueError('Required property \'available_vcpu\' not present in DedicatedHost JSON') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - else: - raise ValueError('Required property \'created_at\' not present in DedicatedHost JSON') - if 'crn' in _dict: - args['crn'] = _dict.get('crn') + if 'class' in _dict: + args['class_'] = _dict.get('class') else: - raise ValueError('Required property \'crn\' not present in DedicatedHost JSON') + raise ValueError('Required property \'class\' not present in DedicatedHostProfile JSON') if 'disks' in _dict: - args['disks'] = [DedicatedHostDisk.from_dict(x) for x in _dict.get('disks')] + args['disks'] = [DedicatedHostProfileDisk.from_dict(x) for x in _dict.get('disks')] else: - raise ValueError('Required property \'disks\' not present in DedicatedHost JSON') - if 'group' in _dict: - args['group'] = DedicatedHostGroupReference.from_dict(_dict.get('group')) + raise ValueError('Required property \'disks\' not present in DedicatedHostProfile JSON') + if 'family' in _dict: + args['family'] = _dict.get('family') else: - raise ValueError('Required property \'group\' not present in DedicatedHost JSON') + raise ValueError('Required property \'family\' not present in DedicatedHostProfile JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in DedicatedHost JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in DedicatedHost JSON') - if 'instance_placement_enabled' in _dict: - args['instance_placement_enabled'] = _dict.get('instance_placement_enabled') - else: - raise ValueError('Required property \'instance_placement_enabled\' not present in DedicatedHost JSON') - if 'instances' in _dict: - args['instances'] = [InstanceReference.from_dict(x) for x in _dict.get('instances')] - else: - raise ValueError('Required property \'instances\' not present in DedicatedHost JSON') - if 'lifecycle_state' in _dict: - args['lifecycle_state'] = _dict.get('lifecycle_state') - else: - raise ValueError('Required property \'lifecycle_state\' not present in DedicatedHost JSON') + raise ValueError('Required property \'href\' not present in DedicatedHostProfile JSON') if 'memory' in _dict: args['memory'] = _dict.get('memory') else: - raise ValueError('Required property \'memory\' not present in DedicatedHost JSON') + raise ValueError('Required property \'memory\' not present in DedicatedHostProfile JSON') if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in DedicatedHost JSON') - if 'profile' in _dict: - args['profile'] = DedicatedHostProfileReference.from_dict(_dict.get('profile')) - else: - raise ValueError('Required property \'profile\' not present in DedicatedHost JSON') - if 'provisionable' in _dict: - args['provisionable'] = _dict.get('provisionable') - else: - raise ValueError('Required property \'provisionable\' not present in DedicatedHost JSON') - if 'resource_group' in _dict: - args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) - else: - raise ValueError('Required property \'resource_group\' not present in DedicatedHost JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') + args['name'] = _dict.get('name') else: - raise ValueError('Required property \'resource_type\' not present in DedicatedHost JSON') + raise ValueError('Required property \'name\' not present in DedicatedHostProfile JSON') if 'socket_count' in _dict: args['socket_count'] = _dict.get('socket_count') else: - raise ValueError('Required property \'socket_count\' not present in DedicatedHost JSON') - if 'state' in _dict: - args['state'] = _dict.get('state') - else: - raise ValueError('Required property \'state\' not present in DedicatedHost JSON') + raise ValueError('Required property \'socket_count\' not present in DedicatedHostProfile JSON') if 'supported_instance_profiles' in _dict: args['supported_instance_profiles'] = [InstanceProfileReference.from_dict(x) for x in _dict.get('supported_instance_profiles')] else: - raise ValueError('Required property \'supported_instance_profiles\' not present in DedicatedHost JSON') - if 'vcpu' in _dict: - args['vcpu'] = VCPU.from_dict(_dict.get('vcpu')) + raise ValueError('Required property \'supported_instance_profiles\' not present in DedicatedHostProfile JSON') + if 'vcpu_architecture' in _dict: + args['vcpu_architecture'] = DedicatedHostProfileVCPUArchitecture.from_dict(_dict.get('vcpu_architecture')) else: - raise ValueError('Required property \'vcpu\' not present in DedicatedHost JSON') - if 'zone' in _dict: - args['zone'] = ZoneReference.from_dict(_dict.get('zone')) + raise ValueError('Required property \'vcpu_architecture\' not present in DedicatedHostProfile JSON') + if 'vcpu_count' in _dict: + args['vcpu_count'] = _dict.get('vcpu_count') else: - raise ValueError('Required property \'zone\' not present in DedicatedHost JSON') + raise ValueError('Required property \'vcpu_count\' not present in DedicatedHostProfile JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DedicatedHost object from a json dictionary.""" + """Initialize a DedicatedHostProfile object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'available_memory') and self.available_memory is not None: - _dict['available_memory'] = self.available_memory - if hasattr(self, 'available_vcpu') and self.available_vcpu is not None: - _dict['available_vcpu'] = self.available_vcpu.to_dict() - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn + if hasattr(self, 'class_') and self.class_ is not None: + _dict['class'] = self.class_ if hasattr(self, 'disks') and self.disks is not None: _dict['disks'] = [x.to_dict() for x in self.disks] - if hasattr(self, 'group') and self.group is not None: - _dict['group'] = self.group.to_dict() + if hasattr(self, 'family') and self.family is not None: + _dict['family'] = self.family if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'instance_placement_enabled') and self.instance_placement_enabled is not None: - _dict['instance_placement_enabled'] = self.instance_placement_enabled - if hasattr(self, 'instances') and self.instances is not None: - _dict['instances'] = [x.to_dict() for x in self.instances] - if hasattr(self, 'lifecycle_state') and self.lifecycle_state is not None: - _dict['lifecycle_state'] = self.lifecycle_state if hasattr(self, 'memory') and self.memory is not None: - _dict['memory'] = self.memory + if isinstance(self.memory, dict): + _dict['memory'] = self.memory + else: + _dict['memory'] = self.memory.to_dict() if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'profile') and self.profile is not None: - _dict['profile'] = self.profile.to_dict() - if hasattr(self, 'provisionable') and self.provisionable is not None: - _dict['provisionable'] = self.provisionable - if hasattr(self, 'resource_group') and self.resource_group is not None: - _dict['resource_group'] = self.resource_group.to_dict() - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type if hasattr(self, 'socket_count') and self.socket_count is not None: - _dict['socket_count'] = self.socket_count - if hasattr(self, 'state') and self.state is not None: - _dict['state'] = self.state + if isinstance(self.socket_count, dict): + _dict['socket_count'] = self.socket_count + else: + _dict['socket_count'] = self.socket_count.to_dict() if hasattr(self, 'supported_instance_profiles') and self.supported_instance_profiles is not None: _dict['supported_instance_profiles'] = [x.to_dict() for x in self.supported_instance_profiles] - if hasattr(self, 'vcpu') and self.vcpu is not None: - _dict['vcpu'] = self.vcpu.to_dict() - if hasattr(self, 'zone') and self.zone is not None: - _dict['zone'] = self.zone.to_dict() + if hasattr(self, 'vcpu_architecture') and self.vcpu_architecture is not None: + _dict['vcpu_architecture'] = self.vcpu_architecture.to_dict() + if hasattr(self, 'vcpu_count') and self.vcpu_count is not None: + if isinstance(self.vcpu_count, dict): + _dict['vcpu_count'] = self.vcpu_count + else: + _dict['vcpu_count'] = self.vcpu_count.to_dict() return _dict def _to_dict(self): @@ -20854,133 +25272,115 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DedicatedHost object.""" + """Return a `str` version of this DedicatedHostProfile object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHost') -> bool: + def __eq__(self, other: 'DedicatedHostProfile') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DedicatedHost') -> bool: + def __ne__(self, other: 'DedicatedHostProfile') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class LifecycleStateEnum(str, Enum): - """ - The lifecycle state of the dedicated host. - """ - DELETING = 'deleting' - FAILED = 'failed' - PENDING = 'pending' - STABLE = 'stable' - SUSPENDED = 'suspended' - UPDATING = 'updating' - WAITING = 'waiting' - - - class ResourceTypeEnum(str, Enum): - """ - The resource type. - """ - DEDICATED_HOST = 'dedicated_host' - - - class StateEnum(str, Enum): + class FamilyEnum(str, Enum): """ - The administrative state of the dedicated host. + The product family this dedicated host profile belongs to The enumerated values for this property are expected to expand in the future. When processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the dedicated host on which the - unexpected property value was encountered. + processing and surface the error, or bypass the resource on which the unexpected + property value was encountered. """ - AVAILABLE = 'available' - DEGRADED = 'degraded' - MIGRATING = 'migrating' - UNAVAILABLE = 'unavailable' + BALANCED = 'balanced' + COMPUTE = 'compute' + MEMORY = 'memory' -class DedicatedHostCollection(): +class DedicatedHostProfileCollection(): """ - DedicatedHostCollection. + DedicatedHostProfileCollection. - :attr List[DedicatedHost] dedicated_hosts: Collection of dedicated hosts. - :attr DedicatedHostCollectionFirst first: A link to the first page of resources. + :attr DedicatedHostProfileCollectionFirst first: A link to the first page of + resources. :attr int limit: The maximum number of resources that can be returned by the request. - :attr DedicatedHostCollectionNext next: (optional) A link to the next page of - resources. This property is present for all pages + :attr DedicatedHostProfileCollectionNext next: (optional) A link to the next + page of resources. This property is present for all pages except the last page. + :attr List[DedicatedHostProfile] profiles: Collection of dedicated host + profiles. :attr int total_count: The total number of resources across all pages. """ def __init__(self, - dedicated_hosts: List['DedicatedHost'], - first: 'DedicatedHostCollectionFirst', + first: 'DedicatedHostProfileCollectionFirst', limit: int, + profiles: List['DedicatedHostProfile'], total_count: int, *, - next: 'DedicatedHostCollectionNext' = None) -> None: + next: 'DedicatedHostProfileCollectionNext' = None) -> None: """ - Initialize a DedicatedHostCollection object. + Initialize a DedicatedHostProfileCollection object. - :param List[DedicatedHost] dedicated_hosts: Collection of dedicated hosts. - :param DedicatedHostCollectionFirst first: A link to the first page of - resources. + :param DedicatedHostProfileCollectionFirst first: A link to the first page + of resources. :param int limit: The maximum number of resources that can be returned by the request. + :param List[DedicatedHostProfile] profiles: Collection of dedicated host + profiles. :param int total_count: The total number of resources across all pages. - :param DedicatedHostCollectionNext next: (optional) A link to the next page - of resources. This property is present for all pages + :param DedicatedHostProfileCollectionNext next: (optional) A link to the + next page of resources. This property is present for all pages except the last page. """ - self.dedicated_hosts = dedicated_hosts self.first = first self.limit = limit self.next = next + self.profiles = profiles self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostCollection': - """Initialize a DedicatedHostCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostProfileCollection': + """Initialize a DedicatedHostProfileCollection object from a json dictionary.""" args = {} - if 'dedicated_hosts' in _dict: - args['dedicated_hosts'] = [DedicatedHost.from_dict(x) for x in _dict.get('dedicated_hosts')] - else: - raise ValueError('Required property \'dedicated_hosts\' not present in DedicatedHostCollection JSON') if 'first' in _dict: - args['first'] = DedicatedHostCollectionFirst.from_dict(_dict.get('first')) + args['first'] = DedicatedHostProfileCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'first\' not present in DedicatedHostCollection JSON') + raise ValueError('Required property \'first\' not present in DedicatedHostProfileCollection JSON') if 'limit' in _dict: args['limit'] = _dict.get('limit') else: - raise ValueError('Required property \'limit\' not present in DedicatedHostCollection JSON') + raise ValueError('Required property \'limit\' not present in DedicatedHostProfileCollection JSON') if 'next' in _dict: - args['next'] = DedicatedHostCollectionNext.from_dict(_dict.get('next')) + args['next'] = DedicatedHostProfileCollectionNext.from_dict(_dict.get('next')) + if 'profiles' in _dict: + args['profiles'] = [DedicatedHostProfile.from_dict(x) for x in _dict.get('profiles')] + else: + raise ValueError('Required property \'profiles\' not present in DedicatedHostProfileCollection JSON') if 'total_count' in _dict: args['total_count'] = _dict.get('total_count') else: - raise ValueError('Required property \'total_count\' not present in DedicatedHostCollection JSON') + raise ValueError('Required property \'total_count\' not present in DedicatedHostProfileCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DedicatedHostCollection object from a json dictionary.""" + """Initialize a DedicatedHostProfileCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'dedicated_hosts') and self.dedicated_hosts is not None: - _dict['dedicated_hosts'] = [x.to_dict() for x in self.dedicated_hosts] if hasattr(self, 'first') and self.first is not None: _dict['first'] = self.first.to_dict() if hasattr(self, 'limit') and self.limit is not None: _dict['limit'] = self.limit if hasattr(self, 'next') and self.next is not None: _dict['next'] = self.next.to_dict() + if hasattr(self, 'profiles') and self.profiles is not None: + _dict['profiles'] = [x.to_dict() for x in self.profiles] if hasattr(self, 'total_count') and self.total_count is not None: _dict['total_count'] = self.total_count return _dict @@ -20990,20 +25390,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DedicatedHostCollection object.""" + """Return a `str` version of this DedicatedHostProfileCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHostCollection') -> bool: + def __eq__(self, other: 'DedicatedHostProfileCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DedicatedHostCollection') -> bool: + def __ne__(self, other: 'DedicatedHostProfileCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class DedicatedHostCollectionFirst(): +class DedicatedHostProfileCollectionFirst(): """ A link to the first page of resources. @@ -21013,25 +25413,25 @@ class DedicatedHostCollectionFirst(): def __init__(self, href: str) -> None: """ - Initialize a DedicatedHostCollectionFirst object. + Initialize a DedicatedHostProfileCollectionFirst object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostCollectionFirst': - """Initialize a DedicatedHostCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostProfileCollectionFirst': + """Initialize a DedicatedHostProfileCollectionFirst object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in DedicatedHostCollectionFirst JSON') + raise ValueError('Required property \'href\' not present in DedicatedHostProfileCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DedicatedHostCollectionFirst object from a json dictionary.""" + """Initialize a DedicatedHostProfileCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -21046,20 +25446,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DedicatedHostCollectionFirst object.""" + """Return a `str` version of this DedicatedHostProfileCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHostCollectionFirst') -> bool: + def __eq__(self, other: 'DedicatedHostProfileCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DedicatedHostCollectionFirst') -> bool: + def __ne__(self, other: 'DedicatedHostProfileCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class DedicatedHostCollectionNext(): +class DedicatedHostProfileCollectionNext(): """ A link to the next page of resources. This property is present for all pages except the last page. @@ -21070,25 +25470,25 @@ class DedicatedHostCollectionNext(): def __init__(self, href: str) -> None: """ - Initialize a DedicatedHostCollectionNext object. + Initialize a DedicatedHostProfileCollectionNext object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostCollectionNext': - """Initialize a DedicatedHostCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostProfileCollectionNext': + """Initialize a DedicatedHostProfileCollectionNext object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in DedicatedHostCollectionNext JSON') + raise ValueError('Required property \'href\' not present in DedicatedHostProfileCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DedicatedHostCollectionNext object from a json dictionary.""" + """Initialize a DedicatedHostProfileCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -21103,282 +25503,90 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DedicatedHostCollectionNext object.""" + """Return a `str` version of this DedicatedHostProfileCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHostCollectionNext') -> bool: + def __eq__(self, other: 'DedicatedHostProfileCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DedicatedHostCollectionNext') -> bool: + def __ne__(self, other: 'DedicatedHostProfileCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class DedicatedHostDisk(): +class DedicatedHostProfileDisk(): """ - DedicatedHostDisk. + Disks provided by this profile. - :attr int available: The remaining space left for instance placement in GB - (gigabytes). - :attr datetime created_at: The date and time that the disk was created. - :attr str href: The URL for this disk. - :attr str id: The unique identifier for this disk. - :attr List[InstanceDiskReference] instance_disks: Instance disks that are on - this dedicated host disk. - :attr str interface_type: The disk interface used for attaching the disk - The enumerated values for this property are expected to expand in the future. - When processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the resource on which the unexpected - property value was encountered. - :attr str lifecycle_state: (optional) The lifecycle state of this dedicated host - disk. - :attr str name: The user-defined or system-provided name for this disk. - :attr bool provisionable: Indicates whether this dedicated host disk is - available for instance disk creation. - :attr str resource_type: The resource type. - :attr int size: The size of the disk in GB (gigabytes). - :attr List[str] supported_instance_interface_types: The instance disk interfaces - supported for this dedicated host disk. + :attr DedicatedHostProfileDiskInterface interface_type: + :attr DedicatedHostProfileDiskQuantity quantity: The number of disks of this + type for a dedicated host with this profile. + :attr DedicatedHostProfileDiskSize size: The size of the disk in GB (gigabytes). + :attr DedicatedHostProfileDiskSupportedInterfaces + supported_instance_interface_types: """ def __init__(self, - available: int, - created_at: datetime, - href: str, - id: str, - instance_disks: List['InstanceDiskReference'], - interface_type: str, - name: str, - provisionable: bool, - resource_type: str, - size: int, - supported_instance_interface_types: List[str], - *, - lifecycle_state: str = None) -> None: + interface_type: 'DedicatedHostProfileDiskInterface', + quantity: 'DedicatedHostProfileDiskQuantity', + size: 'DedicatedHostProfileDiskSize', + supported_instance_interface_types: 'DedicatedHostProfileDiskSupportedInterfaces') -> None: """ - Initialize a DedicatedHostDisk object. + Initialize a DedicatedHostProfileDisk object. - :param int available: The remaining space left for instance placement in GB + :param DedicatedHostProfileDiskInterface interface_type: + :param DedicatedHostProfileDiskQuantity quantity: The number of disks of + this type for a dedicated host with this profile. + :param DedicatedHostProfileDiskSize size: The size of the disk in GB (gigabytes). - :param datetime created_at: The date and time that the disk was created. - :param str href: The URL for this disk. - :param str id: The unique identifier for this disk. - :param List[InstanceDiskReference] instance_disks: Instance disks that are - on this dedicated host disk. - :param str interface_type: The disk interface used for attaching the disk - The enumerated values for this property are expected to expand in the - future. When processing this property, check for and log unknown values. - Optionally halt processing and surface the error, or bypass the resource on - which the unexpected property value was encountered. - :param str name: The user-defined or system-provided name for this disk. - :param bool provisionable: Indicates whether this dedicated host disk is - available for instance disk creation. - :param str resource_type: The resource type. - :param int size: The size of the disk in GB (gigabytes). - :param List[str] supported_instance_interface_types: The instance disk - interfaces supported for this dedicated host disk. - :param str lifecycle_state: (optional) The lifecycle state of this - dedicated host disk. + :param DedicatedHostProfileDiskSupportedInterfaces + supported_instance_interface_types: """ - self.available = available - self.created_at = created_at - self.href = href - self.id = id - self.instance_disks = instance_disks self.interface_type = interface_type - self.lifecycle_state = lifecycle_state - self.name = name - self.provisionable = provisionable - self.resource_type = resource_type + self.quantity = quantity self.size = size self.supported_instance_interface_types = supported_instance_interface_types @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostDisk': - """Initialize a DedicatedHostDisk object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostProfileDisk': + """Initialize a DedicatedHostProfileDisk object from a json dictionary.""" args = {} - if 'available' in _dict: - args['available'] = _dict.get('available') - else: - raise ValueError('Required property \'available\' not present in DedicatedHostDisk JSON') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - else: - raise ValueError('Required property \'created_at\' not present in DedicatedHostDisk JSON') - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in DedicatedHostDisk JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in DedicatedHostDisk JSON') - if 'instance_disks' in _dict: - args['instance_disks'] = [InstanceDiskReference.from_dict(x) for x in _dict.get('instance_disks')] - else: - raise ValueError('Required property \'instance_disks\' not present in DedicatedHostDisk JSON') if 'interface_type' in _dict: - args['interface_type'] = _dict.get('interface_type') - else: - raise ValueError('Required property \'interface_type\' not present in DedicatedHostDisk JSON') - if 'lifecycle_state' in _dict: - args['lifecycle_state'] = _dict.get('lifecycle_state') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in DedicatedHostDisk JSON') - if 'provisionable' in _dict: - args['provisionable'] = _dict.get('provisionable') + args['interface_type'] = DedicatedHostProfileDiskInterface.from_dict(_dict.get('interface_type')) else: - raise ValueError('Required property \'provisionable\' not present in DedicatedHostDisk JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') + raise ValueError('Required property \'interface_type\' not present in DedicatedHostProfileDisk JSON') + if 'quantity' in _dict: + args['quantity'] = DedicatedHostProfileDiskQuantity.from_dict(_dict.get('quantity')) else: - raise ValueError('Required property \'resource_type\' not present in DedicatedHostDisk JSON') + raise ValueError('Required property \'quantity\' not present in DedicatedHostProfileDisk JSON') if 'size' in _dict: - args['size'] = _dict.get('size') + args['size'] = DedicatedHostProfileDiskSize.from_dict(_dict.get('size')) else: - raise ValueError('Required property \'size\' not present in DedicatedHostDisk JSON') + raise ValueError('Required property \'size\' not present in DedicatedHostProfileDisk JSON') if 'supported_instance_interface_types' in _dict: - args['supported_instance_interface_types'] = _dict.get('supported_instance_interface_types') + args['supported_instance_interface_types'] = DedicatedHostProfileDiskSupportedInterfaces.from_dict(_dict.get('supported_instance_interface_types')) else: - raise ValueError('Required property \'supported_instance_interface_types\' not present in DedicatedHostDisk JSON') + raise ValueError('Required property \'supported_instance_interface_types\' not present in DedicatedHostProfileDisk JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DedicatedHostDisk object from a json dictionary.""" + """Initialize a DedicatedHostProfileDisk object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'available') and self.available is not None: - _dict['available'] = self.available - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'instance_disks') and self.instance_disks is not None: - _dict['instance_disks'] = [x.to_dict() for x in self.instance_disks] if hasattr(self, 'interface_type') and self.interface_type is not None: - _dict['interface_type'] = self.interface_type - if hasattr(self, 'lifecycle_state') and self.lifecycle_state is not None: - _dict['lifecycle_state'] = self.lifecycle_state - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'provisionable') and self.provisionable is not None: - _dict['provisionable'] = self.provisionable - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type + _dict['interface_type'] = self.interface_type.to_dict() + if hasattr(self, 'quantity') and self.quantity is not None: + _dict['quantity'] = self.quantity.to_dict() if hasattr(self, 'size') and self.size is not None: - _dict['size'] = self.size + _dict['size'] = self.size.to_dict() if hasattr(self, 'supported_instance_interface_types') and self.supported_instance_interface_types is not None: - _dict['supported_instance_interface_types'] = self.supported_instance_interface_types - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this DedicatedHostDisk object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'DedicatedHostDisk') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'DedicatedHostDisk') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - - class InterfaceTypeEnum(str, Enum): - """ - The disk interface used for attaching the disk - The enumerated values for this property are expected to expand in the future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the resource on which the unexpected - property value was encountered. - """ - NVME = 'nvme' - - - class LifecycleStateEnum(str, Enum): - """ - The lifecycle state of this dedicated host disk. - """ - DELETING = 'deleting' - FAILED = 'failed' - PENDING = 'pending' - STABLE = 'stable' - SUSPENDED = 'suspended' - UPDATING = 'updating' - WAITING = 'waiting' - - - class ResourceTypeEnum(str, Enum): - """ - The resource type. - """ - DEDICATED_HOST_DISK = 'dedicated_host_disk' - - - class SupportedInstanceInterfaceTypesEnum(str, Enum): - """ - The disk interface used for attaching the disk. - The enumerated values for this property are expected to expand in the future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the resource on which the unexpected - property value was encountered. - """ - NVME = 'nvme' - VIRTIO_BLK = 'virtio_blk' - - -class DedicatedHostDiskCollection(): - """ - DedicatedHostDiskCollection. - - :attr List[DedicatedHostDisk] disks: Collection of the dedicated host's disks. - """ - - def __init__(self, - disks: List['DedicatedHostDisk']) -> None: - """ - Initialize a DedicatedHostDiskCollection object. - - :param List[DedicatedHostDisk] disks: Collection of the dedicated host's - disks. - """ - self.disks = disks - - @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostDiskCollection': - """Initialize a DedicatedHostDiskCollection object from a json dictionary.""" - args = {} - if 'disks' in _dict: - args['disks'] = [DedicatedHostDisk.from_dict(x) for x in _dict.get('disks')] - else: - raise ValueError('Required property \'disks\' not present in DedicatedHostDiskCollection JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a DedicatedHostDiskCollection object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'disks') and self.disks is not None: - _dict['disks'] = [x.to_dict() for x in self.disks] + _dict['supported_instance_interface_types'] = self.supported_instance_interface_types.to_dict() return _dict def _to_dict(self): @@ -21386,54 +25594,75 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DedicatedHostDiskCollection object.""" + """Return a `str` version of this DedicatedHostProfileDisk object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHostDiskCollection') -> bool: + def __eq__(self, other: 'DedicatedHostProfileDisk') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DedicatedHostDiskCollection') -> bool: + def __ne__(self, other: 'DedicatedHostProfileDisk') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class DedicatedHostDiskPatch(): +class DedicatedHostProfileDiskInterface(): """ - DedicatedHostDiskPatch. + DedicatedHostProfileDiskInterface. - :attr str name: (optional) The user-defined name for this disk. + :attr str type: The type for this profile field. + :attr str value: The interface of the disk for a dedicated host with this + profile + The enumerated values for this property are expected to expand in the future. + When processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the resource on which the unexpected + property value was encountered. """ def __init__(self, - *, - name: str = None) -> None: + type: str, + value: str) -> None: """ - Initialize a DedicatedHostDiskPatch object. + Initialize a DedicatedHostProfileDiskInterface object. - :param str name: (optional) The user-defined name for this disk. + :param str type: The type for this profile field. + :param str value: The interface of the disk for a dedicated host with this + profile + The enumerated values for this property are expected to expand in the + future. When processing this property, check for and log unknown values. + Optionally halt processing and surface the error, or bypass the resource on + which the unexpected property value was encountered. """ - self.name = name + self.type = type + self.value = value @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostDiskPatch': - """Initialize a DedicatedHostDiskPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostProfileDiskInterface': + """Initialize a DedicatedHostProfileDiskInterface object from a json dictionary.""" args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') + if 'type' in _dict: + args['type'] = _dict.get('type') + else: + raise ValueError('Required property \'type\' not present in DedicatedHostProfileDiskInterface JSON') + if 'value' in _dict: + args['value'] = _dict.get('value') + else: + raise ValueError('Required property \'value\' not present in DedicatedHostProfileDiskInterface JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DedicatedHostDiskPatch object from a json dictionary.""" + """Initialize a DedicatedHostProfileDiskInterface object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'value') and self.value is not None: + _dict['value'] = self.value return _dict def _to_dict(self): @@ -21441,176 +25670,83 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DedicatedHostDiskPatch object.""" + """Return a `str` version of this DedicatedHostProfileDiskInterface object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHostDiskPatch') -> bool: + def __eq__(self, other: 'DedicatedHostProfileDiskInterface') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DedicatedHostDiskPatch') -> bool: + def __ne__(self, other: 'DedicatedHostProfileDiskInterface') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class DedicatedHostGroup(): + class TypeEnum(str, Enum): + """ + The type for this profile field. + """ + FIXED = 'fixed' + + + class ValueEnum(str, Enum): + """ + The interface of the disk for a dedicated host with this profile + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the resource on which the unexpected + property value was encountered. + """ + NVME = 'nvme' + + +class DedicatedHostProfileDiskQuantity(): """ - DedicatedHostGroup. + The number of disks of this type for a dedicated host with this profile. - :attr str class_: The dedicated host profile class for hosts in this group. - :attr datetime created_at: The date and time that the dedicated host group was - created. - :attr str crn: The CRN for this dedicated host group. - :attr List[DedicatedHostReference] dedicated_hosts: The dedicated hosts that are - in this dedicated host group. - :attr str family: The dedicated host profile family for hosts in this group. - :attr str href: The URL for this dedicated host group. - :attr str id: The unique identifier for this dedicated host group. - :attr str name: The unique user-defined name for this dedicated host group. - :attr ResourceGroupReference resource_group: The resource group for this - dedicated host group. - :attr str resource_type: The resource type. - :attr List[InstanceProfileReference] supported_instance_profiles: The instance - profiles usable by instances placed on this dedicated host group. - :attr ZoneReference zone: The zone this dedicated host group resides in. + :attr str type: The type for this profile field. + :attr int value: The value for this profile field. """ def __init__(self, - class_: str, - created_at: datetime, - crn: str, - dedicated_hosts: List['DedicatedHostReference'], - family: str, - href: str, - id: str, - name: str, - resource_group: 'ResourceGroupReference', - resource_type: str, - supported_instance_profiles: List['InstanceProfileReference'], - zone: 'ZoneReference') -> None: + type: str, + value: int) -> None: """ - Initialize a DedicatedHostGroup object. + Initialize a DedicatedHostProfileDiskQuantity object. - :param str class_: The dedicated host profile class for hosts in this - group. - :param datetime created_at: The date and time that the dedicated host group - was created. - :param str crn: The CRN for this dedicated host group. - :param List[DedicatedHostReference] dedicated_hosts: The dedicated hosts - that are in this dedicated host group. - :param str family: The dedicated host profile family for hosts in this - group. - :param str href: The URL for this dedicated host group. - :param str id: The unique identifier for this dedicated host group. - :param str name: The unique user-defined name for this dedicated host - group. - :param ResourceGroupReference resource_group: The resource group for this - dedicated host group. - :param str resource_type: The resource type. - :param List[InstanceProfileReference] supported_instance_profiles: The - instance profiles usable by instances placed on this dedicated host group. - :param ZoneReference zone: The zone this dedicated host group resides in. + :param str type: The type for this profile field. + :param int value: The value for this profile field. """ - self.class_ = class_ - self.created_at = created_at - self.crn = crn - self.dedicated_hosts = dedicated_hosts - self.family = family - self.href = href - self.id = id - self.name = name - self.resource_group = resource_group - self.resource_type = resource_type - self.supported_instance_profiles = supported_instance_profiles - self.zone = zone + self.type = type + self.value = value @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostGroup': - """Initialize a DedicatedHostGroup object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostProfileDiskQuantity': + """Initialize a DedicatedHostProfileDiskQuantity object from a json dictionary.""" args = {} - if 'class' in _dict: - args['class_'] = _dict.get('class') - else: - raise ValueError('Required property \'class\' not present in DedicatedHostGroup JSON') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - else: - raise ValueError('Required property \'created_at\' not present in DedicatedHostGroup JSON') - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in DedicatedHostGroup JSON') - if 'dedicated_hosts' in _dict: - args['dedicated_hosts'] = [DedicatedHostReference.from_dict(x) for x in _dict.get('dedicated_hosts')] - else: - raise ValueError('Required property \'dedicated_hosts\' not present in DedicatedHostGroup JSON') - if 'family' in _dict: - args['family'] = _dict.get('family') - else: - raise ValueError('Required property \'family\' not present in DedicatedHostGroup JSON') - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in DedicatedHostGroup JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in DedicatedHostGroup JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in DedicatedHostGroup JSON') - if 'resource_group' in _dict: - args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) - else: - raise ValueError('Required property \'resource_group\' not present in DedicatedHostGroup JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in DedicatedHostGroup JSON') - if 'supported_instance_profiles' in _dict: - args['supported_instance_profiles'] = [InstanceProfileReference.from_dict(x) for x in _dict.get('supported_instance_profiles')] + if 'type' in _dict: + args['type'] = _dict.get('type') else: - raise ValueError('Required property \'supported_instance_profiles\' not present in DedicatedHostGroup JSON') - if 'zone' in _dict: - args['zone'] = ZoneReference.from_dict(_dict.get('zone')) + raise ValueError('Required property \'type\' not present in DedicatedHostProfileDiskQuantity JSON') + if 'value' in _dict: + args['value'] = _dict.get('value') else: - raise ValueError('Required property \'zone\' not present in DedicatedHostGroup JSON') + raise ValueError('Required property \'value\' not present in DedicatedHostProfileDiskQuantity JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DedicatedHostGroup object from a json dictionary.""" + """Initialize a DedicatedHostProfileDiskQuantity object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'class_') and self.class_ is not None: - _dict['class'] = self.class_ - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - if hasattr(self, 'dedicated_hosts') and self.dedicated_hosts is not None: - _dict['dedicated_hosts'] = [x.to_dict() for x in self.dedicated_hosts] - if hasattr(self, 'family') and self.family is not None: - _dict['family'] = self.family - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'resource_group') and self.resource_group is not None: - _dict['resource_group'] = self.resource_group.to_dict() - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type - if hasattr(self, 'supported_instance_profiles') and self.supported_instance_profiles is not None: - _dict['supported_instance_profiles'] = [x.to_dict() for x in self.supported_instance_profiles] - if hasattr(self, 'zone') and self.zone is not None: - _dict['zone'] = self.zone.to_dict() + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'value') and self.value is not None: + _dict['value'] = self.value return _dict def _to_dict(self): @@ -21618,119 +25754,72 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DedicatedHostGroup object.""" + """Return a `str` version of this DedicatedHostProfileDiskQuantity object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHostGroup') -> bool: + def __eq__(self, other: 'DedicatedHostProfileDiskQuantity') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DedicatedHostGroup') -> bool: + def __ne__(self, other: 'DedicatedHostProfileDiskQuantity') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class FamilyEnum(str, Enum): - """ - The dedicated host profile family for hosts in this group. - """ - BALANCED = 'balanced' - COMPUTE = 'compute' - MEMORY = 'memory' - - - class ResourceTypeEnum(str, Enum): + class TypeEnum(str, Enum): """ - The resource type. + The type for this profile field. """ - DEDICATED_HOST_GROUP = 'dedicated_host_group' + FIXED = 'fixed' -class DedicatedHostGroupCollection(): +class DedicatedHostProfileDiskSize(): """ - DedicatedHostGroupCollection. + The size of the disk in GB (gigabytes). - :attr DedicatedHostGroupCollectionFirst first: A link to the first page of - resources. - :attr List[DedicatedHostGroup] groups: Collection of dedicated host groups. - :attr int limit: The maximum number of resources that can be returned by the - request. - :attr DedicatedHostGroupCollectionNext next: (optional) A link to the next page - of resources. This property is present for all pages - except the last page. - :attr int total_count: The total number of resources across all pages. + :attr str type: The type for this profile field. + :attr int value: The size of the disk in GB (gigabytes). """ def __init__(self, - first: 'DedicatedHostGroupCollectionFirst', - groups: List['DedicatedHostGroup'], - limit: int, - total_count: int, - *, - next: 'DedicatedHostGroupCollectionNext' = None) -> None: + type: str, + value: int) -> None: """ - Initialize a DedicatedHostGroupCollection object. + Initialize a DedicatedHostProfileDiskSize object. - :param DedicatedHostGroupCollectionFirst first: A link to the first page of - resources. - :param List[DedicatedHostGroup] groups: Collection of dedicated host - groups. - :param int limit: The maximum number of resources that can be returned by - the request. - :param int total_count: The total number of resources across all pages. - :param DedicatedHostGroupCollectionNext next: (optional) A link to the next - page of resources. This property is present for all pages - except the last page. + :param str type: The type for this profile field. + :param int value: The size of the disk in GB (gigabytes). """ - self.first = first - self.groups = groups - self.limit = limit - self.next = next - self.total_count = total_count + self.type = type + self.value = value @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostGroupCollection': - """Initialize a DedicatedHostGroupCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostProfileDiskSize': + """Initialize a DedicatedHostProfileDiskSize object from a json dictionary.""" args = {} - if 'first' in _dict: - args['first'] = DedicatedHostGroupCollectionFirst.from_dict(_dict.get('first')) - else: - raise ValueError('Required property \'first\' not present in DedicatedHostGroupCollection JSON') - if 'groups' in _dict: - args['groups'] = [DedicatedHostGroup.from_dict(x) for x in _dict.get('groups')] - else: - raise ValueError('Required property \'groups\' not present in DedicatedHostGroupCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') + if 'type' in _dict: + args['type'] = _dict.get('type') else: - raise ValueError('Required property \'limit\' not present in DedicatedHostGroupCollection JSON') - if 'next' in _dict: - args['next'] = DedicatedHostGroupCollectionNext.from_dict(_dict.get('next')) - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') + raise ValueError('Required property \'type\' not present in DedicatedHostProfileDiskSize JSON') + if 'value' in _dict: + args['value'] = _dict.get('value') else: - raise ValueError('Required property \'total_count\' not present in DedicatedHostGroupCollection JSON') + raise ValueError('Required property \'value\' not present in DedicatedHostProfileDiskSize JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DedicatedHostGroupCollection object from a json dictionary.""" + """Initialize a DedicatedHostProfileDiskSize object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'groups') and self.groups is not None: - _dict['groups'] = [x.to_dict() for x in self.groups] - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'value') and self.value is not None: + _dict['value'] = self.value return _dict def _to_dict(self): @@ -21738,55 +25827,74 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DedicatedHostGroupCollection object.""" + """Return a `str` version of this DedicatedHostProfileDiskSize object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHostGroupCollection') -> bool: + def __eq__(self, other: 'DedicatedHostProfileDiskSize') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DedicatedHostGroupCollection') -> bool: + def __ne__(self, other: 'DedicatedHostProfileDiskSize') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class DedicatedHostGroupCollectionFirst(): + class TypeEnum(str, Enum): + """ + The type for this profile field. + """ + FIXED = 'fixed' + + +class DedicatedHostProfileDiskSupportedInterfaces(): """ - A link to the first page of resources. + DedicatedHostProfileDiskSupportedInterfaces. - :attr str href: The URL for a page of resources. + :attr str type: The type for this profile field. + :attr List[str] value: The instance disk interfaces supported for a dedicated + host with this profile. """ def __init__(self, - href: str) -> None: + type: str, + value: List[str]) -> None: """ - Initialize a DedicatedHostGroupCollectionFirst object. + Initialize a DedicatedHostProfileDiskSupportedInterfaces object. - :param str href: The URL for a page of resources. + :param str type: The type for this profile field. + :param List[str] value: The instance disk interfaces supported for a + dedicated host with this profile. """ - self.href = href + self.type = type + self.value = value @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostGroupCollectionFirst': - """Initialize a DedicatedHostGroupCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostProfileDiskSupportedInterfaces': + """Initialize a DedicatedHostProfileDiskSupportedInterfaces object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') + if 'type' in _dict: + args['type'] = _dict.get('type') else: - raise ValueError('Required property \'href\' not present in DedicatedHostGroupCollectionFirst JSON') + raise ValueError('Required property \'type\' not present in DedicatedHostProfileDiskSupportedInterfaces JSON') + if 'value' in _dict: + args['value'] = _dict.get('value') + else: + raise ValueError('Required property \'value\' not present in DedicatedHostProfileDiskSupportedInterfaces JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DedicatedHostGroupCollectionFirst object from a json dictionary.""" + """Initialize a DedicatedHostProfileDiskSupportedInterfaces object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'value') and self.value is not None: + _dict['value'] = self.value return _dict def _to_dict(self): @@ -21794,49 +25902,105 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DedicatedHostGroupCollectionFirst object.""" + """Return a `str` version of this DedicatedHostProfileDiskSupportedInterfaces object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHostGroupCollectionFirst') -> bool: + def __eq__(self, other: 'DedicatedHostProfileDiskSupportedInterfaces') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DedicatedHostGroupCollectionFirst') -> bool: + def __ne__(self, other: 'DedicatedHostProfileDiskSupportedInterfaces') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class DedicatedHostGroupCollectionNext(): + class TypeEnum(str, Enum): + """ + The type for this profile field. + """ + FIXED = 'fixed' + + + class ValueEnum(str, Enum): + """ + The disk interface used for attaching the disk. + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the resource on which the unexpected + property value was encountered. + """ + NVME = 'nvme' + VIRTIO_BLK = 'virtio_blk' + + +class DedicatedHostProfileIdentity(): """ - A link to the next page of resources. This property is present for all pages except - the last page. + Identifies a dedicated host profile by a unique property. - :attr str href: The URL for a page of resources. + """ + + def __init__(self) -> None: + """ + Initialize a DedicatedHostProfileIdentity object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['DedicatedHostProfileIdentityByName', 'DedicatedHostProfileIdentityByHref'])) + raise Exception(msg) + +class DedicatedHostProfileMemory(): + """ + DedicatedHostProfileMemory. + + """ + + def __init__(self) -> None: + """ + Initialize a DedicatedHostProfileMemory object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['DedicatedHostProfileMemoryFixed', 'DedicatedHostProfileMemoryRange', 'DedicatedHostProfileMemoryEnum', 'DedicatedHostProfileMemoryDependent'])) + raise Exception(msg) + +class DedicatedHostProfileReference(): + """ + DedicatedHostProfileReference. + + :attr str href: The URL for this dedicated host. + :attr str name: The globally unique name for this dedicated host profile. """ def __init__(self, - href: str) -> None: + href: str, + name: str) -> None: """ - Initialize a DedicatedHostGroupCollectionNext object. + Initialize a DedicatedHostProfileReference object. - :param str href: The URL for a page of resources. + :param str href: The URL for this dedicated host. + :param str name: The globally unique name for this dedicated host profile. """ self.href = href + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostGroupCollectionNext': - """Initialize a DedicatedHostGroupCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostProfileReference': + """Initialize a DedicatedHostProfileReference object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in DedicatedHostGroupCollectionNext JSON') + raise ValueError('Required property \'href\' not present in DedicatedHostProfileReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in DedicatedHostProfileReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DedicatedHostGroupCollectionNext object from a json dictionary.""" + """Initialize a DedicatedHostProfileReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -21844,6 +26008,8 @@ def to_dict(self) -> Dict: _dict = {} if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -21851,71 +26017,96 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DedicatedHostGroupCollectionNext object.""" + """Return a `str` version of this DedicatedHostProfileReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHostGroupCollectionNext') -> bool: + def __eq__(self, other: 'DedicatedHostProfileReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DedicatedHostGroupCollectionNext') -> bool: + def __ne__(self, other: 'DedicatedHostProfileReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class DedicatedHostGroupIdentity(): +class DedicatedHostProfileSocket(): """ - Identifies a dedicated host group by a unique property. + DedicatedHostProfileSocket. """ def __init__(self) -> None: """ - Initialize a DedicatedHostGroupIdentity object. + Initialize a DedicatedHostProfileSocket object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['DedicatedHostGroupIdentityById', 'DedicatedHostGroupIdentityByCRN', 'DedicatedHostGroupIdentityByHref'])) + ", ".join(['DedicatedHostProfileSocketFixed', 'DedicatedHostProfileSocketRange', 'DedicatedHostProfileSocketEnum', 'DedicatedHostProfileSocketDependent'])) raise Exception(msg) -class DedicatedHostGroupPatch(): +class DedicatedHostProfileVCPU(): """ - DedicatedHostGroupPatch. + DedicatedHostProfileVCPU. - :attr str name: (optional) The unique user-defined name for this dedicated host - group. """ - def __init__(self, - *, - name: str = None) -> None: + def __init__(self) -> None: """ - Initialize a DedicatedHostGroupPatch object. + Initialize a DedicatedHostProfileVCPU object. - :param str name: (optional) The unique user-defined name for this dedicated - host group. """ - self.name = name + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['DedicatedHostProfileVCPUFixed', 'DedicatedHostProfileVCPURange', 'DedicatedHostProfileVCPUEnum', 'DedicatedHostProfileVCPUDependent'])) + raise Exception(msg) + +class DedicatedHostProfileVCPUArchitecture(): + """ + DedicatedHostProfileVCPUArchitecture. + + :attr str type: The type for this profile field. + :attr str value: The VCPU architecture for a dedicated host with this profile. + """ + + def __init__(self, + type: str, + value: str) -> None: + """ + Initialize a DedicatedHostProfileVCPUArchitecture object. + + :param str type: The type for this profile field. + :param str value: The VCPU architecture for a dedicated host with this + profile. + """ + self.type = type + self.value = value @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostGroupPatch': - """Initialize a DedicatedHostGroupPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostProfileVCPUArchitecture': + """Initialize a DedicatedHostProfileVCPUArchitecture object from a json dictionary.""" args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') + if 'type' in _dict: + args['type'] = _dict.get('type') + else: + raise ValueError('Required property \'type\' not present in DedicatedHostProfileVCPUArchitecture JSON') + if 'value' in _dict: + args['value'] = _dict.get('value') + else: + raise ValueError('Required property \'value\' not present in DedicatedHostProfileVCPUArchitecture JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DedicatedHostGroupPatch object from a json dictionary.""" + """Initialize a DedicatedHostProfileVCPUArchitecture object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'value') and self.value is not None: + _dict['value'] = self.value return _dict def _to_dict(self): @@ -21923,100 +26114,77 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DedicatedHostGroupPatch object.""" + """Return a `str` version of this DedicatedHostProfileVCPUArchitecture object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHostGroupPatch') -> bool: + def __eq__(self, other: 'DedicatedHostProfileVCPUArchitecture') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DedicatedHostGroupPatch') -> bool: + def __ne__(self, other: 'DedicatedHostProfileVCPUArchitecture') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class DedicatedHostGroupPrototypeDedicatedHostByZoneContext(): + class TypeEnum(str, Enum): + """ + The type for this profile field. + """ + FIXED = 'fixed' + + +class DedicatedHostPrototype(): """ - DedicatedHostGroupPrototypeDedicatedHostByZoneContext. + DedicatedHostPrototype. - :attr str name: (optional) The unique user-defined name for this dedicated host - group. + :attr bool instance_placement_enabled: (optional) If set to true, instances can + be placed on this dedicated host. + :attr str name: (optional) The unique user-defined name for this dedicated host. + If unspecified, the name will be a hyphenated list of randomly-selected words. + :attr DedicatedHostProfileIdentity profile: The profile to use for this + dedicated host. :attr ResourceGroupIdentity resource_group: (optional) The resource group to - use. If unspecified, the host's resource group is used. + use. If unspecified, the account's [default resource + group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. """ def __init__(self, + profile: 'DedicatedHostProfileIdentity', *, + instance_placement_enabled: bool = None, name: str = None, resource_group: 'ResourceGroupIdentity' = None) -> None: """ - Initialize a DedicatedHostGroupPrototypeDedicatedHostByZoneContext object. + Initialize a DedicatedHostPrototype object. + :param DedicatedHostProfileIdentity profile: The profile to use for this + dedicated host. + :param bool instance_placement_enabled: (optional) If set to true, + instances can be placed on this dedicated host. :param str name: (optional) The unique user-defined name for this dedicated - host group. + host. If unspecified, the name will be a hyphenated list of + randomly-selected words. :param ResourceGroupIdentity resource_group: (optional) The resource group - to use. If unspecified, the host's resource group is used. + to use. If unspecified, the account's [default resource + group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is + used. """ - self.name = name - self.resource_group = resource_group - - @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostGroupPrototypeDedicatedHostByZoneContext': - """Initialize a DedicatedHostGroupPrototypeDedicatedHostByZoneContext object from a json dictionary.""" - args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') - if 'resource_group' in _dict: - args['resource_group'] = _dict.get('resource_group') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a DedicatedHostGroupPrototypeDedicatedHostByZoneContext object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'resource_group') and self.resource_group is not None: - if isinstance(self.resource_group, dict): - _dict['resource_group'] = self.resource_group - else: - _dict['resource_group'] = self.resource_group.to_dict() - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this DedicatedHostGroupPrototypeDedicatedHostByZoneContext object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'DedicatedHostGroupPrototypeDedicatedHostByZoneContext') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'DedicatedHostGroupPrototypeDedicatedHostByZoneContext') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['DedicatedHostPrototypeDedicatedHostByGroup', 'DedicatedHostPrototypeDedicatedHostByZone'])) + raise Exception(msg) -class DedicatedHostGroupReference(): +class DedicatedHostReference(): """ - DedicatedHostGroupReference. + DedicatedHostReference. - :attr str crn: The CRN for this dedicated host group. - :attr DedicatedHostGroupReferenceDeleted deleted: (optional) If present, this + :attr str crn: The CRN for this dedicated host. + :attr DedicatedHostReferenceDeleted deleted: (optional) If present, this property indicates the referenced resource has been deleted and provides some supplementary information. - :attr str href: The URL for this dedicated host group. - :attr str id: The unique identifier for this dedicated host group. - :attr str name: The unique user-defined name for this dedicated host group. + :attr str href: The URL for this dedicated host. + :attr str id: The unique identifier for this dedicated host. + :attr str name: The unique user-defined name for this dedicated host. :attr str resource_type: The resource type. """ @@ -22027,19 +26195,17 @@ def __init__(self, name: str, resource_type: str, *, - deleted: 'DedicatedHostGroupReferenceDeleted' = None) -> None: + deleted: 'DedicatedHostReferenceDeleted' = None) -> None: """ - Initialize a DedicatedHostGroupReference object. + Initialize a DedicatedHostReference object. - :param str crn: The CRN for this dedicated host group. - :param str href: The URL for this dedicated host group. - :param str id: The unique identifier for this dedicated host group. - :param str name: The unique user-defined name for this dedicated host - group. + :param str crn: The CRN for this dedicated host. + :param str href: The URL for this dedicated host. + :param str id: The unique identifier for this dedicated host. + :param str name: The unique user-defined name for this dedicated host. :param str resource_type: The resource type. - :param DedicatedHostGroupReferenceDeleted deleted: (optional) If present, - this property indicates the referenced resource has been deleted and - provides + :param DedicatedHostReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides some supplementary information. """ self.crn = crn @@ -22050,36 +26216,36 @@ def __init__(self, self.resource_type = resource_type @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostGroupReference': - """Initialize a DedicatedHostGroupReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostReference': + """Initialize a DedicatedHostReference object from a json dictionary.""" args = {} if 'crn' in _dict: args['crn'] = _dict.get('crn') else: - raise ValueError('Required property \'crn\' not present in DedicatedHostGroupReference JSON') + raise ValueError('Required property \'crn\' not present in DedicatedHostReference JSON') if 'deleted' in _dict: - args['deleted'] = DedicatedHostGroupReferenceDeleted.from_dict(_dict.get('deleted')) + args['deleted'] = DedicatedHostReferenceDeleted.from_dict(_dict.get('deleted')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in DedicatedHostGroupReference JSON') + raise ValueError('Required property \'href\' not present in DedicatedHostReference JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in DedicatedHostGroupReference JSON') + raise ValueError('Required property \'id\' not present in DedicatedHostReference JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in DedicatedHostGroupReference JSON') + raise ValueError('Required property \'name\' not present in DedicatedHostReference JSON') if 'resource_type' in _dict: args['resource_type'] = _dict.get('resource_type') else: - raise ValueError('Required property \'resource_type\' not present in DedicatedHostGroupReference JSON') + raise ValueError('Required property \'resource_type\' not present in DedicatedHostReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DedicatedHostGroupReference object from a json dictionary.""" + """Initialize a DedicatedHostReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -22104,16 +26270,16 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DedicatedHostGroupReference object.""" + """Return a `str` version of this DedicatedHostReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHostGroupReference') -> bool: + def __eq__(self, other: 'DedicatedHostReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DedicatedHostGroupReference') -> bool: + def __ne__(self, other: 'DedicatedHostReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other @@ -22121,10 +26287,10 @@ class ResourceTypeEnum(str, Enum): """ The resource type. """ - DEDICATED_HOST_GROUP = 'dedicated_host_group' + DEDICATED_HOST = 'dedicated_host' -class DedicatedHostGroupReferenceDeleted(): +class DedicatedHostReferenceDeleted(): """ If present, this property indicates the referenced resource has been deleted and provides some supplementary information. @@ -22135,25 +26301,25 @@ class DedicatedHostGroupReferenceDeleted(): def __init__(self, more_info: str) -> None: """ - Initialize a DedicatedHostGroupReferenceDeleted object. + Initialize a DedicatedHostReferenceDeleted object. :param str more_info: Link to documentation about deleted resources. """ self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostGroupReferenceDeleted': - """Initialize a DedicatedHostGroupReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DedicatedHostReferenceDeleted': + """Initialize a DedicatedHostReferenceDeleted object from a json dictionary.""" args = {} if 'more_info' in _dict: args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'more_info\' not present in DedicatedHostGroupReferenceDeleted JSON') + raise ValueError('Required property \'more_info\' not present in DedicatedHostReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DedicatedHostGroupReferenceDeleted object from a json dictionary.""" + """Initialize a DedicatedHostReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -22168,65 +26334,152 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DedicatedHostGroupReferenceDeleted object.""" + """Return a `str` version of this DedicatedHostReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHostGroupReferenceDeleted') -> bool: + def __eq__(self, other: 'DedicatedHostReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DedicatedHostGroupReferenceDeleted') -> bool: + def __ne__(self, other: 'DedicatedHostReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class DedicatedHostPatch(): +class DefaultNetworkACL(): """ - DedicatedHostPatch. + DefaultNetworkACL. - :attr bool instance_placement_enabled: (optional) If set to true, instances can - be placed on this dedicated host. - :attr str name: (optional) The unique user-defined name for this dedicated host. + :attr datetime created_at: The date and time that the network ACL was created. + :attr str crn: The CRN for this network ACL. + :attr str href: The URL for this network ACL. + :attr str id: The unique identifier for this network ACL. + :attr str name: The name of the default network ACL created for a VPC. The name + will be a hyphenated list of randomly-selected words at creation, but may be + user-specified with a subsequent request. + :attr ResourceGroupReference resource_group: The resource group for the default + network ACL for a VPC. Set to the VPC's + resource group at creation. + :attr List[NetworkACLRuleItem] rules: The ordered rules for the default network + ACL for a VPC. Defaults to two rules which allow all inbound and outbound + traffic, respectively. Rules for the default network ACL may be changed, added, + or removed. + :attr List[SubnetReference] subnets: The subnets to which this network ACL is + attached. + :attr VPCReference vpc: The VPC this network ACL is a part of. """ def __init__(self, - *, - instance_placement_enabled: bool = None, - name: str = None) -> None: + created_at: datetime, + crn: str, + href: str, + id: str, + name: str, + resource_group: 'ResourceGroupReference', + rules: List['NetworkACLRuleItem'], + subnets: List['SubnetReference'], + vpc: 'VPCReference') -> None: """ - Initialize a DedicatedHostPatch object. + Initialize a DefaultNetworkACL object. - :param bool instance_placement_enabled: (optional) If set to true, - instances can be placed on this dedicated host. - :param str name: (optional) The unique user-defined name for this dedicated - host. + :param datetime created_at: The date and time that the network ACL was + created. + :param str crn: The CRN for this network ACL. + :param str href: The URL for this network ACL. + :param str id: The unique identifier for this network ACL. + :param str name: The name of the default network ACL created for a VPC. The + name will be a hyphenated list of randomly-selected words at creation, but + may be user-specified with a subsequent request. + :param ResourceGroupReference resource_group: The resource group for the + default network ACL for a VPC. Set to the VPC's + resource group at creation. + :param List[NetworkACLRuleItem] rules: The ordered rules for the default + network ACL for a VPC. Defaults to two rules which allow all inbound and + outbound traffic, respectively. Rules for the default network ACL may be + changed, added, or removed. + :param List[SubnetReference] subnets: The subnets to which this network ACL + is attached. + :param VPCReference vpc: The VPC this network ACL is a part of. """ - self.instance_placement_enabled = instance_placement_enabled + self.created_at = created_at + self.crn = crn + self.href = href + self.id = id self.name = name + self.resource_group = resource_group + self.rules = rules + self.subnets = subnets + self.vpc = vpc @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostPatch': - """Initialize a DedicatedHostPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DefaultNetworkACL': + """Initialize a DefaultNetworkACL object from a json dictionary.""" args = {} - if 'instance_placement_enabled' in _dict: - args['instance_placement_enabled'] = _dict.get('instance_placement_enabled') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) + else: + raise ValueError('Required property \'created_at\' not present in DefaultNetworkACL JSON') + if 'crn' in _dict: + args['crn'] = _dict.get('crn') + else: + raise ValueError('Required property \'crn\' not present in DefaultNetworkACL JSON') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in DefaultNetworkACL JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in DefaultNetworkACL JSON') if 'name' in _dict: args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in DefaultNetworkACL JSON') + if 'resource_group' in _dict: + args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) + else: + raise ValueError('Required property \'resource_group\' not present in DefaultNetworkACL JSON') + if 'rules' in _dict: + args['rules'] = [NetworkACLRuleItem.from_dict(x) for x in _dict.get('rules')] + else: + raise ValueError('Required property \'rules\' not present in DefaultNetworkACL JSON') + if 'subnets' in _dict: + args['subnets'] = [SubnetReference.from_dict(x) for x in _dict.get('subnets')] + else: + raise ValueError('Required property \'subnets\' not present in DefaultNetworkACL JSON') + if 'vpc' in _dict: + args['vpc'] = VPCReference.from_dict(_dict.get('vpc')) + else: + raise ValueError('Required property \'vpc\' not present in DefaultNetworkACL JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DedicatedHostPatch object from a json dictionary.""" + """Initialize a DefaultNetworkACL object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'instance_placement_enabled') and self.instance_placement_enabled is not None: - _dict['instance_placement_enabled'] = self.instance_placement_enabled + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name + if hasattr(self, 'resource_group') and self.resource_group is not None: + _dict['resource_group'] = self.resource_group.to_dict() + if hasattr(self, 'rules') and self.rules is not None: + _dict['rules'] = [x.to_dict() for x in self.rules] + if hasattr(self, 'subnets') and self.subnets is not None: + _dict['subnets'] = [x.to_dict() for x in self.subnets] + if hasattr(self, 'vpc') and self.vpc is not None: + _dict['vpc'] = self.vpc.to_dict() return _dict def _to_dict(self): @@ -22234,169 +26487,244 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DedicatedHostPatch object.""" + """Return a `str` version of this DefaultNetworkACL object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHostPatch') -> bool: + def __eq__(self, other: 'DefaultNetworkACL') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DedicatedHostPatch') -> bool: + def __ne__(self, other: 'DefaultNetworkACL') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class DedicatedHostProfile(): +class DefaultRoutingTable(): """ - DedicatedHostProfile. + DefaultRoutingTable. - :attr str class_: The product class this dedicated host profile belongs to. - :attr List[DedicatedHostProfileDisk] disks: Collection of the dedicated host - profile's disks. - :attr str family: The product family this dedicated host profile belongs to - The enumerated values for this property are expected to expand in the future. - When processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the resource on which the unexpected - property value was encountered. - :attr str href: The URL for this dedicated host. - :attr DedicatedHostProfileMemory memory: - :attr str name: The globally unique name for this dedicated host profile. - :attr DedicatedHostProfileSocket socket_count: - :attr List[InstanceProfileReference] supported_instance_profiles: The instance - profiles usable by instances placed on dedicated hosts with this profile. - :attr DedicatedHostProfileVCPUArchitecture vcpu_architecture: - :attr DedicatedHostProfileVCPU vcpu_count: + :attr List[ResourceFilter] accept_routes_from: The filters specifying the + resources that may create routes in this routing table. + At present, only the `resource_type` filter is permitted, and only the + `vpn_server` value is supported, but filter support is expected to expand in the + future. + :attr datetime created_at: The date and time that this routing table was + created. + :attr str href: The URL for this routing table. + :attr str id: The unique identifier for this routing table. + :attr bool is_default: Indicates whether this is the default routing table for + this VPC. + :attr str lifecycle_state: The lifecycle state of the routing table. + :attr str name: The name of the default routing table created for this VPC. The + name will be a hyphenated list of randomly-selected words at creation, but may + be user-specified with a subsequent request. + :attr str resource_type: The resource type. + :attr bool route_direct_link_ingress: Indicates whether this routing table is + used to route traffic that originates from + [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. + Incoming traffic will be routed according to the routing table with one + exception: routes with an `action` of `deliver` are treated as `drop` unless the + `next_hop` is an IP address bound to a network interface on a subnet in the + route's `zone`. Therefore, if an incoming packet matches a route with a + `next_hop` of an internet-bound IP address or a VPN gateway connection, the + packet will be dropped. + :attr bool route_transit_gateway_ingress: Indicates whether this routing table + is used to route traffic that originates from from [Transit + Gateway](https://cloud.ibm.com/cloud/transit-gateway/) to this VPC. + Incoming traffic will be routed according to the routing table with one + exception: routes with an `action` of `deliver` are treated as `drop` unless the + `next_hop` is an IP address bound to a network interface on a subnet in the + route's `zone`. Therefore, if an incoming packet matches a route with a + `next_hop` of an internet-bound IP address or a VPN gateway connection, the + packet will be dropped. + :attr bool route_vpc_zone_ingress: Indicates whether this routing table is used + to route traffic that originates from subnets in other zones in this VPC. + Incoming traffic will be routed according to the routing table with one + exception: routes with an `action` of `deliver` are treated as `drop` unless the + `next_hop` is an IP address bound to a network interface on a subnet in the + route's `zone`. Therefore, if an incoming packet matches a route with a + `next_hop` of an internet-bound IP address or a VPN gateway connection, the + packet will be dropped. + :attr List[RouteReference] routes: The routes for the default routing table for + this VPC. The table is created with no routes, but routes may be added, changed, + or removed with a subsequent request. + :attr List[SubnetReference] subnets: The subnets to which this routing table is + attached. """ def __init__(self, - class_: str, - disks: List['DedicatedHostProfileDisk'], - family: str, + accept_routes_from: List['ResourceFilter'], + created_at: datetime, href: str, - memory: 'DedicatedHostProfileMemory', + id: str, + is_default: bool, + lifecycle_state: str, name: str, - socket_count: 'DedicatedHostProfileSocket', - supported_instance_profiles: List['InstanceProfileReference'], - vcpu_architecture: 'DedicatedHostProfileVCPUArchitecture', - vcpu_count: 'DedicatedHostProfileVCPU') -> None: + resource_type: str, + route_direct_link_ingress: bool, + route_transit_gateway_ingress: bool, + route_vpc_zone_ingress: bool, + routes: List['RouteReference'], + subnets: List['SubnetReference']) -> None: """ - Initialize a DedicatedHostProfile object. + Initialize a DefaultRoutingTable object. - :param str class_: The product class this dedicated host profile belongs - to. - :param List[DedicatedHostProfileDisk] disks: Collection of the dedicated - host profile's disks. - :param str family: The product family this dedicated host profile belongs - to - The enumerated values for this property are expected to expand in the - future. When processing this property, check for and log unknown values. - Optionally halt processing and surface the error, or bypass the resource on - which the unexpected property value was encountered. - :param str href: The URL for this dedicated host. - :param DedicatedHostProfileMemory memory: - :param str name: The globally unique name for this dedicated host profile. - :param DedicatedHostProfileSocket socket_count: - :param List[InstanceProfileReference] supported_instance_profiles: The - instance profiles usable by instances placed on dedicated hosts with this - profile. - :param DedicatedHostProfileVCPUArchitecture vcpu_architecture: - :param DedicatedHostProfileVCPU vcpu_count: + :param List[ResourceFilter] accept_routes_from: The filters specifying the + resources that may create routes in this routing table. + At present, only the `resource_type` filter is permitted, and only the + `vpn_server` value is supported, but filter support is expected to expand + in the future. + :param datetime created_at: The date and time that this routing table was + created. + :param str href: The URL for this routing table. + :param str id: The unique identifier for this routing table. + :param bool is_default: Indicates whether this is the default routing table + for this VPC. + :param str lifecycle_state: The lifecycle state of the routing table. + :param str name: The name of the default routing table created for this + VPC. The name will be a hyphenated list of randomly-selected words at + creation, but may be user-specified with a subsequent request. + :param str resource_type: The resource type. + :param bool route_direct_link_ingress: Indicates whether this routing table + is used to route traffic that originates from + [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. + Incoming traffic will be routed according to the routing table with one + exception: routes with an `action` of `deliver` are treated as `drop` + unless the `next_hop` is an IP address bound to a network interface on a + subnet in the route's `zone`. Therefore, if an incoming packet matches a + route with a `next_hop` of an internet-bound IP address or a VPN gateway + connection, the packet will be dropped. + :param bool route_transit_gateway_ingress: Indicates whether this routing + table is used to route traffic that originates from from [Transit + Gateway](https://cloud.ibm.com/cloud/transit-gateway/) to this VPC. + Incoming traffic will be routed according to the routing table with one + exception: routes with an `action` of `deliver` are treated as `drop` + unless the `next_hop` is an IP address bound to a network interface on a + subnet in the route's `zone`. Therefore, if an incoming packet matches a + route with a `next_hop` of an internet-bound IP address or a VPN gateway + connection, the packet will be dropped. + :param bool route_vpc_zone_ingress: Indicates whether this routing table is + used to route traffic that originates from subnets in other zones in this + VPC. + Incoming traffic will be routed according to the routing table with one + exception: routes with an `action` of `deliver` are treated as `drop` + unless the `next_hop` is an IP address bound to a network interface on a + subnet in the route's `zone`. Therefore, if an incoming packet matches a + route with a `next_hop` of an internet-bound IP address or a VPN gateway + connection, the packet will be dropped. + :param List[RouteReference] routes: The routes for the default routing + table for this VPC. The table is created with no routes, but routes may be + added, changed, or removed with a subsequent request. + :param List[SubnetReference] subnets: The subnets to which this routing + table is attached. """ - self.class_ = class_ - self.disks = disks - self.family = family + self.accept_routes_from = accept_routes_from + self.created_at = created_at self.href = href - self.memory = memory + self.id = id + self.is_default = is_default + self.lifecycle_state = lifecycle_state self.name = name - self.socket_count = socket_count - self.supported_instance_profiles = supported_instance_profiles - self.vcpu_architecture = vcpu_architecture - self.vcpu_count = vcpu_count + self.resource_type = resource_type + self.route_direct_link_ingress = route_direct_link_ingress + self.route_transit_gateway_ingress = route_transit_gateway_ingress + self.route_vpc_zone_ingress = route_vpc_zone_ingress + self.routes = routes + self.subnets = subnets @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostProfile': - """Initialize a DedicatedHostProfile object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DefaultRoutingTable': + """Initialize a DefaultRoutingTable object from a json dictionary.""" args = {} - if 'class' in _dict: - args['class_'] = _dict.get('class') - else: - raise ValueError('Required property \'class\' not present in DedicatedHostProfile JSON') - if 'disks' in _dict: - args['disks'] = [DedicatedHostProfileDisk.from_dict(x) for x in _dict.get('disks')] + if 'accept_routes_from' in _dict: + args['accept_routes_from'] = [ResourceFilter.from_dict(x) for x in _dict.get('accept_routes_from')] else: - raise ValueError('Required property \'disks\' not present in DedicatedHostProfile JSON') - if 'family' in _dict: - args['family'] = _dict.get('family') + raise ValueError('Required property \'accept_routes_from\' not present in DefaultRoutingTable JSON') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError('Required property \'family\' not present in DedicatedHostProfile JSON') + raise ValueError('Required property \'created_at\' not present in DefaultRoutingTable JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in DedicatedHostProfile JSON') - if 'memory' in _dict: - args['memory'] = _dict.get('memory') + raise ValueError('Required property \'href\' not present in DefaultRoutingTable JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') else: - raise ValueError('Required property \'memory\' not present in DedicatedHostProfile JSON') + raise ValueError('Required property \'id\' not present in DefaultRoutingTable JSON') + if 'is_default' in _dict: + args['is_default'] = _dict.get('is_default') + else: + raise ValueError('Required property \'is_default\' not present in DefaultRoutingTable JSON') + if 'lifecycle_state' in _dict: + args['lifecycle_state'] = _dict.get('lifecycle_state') + else: + raise ValueError('Required property \'lifecycle_state\' not present in DefaultRoutingTable JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in DedicatedHostProfile JSON') - if 'socket_count' in _dict: - args['socket_count'] = _dict.get('socket_count') + raise ValueError('Required property \'name\' not present in DefaultRoutingTable JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') else: - raise ValueError('Required property \'socket_count\' not present in DedicatedHostProfile JSON') - if 'supported_instance_profiles' in _dict: - args['supported_instance_profiles'] = [InstanceProfileReference.from_dict(x) for x in _dict.get('supported_instance_profiles')] + raise ValueError('Required property \'resource_type\' not present in DefaultRoutingTable JSON') + if 'route_direct_link_ingress' in _dict: + args['route_direct_link_ingress'] = _dict.get('route_direct_link_ingress') else: - raise ValueError('Required property \'supported_instance_profiles\' not present in DedicatedHostProfile JSON') - if 'vcpu_architecture' in _dict: - args['vcpu_architecture'] = DedicatedHostProfileVCPUArchitecture.from_dict(_dict.get('vcpu_architecture')) + raise ValueError('Required property \'route_direct_link_ingress\' not present in DefaultRoutingTable JSON') + if 'route_transit_gateway_ingress' in _dict: + args['route_transit_gateway_ingress'] = _dict.get('route_transit_gateway_ingress') else: - raise ValueError('Required property \'vcpu_architecture\' not present in DedicatedHostProfile JSON') - if 'vcpu_count' in _dict: - args['vcpu_count'] = _dict.get('vcpu_count') + raise ValueError('Required property \'route_transit_gateway_ingress\' not present in DefaultRoutingTable JSON') + if 'route_vpc_zone_ingress' in _dict: + args['route_vpc_zone_ingress'] = _dict.get('route_vpc_zone_ingress') else: - raise ValueError('Required property \'vcpu_count\' not present in DedicatedHostProfile JSON') + raise ValueError('Required property \'route_vpc_zone_ingress\' not present in DefaultRoutingTable JSON') + if 'routes' in _dict: + args['routes'] = [RouteReference.from_dict(x) for x in _dict.get('routes')] + else: + raise ValueError('Required property \'routes\' not present in DefaultRoutingTable JSON') + if 'subnets' in _dict: + args['subnets'] = [SubnetReference.from_dict(x) for x in _dict.get('subnets')] + else: + raise ValueError('Required property \'subnets\' not present in DefaultRoutingTable JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DedicatedHostProfile object from a json dictionary.""" + """Initialize a DefaultRoutingTable object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'class_') and self.class_ is not None: - _dict['class'] = self.class_ - if hasattr(self, 'disks') and self.disks is not None: - _dict['disks'] = [x.to_dict() for x in self.disks] - if hasattr(self, 'family') and self.family is not None: - _dict['family'] = self.family + if hasattr(self, 'accept_routes_from') and self.accept_routes_from is not None: + _dict['accept_routes_from'] = [x.to_dict() for x in self.accept_routes_from] + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href - if hasattr(self, 'memory') and self.memory is not None: - if isinstance(self.memory, dict): - _dict['memory'] = self.memory - else: - _dict['memory'] = self.memory.to_dict() + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'is_default') and self.is_default is not None: + _dict['is_default'] = self.is_default + if hasattr(self, 'lifecycle_state') and self.lifecycle_state is not None: + _dict['lifecycle_state'] = self.lifecycle_state if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'socket_count') and self.socket_count is not None: - if isinstance(self.socket_count, dict): - _dict['socket_count'] = self.socket_count - else: - _dict['socket_count'] = self.socket_count.to_dict() - if hasattr(self, 'supported_instance_profiles') and self.supported_instance_profiles is not None: - _dict['supported_instance_profiles'] = [x.to_dict() for x in self.supported_instance_profiles] - if hasattr(self, 'vcpu_architecture') and self.vcpu_architecture is not None: - _dict['vcpu_architecture'] = self.vcpu_architecture.to_dict() - if hasattr(self, 'vcpu_count') and self.vcpu_count is not None: - if isinstance(self.vcpu_count, dict): - _dict['vcpu_count'] = self.vcpu_count - else: - _dict['vcpu_count'] = self.vcpu_count.to_dict() + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + if hasattr(self, 'route_direct_link_ingress') and self.route_direct_link_ingress is not None: + _dict['route_direct_link_ingress'] = self.route_direct_link_ingress + if hasattr(self, 'route_transit_gateway_ingress') and self.route_transit_gateway_ingress is not None: + _dict['route_transit_gateway_ingress'] = self.route_transit_gateway_ingress + if hasattr(self, 'route_vpc_zone_ingress') and self.route_vpc_zone_ingress is not None: + _dict['route_vpc_zone_ingress'] = self.route_vpc_zone_ingress + if hasattr(self, 'routes') and self.routes is not None: + _dict['routes'] = [x.to_dict() for x in self.routes] + if hasattr(self, 'subnets') and self.subnets is not None: + _dict['subnets'] = [x.to_dict() for x in self.subnets] return _dict def _to_dict(self): @@ -22404,117 +26732,178 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DedicatedHostProfile object.""" + """Return a `str` version of this DefaultRoutingTable object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHostProfile') -> bool: + def __eq__(self, other: 'DefaultRoutingTable') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DedicatedHostProfile') -> bool: + def __ne__(self, other: 'DefaultRoutingTable') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class FamilyEnum(str, Enum): + class LifecycleStateEnum(str, Enum): """ - The product family this dedicated host profile belongs to - The enumerated values for this property are expected to expand in the future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the resource on which the unexpected - property value was encountered. + The lifecycle state of the routing table. """ - BALANCED = 'balanced' - COMPUTE = 'compute' - MEMORY = 'memory' + DELETING = 'deleting' + FAILED = 'failed' + PENDING = 'pending' + STABLE = 'stable' + SUSPENDED = 'suspended' + UPDATING = 'updating' + WAITING = 'waiting' -class DedicatedHostProfileCollection(): + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + ROUTING_TABLE = 'routing_table' + + +class DefaultSecurityGroup(): """ - DedicatedHostProfileCollection. + DefaultSecurityGroup. - :attr DedicatedHostProfileCollectionFirst first: A link to the first page of - resources. - :attr int limit: The maximum number of resources that can be returned by the - request. - :attr DedicatedHostProfileCollectionNext next: (optional) A link to the next - page of resources. This property is present for all pages - except the last page. - :attr List[DedicatedHostProfile] profiles: Collection of dedicated host - profiles. - :attr int total_count: The total number of resources across all pages. + :attr datetime created_at: The date and time that this security group was + created. + :attr str crn: The security group's CRN. + :attr str href: The security group's canonical URL. + :attr str id: The unique identifier for this security group. + :attr str name: The name of the default security group created for a VPC. The + name will be a hyphenated list of randomly-selected words at creation, but may + be user-specified with a subsequent request. + :attr ResourceGroupReference resource_group: The resource group for this + security group. + :attr List[SecurityGroupRule] rules: The rules for the default security group + for a VPC. Defaults to allowing all outbound traffic, and allowing all inbound + traffic from other interfaces in the VPC's default security group. Rules for the + default security group may be changed, added or removed. + :attr List[SecurityGroupTargetReference] targets: The targets for this security + group. + :attr VPCReference vpc: The VPC this security group is a part of. """ def __init__(self, - first: 'DedicatedHostProfileCollectionFirst', - limit: int, - profiles: List['DedicatedHostProfile'], - total_count: int, - *, - next: 'DedicatedHostProfileCollectionNext' = None) -> None: + created_at: datetime, + crn: str, + href: str, + id: str, + name: str, + resource_group: 'ResourceGroupReference', + rules: List['SecurityGroupRule'], + targets: List['SecurityGroupTargetReference'], + vpc: 'VPCReference') -> None: """ - Initialize a DedicatedHostProfileCollection object. + Initialize a DefaultSecurityGroup object. - :param DedicatedHostProfileCollectionFirst first: A link to the first page - of resources. - :param int limit: The maximum number of resources that can be returned by - the request. - :param List[DedicatedHostProfile] profiles: Collection of dedicated host - profiles. - :param int total_count: The total number of resources across all pages. - :param DedicatedHostProfileCollectionNext next: (optional) A link to the - next page of resources. This property is present for all pages - except the last page. + :param datetime created_at: The date and time that this security group was + created. + :param str crn: The security group's CRN. + :param str href: The security group's canonical URL. + :param str id: The unique identifier for this security group. + :param str name: The name of the default security group created for a VPC. + The name will be a hyphenated list of randomly-selected words at creation, + but may be user-specified with a subsequent request. + :param ResourceGroupReference resource_group: The resource group for this + security group. + :param List[SecurityGroupRule] rules: The rules for the default security + group for a VPC. Defaults to allowing all outbound traffic, and allowing + all inbound traffic from other interfaces in the VPC's default security + group. Rules for the default security group may be changed, added or + removed. + :param List[SecurityGroupTargetReference] targets: The targets for this + security group. + :param VPCReference vpc: The VPC this security group is a part of. """ - self.first = first - self.limit = limit - self.next = next - self.profiles = profiles - self.total_count = total_count + self.created_at = created_at + self.crn = crn + self.href = href + self.id = id + self.name = name + self.resource_group = resource_group + self.rules = rules + self.targets = targets + self.vpc = vpc @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostProfileCollection': - """Initialize a DedicatedHostProfileCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'DefaultSecurityGroup': + """Initialize a DefaultSecurityGroup object from a json dictionary.""" args = {} - if 'first' in _dict: - args['first'] = DedicatedHostProfileCollectionFirst.from_dict(_dict.get('first')) + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError('Required property \'first\' not present in DedicatedHostProfileCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') + raise ValueError('Required property \'created_at\' not present in DefaultSecurityGroup JSON') + if 'crn' in _dict: + args['crn'] = _dict.get('crn') else: - raise ValueError('Required property \'limit\' not present in DedicatedHostProfileCollection JSON') - if 'next' in _dict: - args['next'] = DedicatedHostProfileCollectionNext.from_dict(_dict.get('next')) - if 'profiles' in _dict: - args['profiles'] = [DedicatedHostProfile.from_dict(x) for x in _dict.get('profiles')] + raise ValueError('Required property \'crn\' not present in DefaultSecurityGroup JSON') + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'profiles\' not present in DedicatedHostProfileCollection JSON') - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') + raise ValueError('Required property \'href\' not present in DefaultSecurityGroup JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') else: - raise ValueError('Required property \'total_count\' not present in DedicatedHostProfileCollection JSON') + raise ValueError('Required property \'id\' not present in DefaultSecurityGroup JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in DefaultSecurityGroup JSON') + if 'resource_group' in _dict: + args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) + else: + raise ValueError('Required property \'resource_group\' not present in DefaultSecurityGroup JSON') + if 'rules' in _dict: + args['rules'] = [SecurityGroupRule.from_dict(x) for x in _dict.get('rules')] + else: + raise ValueError('Required property \'rules\' not present in DefaultSecurityGroup JSON') + if 'targets' in _dict: + args['targets'] = _dict.get('targets') + else: + raise ValueError('Required property \'targets\' not present in DefaultSecurityGroup JSON') + if 'vpc' in _dict: + args['vpc'] = VPCReference.from_dict(_dict.get('vpc')) + else: + raise ValueError('Required property \'vpc\' not present in DefaultSecurityGroup JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DedicatedHostProfileCollection object from a json dictionary.""" + """Initialize a DefaultSecurityGroup object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'profiles') and self.profiles is not None: - _dict['profiles'] = [x.to_dict() for x in self.profiles] - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'resource_group') and self.resource_group is not None: + _dict['resource_group'] = self.resource_group.to_dict() + if hasattr(self, 'rules') and self.rules is not None: + _dict['rules'] = [x.to_dict() for x in self.rules] + if hasattr(self, 'targets') and self.targets is not None: + targets_list = [] + for x in self.targets: + if isinstance(x, dict): + targets_list.append(x) + else: + targets_list.append(x.to_dict()) + _dict['targets'] = targets_list + if hasattr(self, 'vpc') and self.vpc is not None: + _dict['vpc'] = self.vpc.to_dict() return _dict def _to_dict(self): @@ -22522,55 +26911,78 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DedicatedHostProfileCollection object.""" + """Return a `str` version of this DefaultSecurityGroup object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHostProfileCollection') -> bool: + def __eq__(self, other: 'DefaultSecurityGroup') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DedicatedHostProfileCollection') -> bool: + def __ne__(self, other: 'DefaultSecurityGroup') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class DedicatedHostProfileCollectionFirst(): +class EncryptionKeyIdentity(): """ - A link to the first page of resources. + Identifies an encryption key by a unique property. - :attr str href: The URL for a page of resources. + """ + + def __init__(self) -> None: + """ + Initialize a EncryptionKeyIdentity object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['EncryptionKeyIdentityByCRN'])) + raise Exception(msg) + +class EncryptionKeyReference(): + """ + EncryptionKeyReference. + + :attr str crn: The CRN of the [Key Protect Root + Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) + or [Hyper Protect Crypto Services Root + Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this + resource. """ def __init__(self, - href: str) -> None: + crn: str) -> None: """ - Initialize a DedicatedHostProfileCollectionFirst object. + Initialize a EncryptionKeyReference object. - :param str href: The URL for a page of resources. + :param str crn: The CRN of the [Key Protect Root + Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) + or [Hyper Protect Crypto Services Root + Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for + this resource. """ - self.href = href + self.crn = crn @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostProfileCollectionFirst': - """Initialize a DedicatedHostProfileCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'EncryptionKeyReference': + """Initialize a EncryptionKeyReference object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') + if 'crn' in _dict: + args['crn'] = _dict.get('crn') else: - raise ValueError('Required property \'href\' not present in DedicatedHostProfileCollectionFirst JSON') + raise ValueError('Required property \'crn\' not present in EncryptionKeyReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DedicatedHostProfileCollectionFirst object from a json dictionary.""" + """Initialize a EncryptionKeyReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn return _dict def _to_dict(self): @@ -22578,56 +26990,226 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DedicatedHostProfileCollectionFirst object.""" + """Return a `str` version of this EncryptionKeyReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHostProfileCollectionFirst') -> bool: + def __eq__(self, other: 'EncryptionKeyReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DedicatedHostProfileCollectionFirst') -> bool: + def __ne__(self, other: 'EncryptionKeyReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class DedicatedHostProfileCollectionNext(): +class EndpointGateway(): """ - A link to the next page of resources. This property is present for all pages except - the last page. + EndpointGateway. - :attr str href: The URL for a page of resources. + :attr datetime created_at: The date and time that the endpoint gateway was + created. + :attr str crn: The CRN for this endpoint gateway. + :attr str health_state: The health of this resource. + - `ok`: No abnormal behavior detected + - `degraded`: Experiencing compromised performance, capacity, or connectivity + - `faulted`: Completely unreachable, inoperative, or otherwise entirely + incapacitated + - `inapplicable`: The health state does not apply because of the current + lifecycle state. A resource with a lifecycle state of `failed` or `deleting` + will have a health state of `inapplicable`. A `pending` resource may also have + this state. + :attr str href: The URL for this endpoint gateway. + :attr str id: The unique identifier for this endpoint gateway. + :attr List[ReservedIPReference] ips: The reserved IPs bound to this endpoint + gateway. + :attr str lifecycle_state: The lifecycle state of the endpoint gateway. + :attr str name: The unique user-defined name for this endpoint gateway. + :attr ResourceGroupReference resource_group: The resource group for this + endpoint gateway. + :attr str resource_type: The resource type. + :attr List[SecurityGroupReference] security_groups: The security groups + targeting this endpoint gateway. + :attr str service_endpoint: (optional) The fully qualified domain name for the + target service. + :attr List[str] service_endpoints: The fully qualified domain names for the + target service. + :attr EndpointGatewayTarget target: The target for this endpoint gateway. + :attr VPCReference vpc: The VPC this endpoint gateway is serving. """ def __init__(self, - href: str) -> None: + created_at: datetime, + crn: str, + health_state: str, + href: str, + id: str, + ips: List['ReservedIPReference'], + lifecycle_state: str, + name: str, + resource_group: 'ResourceGroupReference', + resource_type: str, + security_groups: List['SecurityGroupReference'], + service_endpoints: List[str], + target: 'EndpointGatewayTarget', + vpc: 'VPCReference', + *, + service_endpoint: str = None) -> None: """ - Initialize a DedicatedHostProfileCollectionNext object. + Initialize a EndpointGateway object. - :param str href: The URL for a page of resources. + :param datetime created_at: The date and time that the endpoint gateway was + created. + :param str crn: The CRN for this endpoint gateway. + :param str health_state: The health of this resource. + - `ok`: No abnormal behavior detected + - `degraded`: Experiencing compromised performance, capacity, or + connectivity + - `faulted`: Completely unreachable, inoperative, or otherwise entirely + incapacitated + - `inapplicable`: The health state does not apply because of the current + lifecycle state. A resource with a lifecycle state of `failed` or + `deleting` will have a health state of `inapplicable`. A `pending` resource + may also have this state. + :param str href: The URL for this endpoint gateway. + :param str id: The unique identifier for this endpoint gateway. + :param List[ReservedIPReference] ips: The reserved IPs bound to this + endpoint gateway. + :param str lifecycle_state: The lifecycle state of the endpoint gateway. + :param str name: The unique user-defined name for this endpoint gateway. + :param ResourceGroupReference resource_group: The resource group for this + endpoint gateway. + :param str resource_type: The resource type. + :param List[SecurityGroupReference] security_groups: The security groups + targeting this endpoint gateway. + :param List[str] service_endpoints: The fully qualified domain names for + the target service. + :param EndpointGatewayTarget target: The target for this endpoint gateway. + :param VPCReference vpc: The VPC this endpoint gateway is serving. + :param str service_endpoint: (optional) The fully qualified domain name for + the target service. """ + self.created_at = created_at + self.crn = crn + self.health_state = health_state self.href = href + self.id = id + self.ips = ips + self.lifecycle_state = lifecycle_state + self.name = name + self.resource_group = resource_group + self.resource_type = resource_type + self.security_groups = security_groups + self.service_endpoint = service_endpoint + self.service_endpoints = service_endpoints + self.target = target + self.vpc = vpc @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostProfileCollectionNext': - """Initialize a DedicatedHostProfileCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'EndpointGateway': + """Initialize a EndpointGateway object from a json dictionary.""" args = {} + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) + else: + raise ValueError('Required property \'created_at\' not present in EndpointGateway JSON') + if 'crn' in _dict: + args['crn'] = _dict.get('crn') + else: + raise ValueError('Required property \'crn\' not present in EndpointGateway JSON') + if 'health_state' in _dict: + args['health_state'] = _dict.get('health_state') + else: + raise ValueError('Required property \'health_state\' not present in EndpointGateway JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in DedicatedHostProfileCollectionNext JSON') + raise ValueError('Required property \'href\' not present in EndpointGateway JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in EndpointGateway JSON') + if 'ips' in _dict: + args['ips'] = [ReservedIPReference.from_dict(x) for x in _dict.get('ips')] + else: + raise ValueError('Required property \'ips\' not present in EndpointGateway JSON') + if 'lifecycle_state' in _dict: + args['lifecycle_state'] = _dict.get('lifecycle_state') + else: + raise ValueError('Required property \'lifecycle_state\' not present in EndpointGateway JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in EndpointGateway JSON') + if 'resource_group' in _dict: + args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) + else: + raise ValueError('Required property \'resource_group\' not present in EndpointGateway JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in EndpointGateway JSON') + if 'security_groups' in _dict: + args['security_groups'] = [SecurityGroupReference.from_dict(x) for x in _dict.get('security_groups')] + else: + raise ValueError('Required property \'security_groups\' not present in EndpointGateway JSON') + if 'service_endpoint' in _dict: + args['service_endpoint'] = _dict.get('service_endpoint') + if 'service_endpoints' in _dict: + args['service_endpoints'] = _dict.get('service_endpoints') + else: + raise ValueError('Required property \'service_endpoints\' not present in EndpointGateway JSON') + if 'target' in _dict: + args['target'] = _dict.get('target') + else: + raise ValueError('Required property \'target\' not present in EndpointGateway JSON') + if 'vpc' in _dict: + args['vpc'] = VPCReference.from_dict(_dict.get('vpc')) + else: + raise ValueError('Required property \'vpc\' not present in EndpointGateway JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DedicatedHostProfileCollectionNext object from a json dictionary.""" + """Initialize a EndpointGateway object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'health_state') and self.health_state is not None: + _dict['health_state'] = self.health_state if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'ips') and self.ips is not None: + _dict['ips'] = [x.to_dict() for x in self.ips] + if hasattr(self, 'lifecycle_state') and self.lifecycle_state is not None: + _dict['lifecycle_state'] = self.lifecycle_state + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'resource_group') and self.resource_group is not None: + _dict['resource_group'] = self.resource_group.to_dict() + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + if hasattr(self, 'security_groups') and self.security_groups is not None: + _dict['security_groups'] = [x.to_dict() for x in self.security_groups] + if hasattr(self, 'service_endpoint') and self.service_endpoint is not None: + _dict['service_endpoint'] = self.service_endpoint + if hasattr(self, 'service_endpoints') and self.service_endpoints is not None: + _dict['service_endpoints'] = self.service_endpoints + if hasattr(self, 'target') and self.target is not None: + if isinstance(self.target, dict): + _dict['target'] = self.target + else: + _dict['target'] = self.target.to_dict() + if hasattr(self, 'vpc') and self.vpc is not None: + _dict['vpc'] = self.vpc.to_dict() return _dict def _to_dict(self): @@ -22635,166 +27217,140 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DedicatedHostProfileCollectionNext object.""" + """Return a `str` version of this EndpointGateway object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHostProfileCollectionNext') -> bool: + def __eq__(self, other: 'EndpointGateway') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DedicatedHostProfileCollectionNext') -> bool: + def __ne__(self, other: 'EndpointGateway') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class DedicatedHostProfileDisk(): - """ - Disks provided by this profile. - - :attr DedicatedHostProfileDiskInterface interface_type: - :attr DedicatedHostProfileDiskQuantity quantity: The number of disks of this - type for a dedicated host with this profile. - :attr DedicatedHostProfileDiskSize size: The size of the disk in GB (gigabytes). - :attr DedicatedHostProfileDiskSupportedInterfaces - supported_instance_interface_types: - """ - - def __init__(self, - interface_type: 'DedicatedHostProfileDiskInterface', - quantity: 'DedicatedHostProfileDiskQuantity', - size: 'DedicatedHostProfileDiskSize', - supported_instance_interface_types: 'DedicatedHostProfileDiskSupportedInterfaces') -> None: + class HealthStateEnum(str, Enum): """ - Initialize a DedicatedHostProfileDisk object. - - :param DedicatedHostProfileDiskInterface interface_type: - :param DedicatedHostProfileDiskQuantity quantity: The number of disks of - this type for a dedicated host with this profile. - :param DedicatedHostProfileDiskSize size: The size of the disk in GB - (gigabytes). - :param DedicatedHostProfileDiskSupportedInterfaces - supported_instance_interface_types: + The health of this resource. + - `ok`: No abnormal behavior detected + - `degraded`: Experiencing compromised performance, capacity, or connectivity + - `faulted`: Completely unreachable, inoperative, or otherwise entirely + incapacitated + - `inapplicable`: The health state does not apply because of the current lifecycle + state. A resource with a lifecycle state of `failed` or `deleting` will have a + health state of `inapplicable`. A `pending` resource may also have this state. """ - self.interface_type = interface_type - self.quantity = quantity - self.size = size - self.supported_instance_interface_types = supported_instance_interface_types - - @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostProfileDisk': - """Initialize a DedicatedHostProfileDisk object from a json dictionary.""" - args = {} - if 'interface_type' in _dict: - args['interface_type'] = DedicatedHostProfileDiskInterface.from_dict(_dict.get('interface_type')) - else: - raise ValueError('Required property \'interface_type\' not present in DedicatedHostProfileDisk JSON') - if 'quantity' in _dict: - args['quantity'] = DedicatedHostProfileDiskQuantity.from_dict(_dict.get('quantity')) - else: - raise ValueError('Required property \'quantity\' not present in DedicatedHostProfileDisk JSON') - if 'size' in _dict: - args['size'] = DedicatedHostProfileDiskSize.from_dict(_dict.get('size')) - else: - raise ValueError('Required property \'size\' not present in DedicatedHostProfileDisk JSON') - if 'supported_instance_interface_types' in _dict: - args['supported_instance_interface_types'] = DedicatedHostProfileDiskSupportedInterfaces.from_dict(_dict.get('supported_instance_interface_types')) - else: - raise ValueError('Required property \'supported_instance_interface_types\' not present in DedicatedHostProfileDisk JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a DedicatedHostProfileDisk object from a json dictionary.""" - return cls.from_dict(_dict) + DEGRADED = 'degraded' + FAULTED = 'faulted' + INAPPLICABLE = 'inapplicable' + OK = 'ok' - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'interface_type') and self.interface_type is not None: - _dict['interface_type'] = self.interface_type.to_dict() - if hasattr(self, 'quantity') and self.quantity is not None: - _dict['quantity'] = self.quantity.to_dict() - if hasattr(self, 'size') and self.size is not None: - _dict['size'] = self.size.to_dict() - if hasattr(self, 'supported_instance_interface_types') and self.supported_instance_interface_types is not None: - _dict['supported_instance_interface_types'] = self.supported_instance_interface_types.to_dict() - return _dict - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() + class LifecycleStateEnum(str, Enum): + """ + The lifecycle state of the endpoint gateway. + """ + DELETING = 'deleting' + FAILED = 'failed' + PENDING = 'pending' + STABLE = 'stable' + SUSPENDED = 'suspended' + UPDATING = 'updating' + WAITING = 'waiting' - def __str__(self) -> str: - """Return a `str` version of this DedicatedHostProfileDisk object.""" - return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHostProfileDisk') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + ENDPOINT_GATEWAY = 'endpoint_gateway' - def __ne__(self, other: 'DedicatedHostProfileDisk') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other -class DedicatedHostProfileDiskInterface(): +class EndpointGatewayCollection(): """ - DedicatedHostProfileDiskInterface. + EndpointGatewayCollection. - :attr str type: The type for this profile field. - :attr str value: The interface of the disk for a dedicated host with this - profile - The enumerated values for this property are expected to expand in the future. - When processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the resource on which the unexpected - property value was encountered. + :attr List[EndpointGateway] endpoint_gateways: Collection of endpoint gateways. + :attr EndpointGatewayCollectionFirst first: A link to the first page of + resources. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr EndpointGatewayCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages + except the last page. + :attr int total_count: The total number of resources across all pages. """ def __init__(self, - type: str, - value: str) -> None: + endpoint_gateways: List['EndpointGateway'], + first: 'EndpointGatewayCollectionFirst', + limit: int, + total_count: int, + *, + next: 'EndpointGatewayCollectionNext' = None) -> None: """ - Initialize a DedicatedHostProfileDiskInterface object. + Initialize a EndpointGatewayCollection object. - :param str type: The type for this profile field. - :param str value: The interface of the disk for a dedicated host with this - profile - The enumerated values for this property are expected to expand in the - future. When processing this property, check for and log unknown values. - Optionally halt processing and surface the error, or bypass the resource on - which the unexpected property value was encountered. + :param List[EndpointGateway] endpoint_gateways: Collection of endpoint + gateways. + :param EndpointGatewayCollectionFirst first: A link to the first page of + resources. + :param int limit: The maximum number of resources that can be returned by + the request. + :param int total_count: The total number of resources across all pages. + :param EndpointGatewayCollectionNext next: (optional) A link to the next + page of resources. This property is present for all pages + except the last page. """ - self.type = type - self.value = value + self.endpoint_gateways = endpoint_gateways + self.first = first + self.limit = limit + self.next = next + self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostProfileDiskInterface': - """Initialize a DedicatedHostProfileDiskInterface object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'EndpointGatewayCollection': + """Initialize a EndpointGatewayCollection object from a json dictionary.""" args = {} - if 'type' in _dict: - args['type'] = _dict.get('type') + if 'endpoint_gateways' in _dict: + args['endpoint_gateways'] = [EndpointGateway.from_dict(x) for x in _dict.get('endpoint_gateways')] else: - raise ValueError('Required property \'type\' not present in DedicatedHostProfileDiskInterface JSON') - if 'value' in _dict: - args['value'] = _dict.get('value') + raise ValueError('Required property \'endpoint_gateways\' not present in EndpointGatewayCollection JSON') + if 'first' in _dict: + args['first'] = EndpointGatewayCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'value\' not present in DedicatedHostProfileDiskInterface JSON') + raise ValueError('Required property \'first\' not present in EndpointGatewayCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') + else: + raise ValueError('Required property \'limit\' not present in EndpointGatewayCollection JSON') + if 'next' in _dict: + args['next'] = EndpointGatewayCollectionNext.from_dict(_dict.get('next')) + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') + else: + raise ValueError('Required property \'total_count\' not present in EndpointGatewayCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DedicatedHostProfileDiskInterface object from a json dictionary.""" + """Initialize a EndpointGatewayCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type - if hasattr(self, 'value') and self.value is not None: - _dict['value'] = self.value + if hasattr(self, 'endpoint_gateways') and self.endpoint_gateways is not None: + _dict['endpoint_gateways'] = [x.to_dict() for x in self.endpoint_gateways] + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count return _dict def _to_dict(self): @@ -22802,83 +27358,55 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DedicatedHostProfileDiskInterface object.""" + """Return a `str` version of this EndpointGatewayCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHostProfileDiskInterface') -> bool: + def __eq__(self, other: 'EndpointGatewayCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DedicatedHostProfileDiskInterface') -> bool: + def __ne__(self, other: 'EndpointGatewayCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class TypeEnum(str, Enum): - """ - The type for this profile field. - """ - FIXED = 'fixed' - - - class ValueEnum(str, Enum): - """ - The interface of the disk for a dedicated host with this profile - The enumerated values for this property are expected to expand in the future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the resource on which the unexpected - property value was encountered. - """ - NVME = 'nvme' - - -class DedicatedHostProfileDiskQuantity(): +class EndpointGatewayCollectionFirst(): """ - The number of disks of this type for a dedicated host with this profile. + A link to the first page of resources. - :attr str type: The type for this profile field. - :attr int value: The value for this profile field. + :attr str href: The URL for a page of resources. """ def __init__(self, - type: str, - value: int) -> None: + href: str) -> None: """ - Initialize a DedicatedHostProfileDiskQuantity object. + Initialize a EndpointGatewayCollectionFirst object. - :param str type: The type for this profile field. - :param int value: The value for this profile field. + :param str href: The URL for a page of resources. """ - self.type = type - self.value = value + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostProfileDiskQuantity': - """Initialize a DedicatedHostProfileDiskQuantity object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'EndpointGatewayCollectionFirst': + """Initialize a EndpointGatewayCollectionFirst object from a json dictionary.""" args = {} - if 'type' in _dict: - args['type'] = _dict.get('type') - else: - raise ValueError('Required property \'type\' not present in DedicatedHostProfileDiskQuantity JSON') - if 'value' in _dict: - args['value'] = _dict.get('value') + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'value\' not present in DedicatedHostProfileDiskQuantity JSON') + raise ValueError('Required property \'href\' not present in EndpointGatewayCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DedicatedHostProfileDiskQuantity object from a json dictionary.""" + """Initialize a EndpointGatewayCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type - if hasattr(self, 'value') and self.value is not None: - _dict['value'] = self.value + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -22886,72 +27414,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DedicatedHostProfileDiskQuantity object.""" + """Return a `str` version of this EndpointGatewayCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHostProfileDiskQuantity') -> bool: + def __eq__(self, other: 'EndpointGatewayCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DedicatedHostProfileDiskQuantity') -> bool: + def __ne__(self, other: 'EndpointGatewayCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class TypeEnum(str, Enum): - """ - The type for this profile field. - """ - FIXED = 'fixed' - - -class DedicatedHostProfileDiskSize(): +class EndpointGatewayCollectionNext(): """ - The size of the disk in GB (gigabytes). + A link to the next page of resources. This property is present for all pages except + the last page. - :attr str type: The type for this profile field. - :attr int value: The size of the disk in GB (gigabytes). + :attr str href: The URL for a page of resources. """ def __init__(self, - type: str, - value: int) -> None: + href: str) -> None: """ - Initialize a DedicatedHostProfileDiskSize object. + Initialize a EndpointGatewayCollectionNext object. - :param str type: The type for this profile field. - :param int value: The size of the disk in GB (gigabytes). + :param str href: The URL for a page of resources. """ - self.type = type - self.value = value + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostProfileDiskSize': - """Initialize a DedicatedHostProfileDiskSize object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'EndpointGatewayCollectionNext': + """Initialize a EndpointGatewayCollectionNext object from a json dictionary.""" args = {} - if 'type' in _dict: - args['type'] = _dict.get('type') - else: - raise ValueError('Required property \'type\' not present in DedicatedHostProfileDiskSize JSON') - if 'value' in _dict: - args['value'] = _dict.get('value') + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'value\' not present in DedicatedHostProfileDiskSize JSON') + raise ValueError('Required property \'href\' not present in EndpointGatewayCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DedicatedHostProfileDiskSize object from a json dictionary.""" + """Initialize a EndpointGatewayCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type - if hasattr(self, 'value') and self.value is not None: - _dict['value'] = self.value + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -22959,74 +27471,57 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DedicatedHostProfileDiskSize object.""" + """Return a `str` version of this EndpointGatewayCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHostProfileDiskSize') -> bool: + def __eq__(self, other: 'EndpointGatewayCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DedicatedHostProfileDiskSize') -> bool: + def __ne__(self, other: 'EndpointGatewayCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class TypeEnum(str, Enum): - """ - The type for this profile field. - """ - FIXED = 'fixed' - - -class DedicatedHostProfileDiskSupportedInterfaces(): +class EndpointGatewayPatch(): """ - DedicatedHostProfileDiskSupportedInterfaces. + EndpointGatewayPatch. - :attr str type: The type for this profile field. - :attr List[str] value: The instance disk interfaces supported for a dedicated - host with this profile. + :attr str name: (optional) The user-defined name for this endpoint gateway. + Names must be unique within the VPC this endpoint gateway is serving. """ def __init__(self, - type: str, - value: List[str]) -> None: + *, + name: str = None) -> None: """ - Initialize a DedicatedHostProfileDiskSupportedInterfaces object. + Initialize a EndpointGatewayPatch object. - :param str type: The type for this profile field. - :param List[str] value: The instance disk interfaces supported for a - dedicated host with this profile. + :param str name: (optional) The user-defined name for this endpoint + gateway. Names must be unique within the VPC this endpoint gateway is + serving. """ - self.type = type - self.value = value + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostProfileDiskSupportedInterfaces': - """Initialize a DedicatedHostProfileDiskSupportedInterfaces object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'EndpointGatewayPatch': + """Initialize a EndpointGatewayPatch object from a json dictionary.""" args = {} - if 'type' in _dict: - args['type'] = _dict.get('type') - else: - raise ValueError('Required property \'type\' not present in DedicatedHostProfileDiskSupportedInterfaces JSON') - if 'value' in _dict: - args['value'] = _dict.get('value') - else: - raise ValueError('Required property \'value\' not present in DedicatedHostProfileDiskSupportedInterfaces JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DedicatedHostProfileDiskSupportedInterfaces object from a json dictionary.""" + """Initialize a EndpointGatewayPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type - if hasattr(self, 'value') and self.value is not None: - _dict['value'] = self.value + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -23034,114 +27529,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DedicatedHostProfileDiskSupportedInterfaces object.""" + """Return a `str` version of this EndpointGatewayPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHostProfileDiskSupportedInterfaces') -> bool: + def __eq__(self, other: 'EndpointGatewayPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DedicatedHostProfileDiskSupportedInterfaces') -> bool: + def __ne__(self, other: 'EndpointGatewayPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class TypeEnum(str, Enum): - """ - The type for this profile field. - """ - FIXED = 'fixed' - - - class ValueEnum(str, Enum): - """ - The disk interface used for attaching the disk. - The enumerated values for this property are expected to expand in the future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the resource on which the unexpected - property value was encountered. - """ - NVME = 'nvme' - VIRTIO_BLK = 'virtio_blk' - - -class DedicatedHostProfileIdentity(): - """ - Identifies a dedicated host profile by a unique property. - - """ - - def __init__(self) -> None: - """ - Initialize a DedicatedHostProfileIdentity object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['DedicatedHostProfileIdentityByName', 'DedicatedHostProfileIdentityByHref'])) - raise Exception(msg) - -class DedicatedHostProfileMemory(): - """ - DedicatedHostProfileMemory. - - """ - - def __init__(self) -> None: - """ - Initialize a DedicatedHostProfileMemory object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['DedicatedHostProfileMemoryFixed', 'DedicatedHostProfileMemoryRange', 'DedicatedHostProfileMemoryEnum', 'DedicatedHostProfileMemoryDependent'])) - raise Exception(msg) - -class DedicatedHostProfileReference(): +class EndpointGatewayReferenceDeleted(): """ - DedicatedHostProfileReference. + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. - :attr str href: The URL for this dedicated host. - :attr str name: The globally unique name for this dedicated host profile. + :attr str more_info: Link to documentation about deleted resources. """ def __init__(self, - href: str, - name: str) -> None: + more_info: str) -> None: """ - Initialize a DedicatedHostProfileReference object. + Initialize a EndpointGatewayReferenceDeleted object. - :param str href: The URL for this dedicated host. - :param str name: The globally unique name for this dedicated host profile. - """ - self.href = href - self.name = name + :param str more_info: Link to documentation about deleted resources. + """ + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostProfileReference': - """Initialize a DedicatedHostProfileReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'EndpointGatewayReferenceDeleted': + """Initialize a EndpointGatewayReferenceDeleted object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in DedicatedHostProfileReference JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'name\' not present in DedicatedHostProfileReference JSON') + raise ValueError('Required property \'more_info\' not present in EndpointGatewayReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DedicatedHostProfileReference object from a json dictionary.""" + """Initialize a EndpointGatewayReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -23149,252 +27586,242 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DedicatedHostProfileReference object.""" + """Return a `str` version of this EndpointGatewayReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHostProfileReference') -> bool: + def __eq__(self, other: 'EndpointGatewayReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DedicatedHostProfileReference') -> bool: + def __ne__(self, other: 'EndpointGatewayReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class DedicatedHostProfileSocket(): +class EndpointGatewayReservedIP(): """ - DedicatedHostProfileSocket. + A reserved IP to bind to the endpoint gateway. This can be specified using an existing + reserved IP, or a prototype object for a new reserved IP. The reserved IP will be + bound to the endpoint gateway to function as a virtual private endpoint for the + service. """ def __init__(self) -> None: """ - Initialize a DedicatedHostProfileSocket object. + Initialize a EndpointGatewayReservedIP object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['DedicatedHostProfileSocketFixed', 'DedicatedHostProfileSocketRange', 'DedicatedHostProfileSocketEnum', 'DedicatedHostProfileSocketDependent'])) + ", ".join(['EndpointGatewayReservedIPReservedIPIdentity', 'EndpointGatewayReservedIPReservedIPPrototypeTargetContext'])) raise Exception(msg) -class DedicatedHostProfileVCPU(): +class EndpointGatewayTarget(): """ - DedicatedHostProfileVCPU. + The target for this endpoint gateway. """ def __init__(self) -> None: """ - Initialize a DedicatedHostProfileVCPU object. + Initialize a EndpointGatewayTarget object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['DedicatedHostProfileVCPUFixed', 'DedicatedHostProfileVCPURange', 'DedicatedHostProfileVCPUEnum', 'DedicatedHostProfileVCPUDependent'])) + ", ".join(['EndpointGatewayTargetProviderCloudServiceReference', 'EndpointGatewayTargetProviderInfrastructureServiceReference'])) raise Exception(msg) -class DedicatedHostProfileVCPUArchitecture(): +class EndpointGatewayTargetPrototype(): """ - DedicatedHostProfileVCPUArchitecture. + The target for this endpoint gateway. - :attr str type: The type for this profile field. - :attr str value: The VCPU architecture for a dedicated host with this profile. + :attr str resource_type: The type of target for this endpoint gateway. """ def __init__(self, - type: str, - value: str) -> None: + resource_type: str) -> None: """ - Initialize a DedicatedHostProfileVCPUArchitecture object. + Initialize a EndpointGatewayTargetPrototype object. - :param str type: The type for this profile field. - :param str value: The VCPU architecture for a dedicated host with this - profile. + :param str resource_type: The type of target for this endpoint gateway. """ - self.type = type - self.value = value + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['EndpointGatewayTargetPrototypeProviderCloudServiceIdentity', 'EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity'])) + raise Exception(msg) @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostProfileVCPUArchitecture': - """Initialize a DedicatedHostProfileVCPUArchitecture object from a json dictionary.""" - args = {} - if 'type' in _dict: - args['type'] = _dict.get('type') - else: - raise ValueError('Required property \'type\' not present in DedicatedHostProfileVCPUArchitecture JSON') - if 'value' in _dict: - args['value'] = _dict.get('value') - else: - raise ValueError('Required property \'value\' not present in DedicatedHostProfileVCPUArchitecture JSON') - return cls(**args) + def from_dict(cls, _dict: Dict) -> 'EndpointGatewayTargetPrototype': + """Initialize a EndpointGatewayTargetPrototype object from a json dictionary.""" + disc_class = cls._get_class_by_discriminator(_dict) + if disc_class != cls: + return disc_class.from_dict(_dict) + msg = ("Cannot convert dictionary into an instance of base class 'EndpointGatewayTargetPrototype'. " + + "The discriminator value should map to a valid subclass: {1}").format( + ", ".join(['EndpointGatewayTargetPrototypeProviderCloudServiceIdentity', 'EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity'])) + raise Exception(msg) @classmethod - def _from_dict(cls, _dict): - """Initialize a DedicatedHostProfileVCPUArchitecture object from a json dictionary.""" + def _from_dict(cls, _dict: Dict): + """Initialize a EndpointGatewayTargetPrototype object from a json dictionary.""" return cls.from_dict(_dict) - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type - if hasattr(self, 'value') and self.value is not None: - _dict['value'] = self.value - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this DedicatedHostProfileVCPUArchitecture object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'DedicatedHostProfileVCPUArchitecture') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'DedicatedHostProfileVCPUArchitecture') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other + @classmethod + def _get_class_by_discriminator(cls, _dict: Dict) -> object: + mapping = {} + mapping['provider_cloud_service'] = 'EndpointGatewayTargetPrototypeProviderCloudServiceIdentity' + mapping['provider_infrastructure_service'] = 'EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity' + disc_value = _dict.get('resource_type') + if disc_value is None: + raise ValueError('Discriminator property \'resource_type\' not found in EndpointGatewayTargetPrototype JSON') + class_name = mapping.get(disc_value, disc_value) + try: + disc_class = getattr(sys.modules[__name__], class_name) + except AttributeError: + disc_class = cls + if isinstance(disc_class, object): + return disc_class + raise TypeError('%s is not a discriminator class' % class_name) - class TypeEnum(str, Enum): - """ - The type for this profile field. + class ResourceTypeEnum(str, Enum): """ - FIXED = 'fixed' - - -class DedicatedHostPrototype(): - """ - DedicatedHostPrototype. - - :attr bool instance_placement_enabled: (optional) If set to true, instances can - be placed on this dedicated host. - :attr str name: (optional) The unique user-defined name for this dedicated host. - If unspecified, the name will be a hyphenated list of randomly-selected words. - :attr DedicatedHostProfileIdentity profile: The profile to use for this - dedicated host. - :attr ResourceGroupIdentity resource_group: (optional) The resource group to - use. If unspecified, the account's [default resource - group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - """ - - def __init__(self, - profile: 'DedicatedHostProfileIdentity', - *, - instance_placement_enabled: bool = None, - name: str = None, - resource_group: 'ResourceGroupIdentity' = None) -> None: + The type of target for this endpoint gateway. """ - Initialize a DedicatedHostPrototype object. + PROVIDER_CLOUD_SERVICE = 'provider_cloud_service' + PROVIDER_INFRASTRUCTURE_SERVICE = 'provider_infrastructure_service' - :param DedicatedHostProfileIdentity profile: The profile to use for this - dedicated host. - :param bool instance_placement_enabled: (optional) If set to true, - instances can be placed on this dedicated host. - :param str name: (optional) The unique user-defined name for this dedicated - host. If unspecified, the name will be a hyphenated list of - randomly-selected words. - :param ResourceGroupIdentity resource_group: (optional) The resource group - to use. If unspecified, the account's [default resource - group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is - used. - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['DedicatedHostPrototypeDedicatedHostByGroup', 'DedicatedHostPrototypeDedicatedHostByZone'])) - raise Exception(msg) -class DedicatedHostReference(): +class FloatingIP(): """ - DedicatedHostReference. + FloatingIP. - :attr str crn: The CRN for this dedicated host. - :attr DedicatedHostReferenceDeleted deleted: (optional) If present, this - property indicates the referenced resource has been deleted and provides - some supplementary information. - :attr str href: The URL for this dedicated host. - :attr str id: The unique identifier for this dedicated host. - :attr str name: The unique user-defined name for this dedicated host. - :attr str resource_type: The resource type. + :attr str address: The globally unique IP address. + :attr datetime created_at: The date and time that the floating IP was created. + :attr str crn: The CRN for this floating IP. + :attr str href: The URL for this floating IP. + :attr str id: The unique identifier for this floating IP. + :attr str name: The unique user-defined name for this floating IP. + :attr ResourceGroupReference resource_group: The resource group for this + floating IP. + :attr str status: The status of the floating IP. + :attr FloatingIPTarget target: (optional) The target of this floating IP. + :attr ZoneReference zone: The zone this floating IP resides in. """ def __init__(self, + address: str, + created_at: datetime, crn: str, href: str, id: str, name: str, - resource_type: str, + resource_group: 'ResourceGroupReference', + status: str, + zone: 'ZoneReference', *, - deleted: 'DedicatedHostReferenceDeleted' = None) -> None: + target: 'FloatingIPTarget' = None) -> None: """ - Initialize a DedicatedHostReference object. + Initialize a FloatingIP object. - :param str crn: The CRN for this dedicated host. - :param str href: The URL for this dedicated host. - :param str id: The unique identifier for this dedicated host. - :param str name: The unique user-defined name for this dedicated host. - :param str resource_type: The resource type. - :param DedicatedHostReferenceDeleted deleted: (optional) If present, this - property indicates the referenced resource has been deleted and provides - some supplementary information. + :param str address: The globally unique IP address. + :param datetime created_at: The date and time that the floating IP was + created. + :param str crn: The CRN for this floating IP. + :param str href: The URL for this floating IP. + :param str id: The unique identifier for this floating IP. + :param str name: The unique user-defined name for this floating IP. + :param ResourceGroupReference resource_group: The resource group for this + floating IP. + :param str status: The status of the floating IP. + :param ZoneReference zone: The zone this floating IP resides in. + :param FloatingIPTarget target: (optional) The target of this floating IP. """ + self.address = address + self.created_at = created_at self.crn = crn - self.deleted = deleted self.href = href self.id = id self.name = name - self.resource_type = resource_type + self.resource_group = resource_group + self.status = status + self.target = target + self.zone = zone @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostReference': - """Initialize a DedicatedHostReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'FloatingIP': + """Initialize a FloatingIP object from a json dictionary.""" args = {} + if 'address' in _dict: + args['address'] = _dict.get('address') + else: + raise ValueError('Required property \'address\' not present in FloatingIP JSON') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) + else: + raise ValueError('Required property \'created_at\' not present in FloatingIP JSON') if 'crn' in _dict: args['crn'] = _dict.get('crn') else: - raise ValueError('Required property \'crn\' not present in DedicatedHostReference JSON') - if 'deleted' in _dict: - args['deleted'] = DedicatedHostReferenceDeleted.from_dict(_dict.get('deleted')) + raise ValueError('Required property \'crn\' not present in FloatingIP JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in DedicatedHostReference JSON') + raise ValueError('Required property \'href\' not present in FloatingIP JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in DedicatedHostReference JSON') + raise ValueError('Required property \'id\' not present in FloatingIP JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in DedicatedHostReference JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') + raise ValueError('Required property \'name\' not present in FloatingIP JSON') + if 'resource_group' in _dict: + args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) else: - raise ValueError('Required property \'resource_type\' not present in DedicatedHostReference JSON') + raise ValueError('Required property \'resource_group\' not present in FloatingIP JSON') + if 'status' in _dict: + args['status'] = _dict.get('status') + else: + raise ValueError('Required property \'status\' not present in FloatingIP JSON') + if 'target' in _dict: + args['target'] = _dict.get('target') + if 'zone' in _dict: + args['zone'] = ZoneReference.from_dict(_dict.get('zone')) + else: + raise ValueError('Required property \'zone\' not present in FloatingIP JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DedicatedHostReference object from a json dictionary.""" + """Initialize a FloatingIP object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'address') and self.address is not None: + _dict['address'] = self.address + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) if hasattr(self, 'crn') and self.crn is not None: _dict['crn'] = self.crn - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type + if hasattr(self, 'resource_group') and self.resource_group is not None: + _dict['resource_group'] = self.resource_group.to_dict() + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'target') and self.target is not None: + if isinstance(self.target, dict): + _dict['target'] = self.target + else: + _dict['target'] = self.target.to_dict() + if hasattr(self, 'zone') and self.zone is not None: + _dict['zone'] = self.zone.to_dict() return _dict def _to_dict(self): @@ -23402,63 +27829,126 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DedicatedHostReference object.""" + """Return a `str` version of this FloatingIP object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHostReference') -> bool: + def __eq__(self, other: 'FloatingIP') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DedicatedHostReference') -> bool: + def __ne__(self, other: 'FloatingIP') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ResourceTypeEnum(str, Enum): + class StatusEnum(str, Enum): """ - The resource type. + The status of the floating IP. """ - DEDICATED_HOST = 'dedicated_host' + AVAILABLE = 'available' + DELETING = 'deleting' + FAILED = 'failed' + PENDING = 'pending' -class DedicatedHostReferenceDeleted(): +class FloatingIPByTargetNetworkInterfaceIdentity(): """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. + The network interface this floating IP is to be bound to. - :attr str more_info: Link to documentation about deleted resources. + """ + + def __init__(self) -> None: + """ + Initialize a FloatingIPByTargetNetworkInterfaceIdentity object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityById', 'FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref'])) + raise Exception(msg) + +class FloatingIPCollection(): + """ + FloatingIPCollection. + + :attr FloatingIPCollectionFirst first: A link to the first page of resources. + :attr List[FloatingIP] floating_ips: Collection of floating IPs. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr FloatingIPCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages + except the last page. + :attr int total_count: The total number of resources across all pages. """ def __init__(self, - more_info: str) -> None: + first: 'FloatingIPCollectionFirst', + floating_ips: List['FloatingIP'], + limit: int, + total_count: int, + *, + next: 'FloatingIPCollectionNext' = None) -> None: """ - Initialize a DedicatedHostReferenceDeleted object. + Initialize a FloatingIPCollection object. - :param str more_info: Link to documentation about deleted resources. + :param FloatingIPCollectionFirst first: A link to the first page of + resources. + :param List[FloatingIP] floating_ips: Collection of floating IPs. + :param int limit: The maximum number of resources that can be returned by + the request. + :param int total_count: The total number of resources across all pages. + :param FloatingIPCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages + except the last page. """ - self.more_info = more_info + self.first = first + self.floating_ips = floating_ips + self.limit = limit + self.next = next + self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'DedicatedHostReferenceDeleted': - """Initialize a DedicatedHostReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'FloatingIPCollection': + """Initialize a FloatingIPCollection object from a json dictionary.""" args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') + if 'first' in _dict: + args['first'] = FloatingIPCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'more_info\' not present in DedicatedHostReferenceDeleted JSON') + raise ValueError('Required property \'first\' not present in FloatingIPCollection JSON') + if 'floating_ips' in _dict: + args['floating_ips'] = [FloatingIP.from_dict(x) for x in _dict.get('floating_ips')] + else: + raise ValueError('Required property \'floating_ips\' not present in FloatingIPCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') + else: + raise ValueError('Required property \'limit\' not present in FloatingIPCollection JSON') + if 'next' in _dict: + args['next'] = FloatingIPCollectionNext.from_dict(_dict.get('next')) + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') + else: + raise ValueError('Required property \'total_count\' not present in FloatingIPCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DedicatedHostReferenceDeleted object from a json dictionary.""" + """Initialize a FloatingIPCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'floating_ips') and self.floating_ips is not None: + _dict['floating_ips'] = [x.to_dict() for x in self.floating_ips] + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count return _dict def _to_dict(self): @@ -23466,152 +27956,112 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DedicatedHostReferenceDeleted object.""" + """Return a `str` version of this FloatingIPCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DedicatedHostReferenceDeleted') -> bool: + def __eq__(self, other: 'FloatingIPCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DedicatedHostReferenceDeleted') -> bool: + def __ne__(self, other: 'FloatingIPCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class DefaultNetworkACL(): +class FloatingIPCollectionFirst(): """ - DefaultNetworkACL. + A link to the first page of resources. - :attr datetime created_at: The date and time that the network ACL was created. - :attr str crn: The CRN for this network ACL. - :attr str href: The URL for this network ACL. - :attr str id: The unique identifier for this network ACL. - :attr str name: The name of the default network ACL created for a VPC. The name - will be a hyphenated list of randomly-selected words at creation, but may be - user-specified with a subsequent request. - :attr ResourceGroupReference resource_group: The resource group for the default - network ACL for a VPC. Set to the VPC's - resource group at creation. - :attr List[NetworkACLRuleItem] rules: The ordered rules for the default network - ACL for a VPC. Defaults to two rules which allow all inbound and outbound - traffic, respectively. Rules for the default network ACL may be changed, added, - or removed. - :attr List[SubnetReference] subnets: The subnets to which this network ACL is - attached. - :attr VPCReference vpc: The VPC this network ACL is a part of. + :attr str href: The URL for a page of resources. """ def __init__(self, - created_at: datetime, - crn: str, - href: str, - id: str, - name: str, - resource_group: 'ResourceGroupReference', - rules: List['NetworkACLRuleItem'], - subnets: List['SubnetReference'], - vpc: 'VPCReference') -> None: + href: str) -> None: """ - Initialize a DefaultNetworkACL object. + Initialize a FloatingIPCollectionFirst object. - :param datetime created_at: The date and time that the network ACL was - created. - :param str crn: The CRN for this network ACL. - :param str href: The URL for this network ACL. - :param str id: The unique identifier for this network ACL. - :param str name: The name of the default network ACL created for a VPC. The - name will be a hyphenated list of randomly-selected words at creation, but - may be user-specified with a subsequent request. - :param ResourceGroupReference resource_group: The resource group for the - default network ACL for a VPC. Set to the VPC's - resource group at creation. - :param List[NetworkACLRuleItem] rules: The ordered rules for the default - network ACL for a VPC. Defaults to two rules which allow all inbound and - outbound traffic, respectively. Rules for the default network ACL may be - changed, added, or removed. - :param List[SubnetReference] subnets: The subnets to which this network ACL - is attached. - :param VPCReference vpc: The VPC this network ACL is a part of. + :param str href: The URL for a page of resources. + """ + self.href = href + + @classmethod + def from_dict(cls, _dict: Dict) -> 'FloatingIPCollectionFirst': + """Initialize a FloatingIPCollectionFirst object from a json dictionary.""" + args = {} + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in FloatingIPCollectionFirst JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a FloatingIPCollectionFirst object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this FloatingIPCollectionFirst object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'FloatingIPCollectionFirst') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'FloatingIPCollectionFirst') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class FloatingIPCollectionNext(): + """ + A link to the next page of resources. This property is present for all pages except + the last page. + + :attr str href: The URL for a page of resources. + """ + + def __init__(self, + href: str) -> None: + """ + Initialize a FloatingIPCollectionNext object. + + :param str href: The URL for a page of resources. """ - self.created_at = created_at - self.crn = crn self.href = href - self.id = id - self.name = name - self.resource_group = resource_group - self.rules = rules - self.subnets = subnets - self.vpc = vpc @classmethod - def from_dict(cls, _dict: Dict) -> 'DefaultNetworkACL': - """Initialize a DefaultNetworkACL object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'FloatingIPCollectionNext': + """Initialize a FloatingIPCollectionNext object from a json dictionary.""" args = {} - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - else: - raise ValueError('Required property \'created_at\' not present in DefaultNetworkACL JSON') - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in DefaultNetworkACL JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in DefaultNetworkACL JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in DefaultNetworkACL JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in DefaultNetworkACL JSON') - if 'resource_group' in _dict: - args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) - else: - raise ValueError('Required property \'resource_group\' not present in DefaultNetworkACL JSON') - if 'rules' in _dict: - args['rules'] = [NetworkACLRuleItem.from_dict(x) for x in _dict.get('rules')] - else: - raise ValueError('Required property \'rules\' not present in DefaultNetworkACL JSON') - if 'subnets' in _dict: - args['subnets'] = [SubnetReference.from_dict(x) for x in _dict.get('subnets')] - else: - raise ValueError('Required property \'subnets\' not present in DefaultNetworkACL JSON') - if 'vpc' in _dict: - args['vpc'] = VPCReference.from_dict(_dict.get('vpc')) - else: - raise ValueError('Required property \'vpc\' not present in DefaultNetworkACL JSON') + raise ValueError('Required property \'href\' not present in FloatingIPCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DefaultNetworkACL object from a json dictionary.""" + """Initialize a FloatingIPCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'resource_group') and self.resource_group is not None: - _dict['resource_group'] = self.resource_group.to_dict() - if hasattr(self, 'rules') and self.rules is not None: - _dict['rules'] = [x.to_dict() for x in self.rules] - if hasattr(self, 'subnets') and self.subnets is not None: - _dict['subnets'] = [x.to_dict() for x in self.subnets] - if hasattr(self, 'vpc') and self.vpc is not None: - _dict['vpc'] = self.vpc.to_dict() return _dict def _to_dict(self): @@ -23619,226 +28069,74 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DefaultNetworkACL object.""" + """Return a `str` version of this FloatingIPCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DefaultNetworkACL') -> bool: + def __eq__(self, other: 'FloatingIPCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DefaultNetworkACL') -> bool: + def __ne__(self, other: 'FloatingIPCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class DefaultRoutingTable(): +class FloatingIPPatch(): """ - DefaultRoutingTable. + FloatingIPPatch. - :attr datetime created_at: The date and time that this routing table was - created. - :attr str href: The URL for this routing table. - :attr str id: The unique identifier for this routing table. - :attr bool is_default: Indicates whether this is the default routing table for - this VPC. - :attr str lifecycle_state: The lifecycle state of the routing table. - :attr str name: The name of the default routing table created for this VPC. The - name will be a hyphenated list of randomly-selected words at creation, but may - be user-specified with a subsequent request. - :attr str resource_type: The resource type. - :attr bool route_direct_link_ingress: Indicates whether this routing table is - used to route traffic that originates from - [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. - Incoming traffic will be routed according to the routing table with one - exception: routes with an `action` of `deliver` are treated as `drop` unless the - `next_hop` is an IP address bound to a network interface on a subnet in the - route's `zone`. Therefore, if an incoming packet matches a route with a - `next_hop` of an internet-bound IP address or a VPN gateway connection, the - packet will be dropped. - :attr bool route_transit_gateway_ingress: Indicates whether this routing table - is used to route traffic that originates from from [Transit - Gateway](https://cloud.ibm.com/cloud/transit-gateway/) to this VPC. - Incoming traffic will be routed according to the routing table with one - exception: routes with an `action` of `deliver` are treated as `drop` unless the - `next_hop` is an IP address bound to a network interface on a subnet in the - route's `zone`. Therefore, if an incoming packet matches a route with a - `next_hop` of an internet-bound IP address or a VPN gateway connection, the - packet will be dropped. - :attr bool route_vpc_zone_ingress: Indicates whether this routing table is used - to route traffic that originates from subnets in other zones in this VPC. - Incoming traffic will be routed according to the routing table with one - exception: routes with an `action` of `deliver` are treated as `drop` unless the - `next_hop` is an IP address bound to a network interface on a subnet in the - route's `zone`. Therefore, if an incoming packet matches a route with a - `next_hop` of an internet-bound IP address or a VPN gateway connection, the - packet will be dropped. - :attr List[RouteReference] routes: The routes for the default routing table for - this VPC. The table is created with no routes, but routes may be added, changed, - or removed with a subsequent request. - :attr List[SubnetReference] subnets: The subnets to which this routing table is - attached. + :attr str name: (optional) The unique user-defined name for this floating IP. + :attr FloatingIPTargetPatch target: (optional) The network interface to bind the + floating IP to, replacing any existing binding. For + this request to succeed, the floating IP must not be required by another + resource, such + as a public gateway. """ def __init__(self, - created_at: datetime, - href: str, - id: str, - is_default: bool, - lifecycle_state: str, - name: str, - resource_type: str, - route_direct_link_ingress: bool, - route_transit_gateway_ingress: bool, - route_vpc_zone_ingress: bool, - routes: List['RouteReference'], - subnets: List['SubnetReference']) -> None: + *, + name: str = None, + target: 'FloatingIPTargetPatch' = None) -> None: """ - Initialize a DefaultRoutingTable object. + Initialize a FloatingIPPatch object. - :param datetime created_at: The date and time that this routing table was - created. - :param str href: The URL for this routing table. - :param str id: The unique identifier for this routing table. - :param bool is_default: Indicates whether this is the default routing table - for this VPC. - :param str lifecycle_state: The lifecycle state of the routing table. - :param str name: The name of the default routing table created for this - VPC. The name will be a hyphenated list of randomly-selected words at - creation, but may be user-specified with a subsequent request. - :param str resource_type: The resource type. - :param bool route_direct_link_ingress: Indicates whether this routing table - is used to route traffic that originates from - [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. - Incoming traffic will be routed according to the routing table with one - exception: routes with an `action` of `deliver` are treated as `drop` - unless the `next_hop` is an IP address bound to a network interface on a - subnet in the route's `zone`. Therefore, if an incoming packet matches a - route with a `next_hop` of an internet-bound IP address or a VPN gateway - connection, the packet will be dropped. - :param bool route_transit_gateway_ingress: Indicates whether this routing - table is used to route traffic that originates from from [Transit - Gateway](https://cloud.ibm.com/cloud/transit-gateway/) to this VPC. - Incoming traffic will be routed according to the routing table with one - exception: routes with an `action` of `deliver` are treated as `drop` - unless the `next_hop` is an IP address bound to a network interface on a - subnet in the route's `zone`. Therefore, if an incoming packet matches a - route with a `next_hop` of an internet-bound IP address or a VPN gateway - connection, the packet will be dropped. - :param bool route_vpc_zone_ingress: Indicates whether this routing table is - used to route traffic that originates from subnets in other zones in this - VPC. - Incoming traffic will be routed according to the routing table with one - exception: routes with an `action` of `deliver` are treated as `drop` - unless the `next_hop` is an IP address bound to a network interface on a - subnet in the route's `zone`. Therefore, if an incoming packet matches a - route with a `next_hop` of an internet-bound IP address or a VPN gateway - connection, the packet will be dropped. - :param List[RouteReference] routes: The routes for the default routing - table for this VPC. The table is created with no routes, but routes may be - added, changed, or removed with a subsequent request. - :param List[SubnetReference] subnets: The subnets to which this routing - table is attached. + :param str name: (optional) The unique user-defined name for this floating + IP. + :param FloatingIPTargetPatch target: (optional) The network interface to + bind the floating IP to, replacing any existing binding. For + this request to succeed, the floating IP must not be required by another + resource, such + as a public gateway. """ - self.created_at = created_at - self.href = href - self.id = id - self.is_default = is_default - self.lifecycle_state = lifecycle_state self.name = name - self.resource_type = resource_type - self.route_direct_link_ingress = route_direct_link_ingress - self.route_transit_gateway_ingress = route_transit_gateway_ingress - self.route_vpc_zone_ingress = route_vpc_zone_ingress - self.routes = routes - self.subnets = subnets + self.target = target @classmethod - def from_dict(cls, _dict: Dict) -> 'DefaultRoutingTable': - """Initialize a DefaultRoutingTable object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'FloatingIPPatch': + """Initialize a FloatingIPPatch object from a json dictionary.""" args = {} - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - else: - raise ValueError('Required property \'created_at\' not present in DefaultRoutingTable JSON') - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in DefaultRoutingTable JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in DefaultRoutingTable JSON') - if 'is_default' in _dict: - args['is_default'] = _dict.get('is_default') - else: - raise ValueError('Required property \'is_default\' not present in DefaultRoutingTable JSON') - if 'lifecycle_state' in _dict: - args['lifecycle_state'] = _dict.get('lifecycle_state') - else: - raise ValueError('Required property \'lifecycle_state\' not present in DefaultRoutingTable JSON') if 'name' in _dict: args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in DefaultRoutingTable JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in DefaultRoutingTable JSON') - if 'route_direct_link_ingress' in _dict: - args['route_direct_link_ingress'] = _dict.get('route_direct_link_ingress') - else: - raise ValueError('Required property \'route_direct_link_ingress\' not present in DefaultRoutingTable JSON') - if 'route_transit_gateway_ingress' in _dict: - args['route_transit_gateway_ingress'] = _dict.get('route_transit_gateway_ingress') - else: - raise ValueError('Required property \'route_transit_gateway_ingress\' not present in DefaultRoutingTable JSON') - if 'route_vpc_zone_ingress' in _dict: - args['route_vpc_zone_ingress'] = _dict.get('route_vpc_zone_ingress') - else: - raise ValueError('Required property \'route_vpc_zone_ingress\' not present in DefaultRoutingTable JSON') - if 'routes' in _dict: - args['routes'] = [RouteReference.from_dict(x) for x in _dict.get('routes')] - else: - raise ValueError('Required property \'routes\' not present in DefaultRoutingTable JSON') - if 'subnets' in _dict: - args['subnets'] = [SubnetReference.from_dict(x) for x in _dict.get('subnets')] - else: - raise ValueError('Required property \'subnets\' not present in DefaultRoutingTable JSON') + if 'target' in _dict: + args['target'] = _dict.get('target') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DefaultRoutingTable object from a json dictionary.""" + """Initialize a FloatingIPPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'is_default') and self.is_default is not None: - _dict['is_default'] = self.is_default - if hasattr(self, 'lifecycle_state') and self.lifecycle_state is not None: - _dict['lifecycle_state'] = self.lifecycle_state if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type - if hasattr(self, 'route_direct_link_ingress') and self.route_direct_link_ingress is not None: - _dict['route_direct_link_ingress'] = self.route_direct_link_ingress - if hasattr(self, 'route_transit_gateway_ingress') and self.route_transit_gateway_ingress is not None: - _dict['route_transit_gateway_ingress'] = self.route_transit_gateway_ingress - if hasattr(self, 'route_vpc_zone_ingress') and self.route_vpc_zone_ingress is not None: - _dict['route_vpc_zone_ingress'] = self.route_vpc_zone_ingress - if hasattr(self, 'routes') and self.routes is not None: - _dict['routes'] = [x.to_dict() for x in self.routes] - if hasattr(self, 'subnets') and self.subnets is not None: - _dict['subnets'] = [x.to_dict() for x in self.subnets] + if hasattr(self, 'target') and self.target is not None: + if isinstance(self.target, dict): + _dict['target'] = self.target + else: + _dict['target'] = self.target.to_dict() return _dict def _to_dict(self): @@ -23846,178 +28144,138 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DefaultRoutingTable object.""" + """Return a `str` version of this FloatingIPPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DefaultRoutingTable') -> bool: + def __eq__(self, other: 'FloatingIPPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DefaultRoutingTable') -> bool: + def __ne__(self, other: 'FloatingIPPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class LifecycleStateEnum(str, Enum): - """ - The lifecycle state of the routing table. - """ - DELETING = 'deleting' - FAILED = 'failed' - PENDING = 'pending' - STABLE = 'stable' - SUSPENDED = 'suspended' - UPDATING = 'updating' - WAITING = 'waiting' +class FloatingIPPrototype(): + """ + FloatingIPPrototype. + :attr str name: (optional) The unique user-defined name for this floating IP. If + unspecified, the name will be a hyphenated list of randomly-selected words. + :attr ResourceGroupIdentity resource_group: (optional) The resource group to + use. If unspecified, the account's [default resource + group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + """ - class ResourceTypeEnum(str, Enum): - """ - The resource type. + def __init__(self, + *, + name: str = None, + resource_group: 'ResourceGroupIdentity' = None) -> None: """ - ROUTING_TABLE = 'routing_table' + Initialize a FloatingIPPrototype object. + :param str name: (optional) The unique user-defined name for this floating + IP. If unspecified, the name will be a hyphenated list of randomly-selected + words. + :param ResourceGroupIdentity resource_group: (optional) The resource group + to use. If unspecified, the account's [default resource + group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is + used. + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['FloatingIPPrototypeFloatingIPByZone', 'FloatingIPPrototypeFloatingIPByTarget'])) + raise Exception(msg) -class DefaultSecurityGroup(): +class FloatingIPReference(): """ - DefaultSecurityGroup. + FloatingIPReference. - :attr datetime created_at: The date and time that this security group was - created. - :attr str crn: The security group's CRN. - :attr str href: The security group's canonical URL. - :attr str id: The unique identifier for this security group. - :attr str name: The name of the default security group created for a VPC. The - name will be a hyphenated list of randomly-selected words at creation, but may - be user-specified with a subsequent request. - :attr ResourceGroupReference resource_group: The resource group for this - security group. - :attr List[SecurityGroupRule] rules: The rules for the default security group - for a VPC. Defaults to allowing all outbound traffic, and allowing all inbound - traffic from other interfaces in the VPC's default security group. Rules for the - default security group may be changed, added or removed. - :attr List[SecurityGroupTargetReference] targets: The targets for this security - group. - :attr VPCReference vpc: The VPC this security group is a part of. + :attr str address: The globally unique IP address. + :attr str crn: The CRN for this floating IP. + :attr FloatingIPReferenceDeleted deleted: (optional) If present, this property + indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str href: The URL for this floating IP. + :attr str id: The unique identifier for this floating IP. + :attr str name: The unique user-defined name for this floating IP. """ def __init__(self, - created_at: datetime, + address: str, crn: str, href: str, id: str, name: str, - resource_group: 'ResourceGroupReference', - rules: List['SecurityGroupRule'], - targets: List['SecurityGroupTargetReference'], - vpc: 'VPCReference') -> None: + *, + deleted: 'FloatingIPReferenceDeleted' = None) -> None: """ - Initialize a DefaultSecurityGroup object. + Initialize a FloatingIPReference object. - :param datetime created_at: The date and time that this security group was - created. - :param str crn: The security group's CRN. - :param str href: The security group's canonical URL. - :param str id: The unique identifier for this security group. - :param str name: The name of the default security group created for a VPC. - The name will be a hyphenated list of randomly-selected words at creation, - but may be user-specified with a subsequent request. - :param ResourceGroupReference resource_group: The resource group for this - security group. - :param List[SecurityGroupRule] rules: The rules for the default security - group for a VPC. Defaults to allowing all outbound traffic, and allowing - all inbound traffic from other interfaces in the VPC's default security - group. Rules for the default security group may be changed, added or - removed. - :param List[SecurityGroupTargetReference] targets: The targets for this - security group. - :param VPCReference vpc: The VPC this security group is a part of. + :param str address: The globally unique IP address. + :param str crn: The CRN for this floating IP. + :param str href: The URL for this floating IP. + :param str id: The unique identifier for this floating IP. + :param str name: The unique user-defined name for this floating IP. + :param FloatingIPReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides + some supplementary information. """ - self.created_at = created_at + self.address = address self.crn = crn + self.deleted = deleted self.href = href self.id = id self.name = name - self.resource_group = resource_group - self.rules = rules - self.targets = targets - self.vpc = vpc @classmethod - def from_dict(cls, _dict: Dict) -> 'DefaultSecurityGroup': - """Initialize a DefaultSecurityGroup object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'FloatingIPReference': + """Initialize a FloatingIPReference object from a json dictionary.""" args = {} - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) + if 'address' in _dict: + args['address'] = _dict.get('address') else: - raise ValueError('Required property \'created_at\' not present in DefaultSecurityGroup JSON') + raise ValueError('Required property \'address\' not present in FloatingIPReference JSON') if 'crn' in _dict: args['crn'] = _dict.get('crn') else: - raise ValueError('Required property \'crn\' not present in DefaultSecurityGroup JSON') + raise ValueError('Required property \'crn\' not present in FloatingIPReference JSON') + if 'deleted' in _dict: + args['deleted'] = FloatingIPReferenceDeleted.from_dict(_dict.get('deleted')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in DefaultSecurityGroup JSON') + raise ValueError('Required property \'href\' not present in FloatingIPReference JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in DefaultSecurityGroup JSON') + raise ValueError('Required property \'id\' not present in FloatingIPReference JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in DefaultSecurityGroup JSON') - if 'resource_group' in _dict: - args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) - else: - raise ValueError('Required property \'resource_group\' not present in DefaultSecurityGroup JSON') - if 'rules' in _dict: - args['rules'] = [SecurityGroupRule.from_dict(x) for x in _dict.get('rules')] - else: - raise ValueError('Required property \'rules\' not present in DefaultSecurityGroup JSON') - if 'targets' in _dict: - args['targets'] = _dict.get('targets') - else: - raise ValueError('Required property \'targets\' not present in DefaultSecurityGroup JSON') - if 'vpc' in _dict: - args['vpc'] = VPCReference.from_dict(_dict.get('vpc')) - else: - raise ValueError('Required property \'vpc\' not present in DefaultSecurityGroup JSON') + raise ValueError('Required property \'name\' not present in FloatingIPReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DefaultSecurityGroup object from a json dictionary.""" + """Initialize a FloatingIPReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'address') and self.address is not None: + _dict['address'] = self.address if hasattr(self, 'crn') and self.crn is not None: _dict['crn'] = self.crn + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'resource_group') and self.resource_group is not None: - _dict['resource_group'] = self.resource_group.to_dict() - if hasattr(self, 'rules') and self.rules is not None: - _dict['rules'] = [x.to_dict() for x in self.rules] - if hasattr(self, 'targets') and self.targets is not None: - targets_list = [] - for x in self.targets: - if isinstance(x, dict): - targets_list.append(x) - else: - targets_list.append(x.to_dict()) - _dict['targets'] = targets_list - if hasattr(self, 'vpc') and self.vpc is not None: - _dict['vpc'] = self.vpc.to_dict() return _dict def _to_dict(self): @@ -24025,78 +28283,144 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DefaultSecurityGroup object.""" + """Return a `str` version of this FloatingIPReference object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'FloatingIPReference') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'FloatingIPReference') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class FloatingIPReferenceDeleted(): + """ + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. + + :attr str more_info: Link to documentation about deleted resources. + """ + + def __init__(self, + more_info: str) -> None: + """ + Initialize a FloatingIPReferenceDeleted object. + + :param str more_info: Link to documentation about deleted resources. + """ + self.more_info = more_info + + @classmethod + def from_dict(cls, _dict: Dict) -> 'FloatingIPReferenceDeleted': + """Initialize a FloatingIPReferenceDeleted object from a json dictionary.""" + args = {} + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') + else: + raise ValueError('Required property \'more_info\' not present in FloatingIPReferenceDeleted JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a FloatingIPReferenceDeleted object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this FloatingIPReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DefaultSecurityGroup') -> bool: + def __eq__(self, other: 'FloatingIPReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'DefaultSecurityGroup') -> bool: + def __ne__(self, other: 'FloatingIPReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class EncryptionKeyIdentity(): +class FloatingIPTarget(): """ - Identifies an encryption key by a unique property. + The target of this floating IP. """ def __init__(self) -> None: """ - Initialize a EncryptionKeyIdentity object. + Initialize a FloatingIPTarget object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['EncryptionKeyIdentityByCRN'])) + ", ".join(['FloatingIPTargetNetworkInterfaceReference', 'FloatingIPTargetPublicGatewayReference'])) raise Exception(msg) -class EncryptionKeyReference(): +class FloatingIPTargetPatch(): """ - EncryptionKeyReference. + The network interface to bind the floating IP to, replacing any existing binding. For + this request to succeed, the floating IP must not be required by another resource, + such as a public gateway. - :attr str crn: The CRN of the [Key Protect Root - Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) - or [Hyper Protect Crypto Service Root - Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this - resource. + """ + + def __init__(self) -> None: + """ + Initialize a FloatingIPTargetPatch object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['FloatingIPTargetPatchNetworkInterfaceIdentityById', 'FloatingIPTargetPatchNetworkInterfaceIdentityByHref'])) + raise Exception(msg) + +class FloatingIPUnpaginatedCollection(): + """ + FloatingIPUnpaginatedCollection. + + :attr List[FloatingIP] floating_ips: Collection of floating IPs. """ def __init__(self, - crn: str) -> None: + floating_ips: List['FloatingIP']) -> None: """ - Initialize a EncryptionKeyReference object. + Initialize a FloatingIPUnpaginatedCollection object. - :param str crn: The CRN of the [Key Protect Root - Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) - or [Hyper Protect Crypto Service Root - Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for - this resource. + :param List[FloatingIP] floating_ips: Collection of floating IPs. """ - self.crn = crn + self.floating_ips = floating_ips @classmethod - def from_dict(cls, _dict: Dict) -> 'EncryptionKeyReference': - """Initialize a EncryptionKeyReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'FloatingIPUnpaginatedCollection': + """Initialize a FloatingIPUnpaginatedCollection object from a json dictionary.""" args = {} - if 'crn' in _dict: - args['crn'] = _dict.get('crn') + if 'floating_ips' in _dict: + args['floating_ips'] = [FloatingIP.from_dict(x) for x in _dict.get('floating_ips')] else: - raise ValueError('Required property \'crn\' not present in EncryptionKeyReference JSON') + raise ValueError('Required property \'floating_ips\' not present in FloatingIPUnpaginatedCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a EncryptionKeyReference object from a json dictionary.""" + """Initialize a FloatingIPUnpaginatedCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn + if hasattr(self, 'floating_ips') and self.floating_ips is not None: + _dict['floating_ips'] = [x.to_dict() for x in self.floating_ips] return _dict def _to_dict(self): @@ -24104,219 +28428,181 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this EncryptionKeyReference object.""" + """Return a `str` version of this FloatingIPUnpaginatedCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'EncryptionKeyReference') -> bool: + def __eq__(self, other: 'FloatingIPUnpaginatedCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'EncryptionKeyReference') -> bool: + def __ne__(self, other: 'FloatingIPUnpaginatedCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class EndpointGateway(): +class FlowLogCollector(): """ - EndpointGateway. + FlowLogCollector. - :attr datetime created_at: The date and time that the endpoint gateway was + :attr bool active: Indicates whether this collector is active. + :attr bool auto_delete: Indicates whether this flow log collector will be + automatically deleted when `target` is deleted. At present, this is always + `true`, but may be modifiable in the future. + :attr datetime created_at: The date and time that the flow log collector was created. - :attr str crn: The CRN for this endpoint gateway. - :attr str health_state: The health of this resource. - - `ok`: No abnormal behavior detected - - `degraded`: Experiencing compromised performance, capacity, or connectivity - - `faulted`: Completely unreachable, inoperative, or otherwise entirely - incapacitated - - `inapplicable`: The health state does not apply because of the current - lifecycle state. A resource with a lifecycle state of `failed` or `deleting` - will have a health state of `inapplicable`. A `pending` resource may also have - this state. - :attr str href: The URL for this endpoint gateway. - :attr str id: The unique identifier for this endpoint gateway. - :attr List[ReservedIPReference] ips: The reserved IPs bound to this endpoint - gateway. - :attr str lifecycle_state: The lifecycle state of the endpoint gateway. - :attr str name: The unique user-defined name for this endpoint gateway. - :attr ResourceGroupReference resource_group: The resource group for this - endpoint gateway. - :attr str resource_type: The resource type. - :attr List[SecurityGroupReference] security_groups: The security groups - targeting this endpoint gateway. - :attr str service_endpoint: (optional) The fully qualified domain name for the - target service. - :attr List[str] service_endpoints: The fully qualified domain names for the - target service. - :attr EndpointGatewayTarget target: The target for this endpoint gateway. - :attr VPCReference vpc: The VPC this endpoint gateway is serving. + :attr str crn: The CRN for this flow log collector. + :attr str href: The URL for this flow log collector. + :attr str id: The unique identifier for this flow log collector. + :attr str lifecycle_state: The lifecycle state of the flow log collector. + :attr str name: The unique user-defined name for this flow log collector. + :attr ResourceGroupReference resource_group: The resource group for this flow + log collector. + :attr LegacyCloudObjectStorageBucketReference storage_bucket: The Cloud Object + Storage bucket where the collected flows are logged. + :attr FlowLogCollectorTarget target: The target this collector is collecting + flow logs for. If the target is an instance, + subnet, or VPC, flow logs will not be collected for any network interfaces + within the + target that are themselves the target of a more specific flow log collector. + :attr VPCReference vpc: The VPC this flow log collector is associated with. """ def __init__(self, + active: bool, + auto_delete: bool, created_at: datetime, crn: str, - health_state: str, href: str, id: str, - ips: List['ReservedIPReference'], lifecycle_state: str, name: str, resource_group: 'ResourceGroupReference', - resource_type: str, - security_groups: List['SecurityGroupReference'], - service_endpoints: List[str], - target: 'EndpointGatewayTarget', - vpc: 'VPCReference', - *, - service_endpoint: str = None) -> None: + storage_bucket: 'LegacyCloudObjectStorageBucketReference', + target: 'FlowLogCollectorTarget', + vpc: 'VPCReference') -> None: """ - Initialize a EndpointGateway object. + Initialize a FlowLogCollector object. - :param datetime created_at: The date and time that the endpoint gateway was - created. - :param str crn: The CRN for this endpoint gateway. - :param str health_state: The health of this resource. - - `ok`: No abnormal behavior detected - - `degraded`: Experiencing compromised performance, capacity, or - connectivity - - `faulted`: Completely unreachable, inoperative, or otherwise entirely - incapacitated - - `inapplicable`: The health state does not apply because of the current - lifecycle state. A resource with a lifecycle state of `failed` or - `deleting` will have a health state of `inapplicable`. A `pending` resource - may also have this state. - :param str href: The URL for this endpoint gateway. - :param str id: The unique identifier for this endpoint gateway. - :param List[ReservedIPReference] ips: The reserved IPs bound to this - endpoint gateway. - :param str lifecycle_state: The lifecycle state of the endpoint gateway. - :param str name: The unique user-defined name for this endpoint gateway. + :param bool active: Indicates whether this collector is active. + :param bool auto_delete: Indicates whether this flow log collector will be + automatically deleted when `target` is deleted. At present, this is always + `true`, but may be modifiable in the future. + :param datetime created_at: The date and time that the flow log collector + was created. + :param str crn: The CRN for this flow log collector. + :param str href: The URL for this flow log collector. + :param str id: The unique identifier for this flow log collector. + :param str lifecycle_state: The lifecycle state of the flow log collector. + :param str name: The unique user-defined name for this flow log collector. :param ResourceGroupReference resource_group: The resource group for this - endpoint gateway. - :param str resource_type: The resource type. - :param List[SecurityGroupReference] security_groups: The security groups - targeting this endpoint gateway. - :param List[str] service_endpoints: The fully qualified domain names for - the target service. - :param EndpointGatewayTarget target: The target for this endpoint gateway. - :param VPCReference vpc: The VPC this endpoint gateway is serving. - :param str service_endpoint: (optional) The fully qualified domain name for - the target service. + flow log collector. + :param LegacyCloudObjectStorageBucketReference storage_bucket: The Cloud + Object Storage bucket where the collected flows are logged. + :param FlowLogCollectorTarget target: The target this collector is + collecting flow logs for. If the target is an instance, + subnet, or VPC, flow logs will not be collected for any network interfaces + within the + target that are themselves the target of a more specific flow log + collector. + :param VPCReference vpc: The VPC this flow log collector is associated + with. """ + self.active = active + self.auto_delete = auto_delete self.created_at = created_at self.crn = crn - self.health_state = health_state self.href = href self.id = id - self.ips = ips self.lifecycle_state = lifecycle_state self.name = name self.resource_group = resource_group - self.resource_type = resource_type - self.security_groups = security_groups - self.service_endpoint = service_endpoint - self.service_endpoints = service_endpoints + self.storage_bucket = storage_bucket self.target = target self.vpc = vpc @classmethod - def from_dict(cls, _dict: Dict) -> 'EndpointGateway': - """Initialize a EndpointGateway object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'FlowLogCollector': + """Initialize a FlowLogCollector object from a json dictionary.""" args = {} + if 'active' in _dict: + args['active'] = _dict.get('active') + else: + raise ValueError('Required property \'active\' not present in FlowLogCollector JSON') + if 'auto_delete' in _dict: + args['auto_delete'] = _dict.get('auto_delete') + else: + raise ValueError('Required property \'auto_delete\' not present in FlowLogCollector JSON') if 'created_at' in _dict: args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError('Required property \'created_at\' not present in EndpointGateway JSON') + raise ValueError('Required property \'created_at\' not present in FlowLogCollector JSON') if 'crn' in _dict: args['crn'] = _dict.get('crn') else: - raise ValueError('Required property \'crn\' not present in EndpointGateway JSON') - if 'health_state' in _dict: - args['health_state'] = _dict.get('health_state') - else: - raise ValueError('Required property \'health_state\' not present in EndpointGateway JSON') + raise ValueError('Required property \'crn\' not present in FlowLogCollector JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in EndpointGateway JSON') + raise ValueError('Required property \'href\' not present in FlowLogCollector JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in EndpointGateway JSON') - if 'ips' in _dict: - args['ips'] = [ReservedIPReference.from_dict(x) for x in _dict.get('ips')] - else: - raise ValueError('Required property \'ips\' not present in EndpointGateway JSON') + raise ValueError('Required property \'id\' not present in FlowLogCollector JSON') if 'lifecycle_state' in _dict: args['lifecycle_state'] = _dict.get('lifecycle_state') else: - raise ValueError('Required property \'lifecycle_state\' not present in EndpointGateway JSON') + raise ValueError('Required property \'lifecycle_state\' not present in FlowLogCollector JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in EndpointGateway JSON') + raise ValueError('Required property \'name\' not present in FlowLogCollector JSON') if 'resource_group' in _dict: args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) else: - raise ValueError('Required property \'resource_group\' not present in EndpointGateway JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in EndpointGateway JSON') - if 'security_groups' in _dict: - args['security_groups'] = [SecurityGroupReference.from_dict(x) for x in _dict.get('security_groups')] - else: - raise ValueError('Required property \'security_groups\' not present in EndpointGateway JSON') - if 'service_endpoint' in _dict: - args['service_endpoint'] = _dict.get('service_endpoint') - if 'service_endpoints' in _dict: - args['service_endpoints'] = _dict.get('service_endpoints') + raise ValueError('Required property \'resource_group\' not present in FlowLogCollector JSON') + if 'storage_bucket' in _dict: + args['storage_bucket'] = LegacyCloudObjectStorageBucketReference.from_dict(_dict.get('storage_bucket')) else: - raise ValueError('Required property \'service_endpoints\' not present in EndpointGateway JSON') + raise ValueError('Required property \'storage_bucket\' not present in FlowLogCollector JSON') if 'target' in _dict: args['target'] = _dict.get('target') else: - raise ValueError('Required property \'target\' not present in EndpointGateway JSON') + raise ValueError('Required property \'target\' not present in FlowLogCollector JSON') if 'vpc' in _dict: args['vpc'] = VPCReference.from_dict(_dict.get('vpc')) else: - raise ValueError('Required property \'vpc\' not present in EndpointGateway JSON') + raise ValueError('Required property \'vpc\' not present in FlowLogCollector JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a EndpointGateway object from a json dictionary.""" + """Initialize a FlowLogCollector object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'active') and self.active is not None: + _dict['active'] = self.active + if hasattr(self, 'auto_delete') and self.auto_delete is not None: + _dict['auto_delete'] = self.auto_delete if hasattr(self, 'created_at') and self.created_at is not None: _dict['created_at'] = datetime_to_string(self.created_at) if hasattr(self, 'crn') and self.crn is not None: _dict['crn'] = self.crn - if hasattr(self, 'health_state') and self.health_state is not None: - _dict['health_state'] = self.health_state if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id - if hasattr(self, 'ips') and self.ips is not None: - _dict['ips'] = [x.to_dict() for x in self.ips] if hasattr(self, 'lifecycle_state') and self.lifecycle_state is not None: _dict['lifecycle_state'] = self.lifecycle_state if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name if hasattr(self, 'resource_group') and self.resource_group is not None: _dict['resource_group'] = self.resource_group.to_dict() - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type - if hasattr(self, 'security_groups') and self.security_groups is not None: - _dict['security_groups'] = [x.to_dict() for x in self.security_groups] - if hasattr(self, 'service_endpoint') and self.service_endpoint is not None: - _dict['service_endpoint'] = self.service_endpoint - if hasattr(self, 'service_endpoints') and self.service_endpoints is not None: - _dict['service_endpoints'] = self.service_endpoints + if hasattr(self, 'storage_bucket') and self.storage_bucket is not None: + _dict['storage_bucket'] = self.storage_bucket.to_dict() if hasattr(self, 'target') and self.target is not None: if isinstance(self.target, dict): _dict['target'] = self.target @@ -24331,39 +28617,22 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this EndpointGateway object.""" + """Return a `str` version of this FlowLogCollector object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'EndpointGateway') -> bool: + def __eq__(self, other: 'FlowLogCollector') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'EndpointGateway') -> bool: + def __ne__(self, other: 'FlowLogCollector') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class HealthStateEnum(str, Enum): - """ - The health of this resource. - - `ok`: No abnormal behavior detected - - `degraded`: Experiencing compromised performance, capacity, or connectivity - - `faulted`: Completely unreachable, inoperative, or otherwise entirely - incapacitated - - `inapplicable`: The health state does not apply because of the current lifecycle - state. A resource with a lifecycle state of `failed` or `deleting` will have a - health state of `inapplicable`. A `pending` resource may also have this state. - """ - DEGRADED = 'degraded' - FAULTED = 'faulted' - INAPPLICABLE = 'inapplicable' - OK = 'ok' - - class LifecycleStateEnum(str, Enum): """ - The lifecycle state of the endpoint gateway. + The lifecycle state of the flow log collector. """ DELETING = 'deleting' FAILED = 'failed' @@ -24374,91 +28643,85 @@ class LifecycleStateEnum(str, Enum): WAITING = 'waiting' - class ResourceTypeEnum(str, Enum): - """ - The resource type. - """ - ENDPOINT_GATEWAY = 'endpoint_gateway' - - -class EndpointGatewayCollection(): +class FlowLogCollectorCollection(): """ - EndpointGatewayCollection. + FlowLogCollectorCollection. - :attr List[EndpointGateway] endpoint_gateways: Collection of endpoint gateways. - :attr EndpointGatewayCollectionFirst first: A link to the first page of + :attr FlowLogCollectorCollectionFirst first: A link to the first page of resources. + :attr List[FlowLogCollector] flow_log_collectors: Collection of flow log + collectors. :attr int limit: The maximum number of resources that can be returned by the request. - :attr EndpointGatewayCollectionNext next: (optional) A link to the next page of + :attr FlowLogCollectorCollectionNext next: (optional) A link to the next page of resources. This property is present for all pages except the last page. :attr int total_count: The total number of resources across all pages. """ def __init__(self, - endpoint_gateways: List['EndpointGateway'], - first: 'EndpointGatewayCollectionFirst', + first: 'FlowLogCollectorCollectionFirst', + flow_log_collectors: List['FlowLogCollector'], limit: int, total_count: int, *, - next: 'EndpointGatewayCollectionNext' = None) -> None: + next: 'FlowLogCollectorCollectionNext' = None) -> None: """ - Initialize a EndpointGatewayCollection object. + Initialize a FlowLogCollectorCollection object. - :param List[EndpointGateway] endpoint_gateways: Collection of endpoint - gateways. - :param EndpointGatewayCollectionFirst first: A link to the first page of + :param FlowLogCollectorCollectionFirst first: A link to the first page of resources. + :param List[FlowLogCollector] flow_log_collectors: Collection of flow log + collectors. :param int limit: The maximum number of resources that can be returned by the request. :param int total_count: The total number of resources across all pages. - :param EndpointGatewayCollectionNext next: (optional) A link to the next + :param FlowLogCollectorCollectionNext next: (optional) A link to the next page of resources. This property is present for all pages except the last page. """ - self.endpoint_gateways = endpoint_gateways self.first = first + self.flow_log_collectors = flow_log_collectors self.limit = limit self.next = next self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'EndpointGatewayCollection': - """Initialize a EndpointGatewayCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'FlowLogCollectorCollection': + """Initialize a FlowLogCollectorCollection object from a json dictionary.""" args = {} - if 'endpoint_gateways' in _dict: - args['endpoint_gateways'] = [EndpointGateway.from_dict(x) for x in _dict.get('endpoint_gateways')] - else: - raise ValueError('Required property \'endpoint_gateways\' not present in EndpointGatewayCollection JSON') if 'first' in _dict: - args['first'] = EndpointGatewayCollectionFirst.from_dict(_dict.get('first')) + args['first'] = FlowLogCollectorCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'first\' not present in EndpointGatewayCollection JSON') + raise ValueError('Required property \'first\' not present in FlowLogCollectorCollection JSON') + if 'flow_log_collectors' in _dict: + args['flow_log_collectors'] = [FlowLogCollector.from_dict(x) for x in _dict.get('flow_log_collectors')] + else: + raise ValueError('Required property \'flow_log_collectors\' not present in FlowLogCollectorCollection JSON') if 'limit' in _dict: args['limit'] = _dict.get('limit') else: - raise ValueError('Required property \'limit\' not present in EndpointGatewayCollection JSON') + raise ValueError('Required property \'limit\' not present in FlowLogCollectorCollection JSON') if 'next' in _dict: - args['next'] = EndpointGatewayCollectionNext.from_dict(_dict.get('next')) + args['next'] = FlowLogCollectorCollectionNext.from_dict(_dict.get('next')) if 'total_count' in _dict: args['total_count'] = _dict.get('total_count') else: - raise ValueError('Required property \'total_count\' not present in EndpointGatewayCollection JSON') + raise ValueError('Required property \'total_count\' not present in FlowLogCollectorCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a EndpointGatewayCollection object from a json dictionary.""" + """Initialize a FlowLogCollectorCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'endpoint_gateways') and self.endpoint_gateways is not None: - _dict['endpoint_gateways'] = [x.to_dict() for x in self.endpoint_gateways] if hasattr(self, 'first') and self.first is not None: _dict['first'] = self.first.to_dict() + if hasattr(self, 'flow_log_collectors') and self.flow_log_collectors is not None: + _dict['flow_log_collectors'] = [x.to_dict() for x in self.flow_log_collectors] if hasattr(self, 'limit') and self.limit is not None: _dict['limit'] = self.limit if hasattr(self, 'next') and self.next is not None: @@ -24472,20 +28735,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this EndpointGatewayCollection object.""" + """Return a `str` version of this FlowLogCollectorCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'EndpointGatewayCollection') -> bool: + def __eq__(self, other: 'FlowLogCollectorCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'EndpointGatewayCollection') -> bool: + def __ne__(self, other: 'FlowLogCollectorCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class EndpointGatewayCollectionFirst(): +class FlowLogCollectorCollectionFirst(): """ A link to the first page of resources. @@ -24495,25 +28758,25 @@ class EndpointGatewayCollectionFirst(): def __init__(self, href: str) -> None: """ - Initialize a EndpointGatewayCollectionFirst object. + Initialize a FlowLogCollectorCollectionFirst object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'EndpointGatewayCollectionFirst': - """Initialize a EndpointGatewayCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'FlowLogCollectorCollectionFirst': + """Initialize a FlowLogCollectorCollectionFirst object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in EndpointGatewayCollectionFirst JSON') + raise ValueError('Required property \'href\' not present in FlowLogCollectorCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a EndpointGatewayCollectionFirst object from a json dictionary.""" + """Initialize a FlowLogCollectorCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -24528,20 +28791,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this EndpointGatewayCollectionFirst object.""" + """Return a `str` version of this FlowLogCollectorCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'EndpointGatewayCollectionFirst') -> bool: + def __eq__(self, other: 'FlowLogCollectorCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'EndpointGatewayCollectionFirst') -> bool: + def __ne__(self, other: 'FlowLogCollectorCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class EndpointGatewayCollectionNext(): +class FlowLogCollectorCollectionNext(): """ A link to the next page of resources. This property is present for all pages except the last page. @@ -24552,25 +28815,25 @@ class EndpointGatewayCollectionNext(): def __init__(self, href: str) -> None: """ - Initialize a EndpointGatewayCollectionNext object. + Initialize a FlowLogCollectorCollectionNext object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'EndpointGatewayCollectionNext': - """Initialize a EndpointGatewayCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'FlowLogCollectorCollectionNext': + """Initialize a FlowLogCollectorCollectionNext object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in EndpointGatewayCollectionNext JSON') + raise ValueError('Required property \'href\' not present in FlowLogCollectorCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a EndpointGatewayCollectionNext object from a json dictionary.""" + """Initialize a FlowLogCollectorCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -24585,114 +28848,68 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this EndpointGatewayCollectionNext object.""" + """Return a `str` version of this FlowLogCollectorCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'EndpointGatewayCollectionNext') -> bool: + def __eq__(self, other: 'FlowLogCollectorCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'EndpointGatewayCollectionNext') -> bool: + def __ne__(self, other: 'FlowLogCollectorCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class EndpointGatewayPatch(): +class FlowLogCollectorPatch(): """ - EndpointGatewayPatch. + FlowLogCollectorPatch. - :attr str name: (optional) The user-defined name for this endpoint gateway. - Names must be unique within the VPC this endpoint gateway is serving. + :attr bool active: (optional) Indicates whether this collector is active. + Updating to false deactivates the collector and updating to true activates the + collector. + :attr str name: (optional) The unique user-defined name for this flow log + collector. """ def __init__(self, *, + active: bool = None, name: str = None) -> None: """ - Initialize a EndpointGatewayPatch object. + Initialize a FlowLogCollectorPatch object. - :param str name: (optional) The user-defined name for this endpoint - gateway. Names must be unique within the VPC this endpoint gateway is - serving. + :param bool active: (optional) Indicates whether this collector is active. + Updating to false deactivates the collector and updating to true activates + the collector. + :param str name: (optional) The unique user-defined name for this flow log + collector. """ + self.active = active self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'EndpointGatewayPatch': - """Initialize a EndpointGatewayPatch object from a json dictionary.""" - args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a EndpointGatewayPatch object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this EndpointGatewayPatch object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'EndpointGatewayPatch') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'EndpointGatewayPatch') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - -class EndpointGatewayReferenceDeleted(): - """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. - - :attr str more_info: Link to documentation about deleted resources. - """ - - def __init__(self, - more_info: str) -> None: - """ - Initialize a EndpointGatewayReferenceDeleted object. - - :param str more_info: Link to documentation about deleted resources. - """ - self.more_info = more_info - - @classmethod - def from_dict(cls, _dict: Dict) -> 'EndpointGatewayReferenceDeleted': - """Initialize a EndpointGatewayReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'FlowLogCollectorPatch': + """Initialize a FlowLogCollectorPatch object from a json dictionary.""" args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') - else: - raise ValueError('Required property \'more_info\' not present in EndpointGatewayReferenceDeleted JSON') + if 'active' in _dict: + args['active'] = _dict.get('active') + if 'name' in _dict: + args['name'] = _dict.get('name') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a EndpointGatewayReferenceDeleted object from a json dictionary.""" + """Initialize a FlowLogCollectorPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'active') and self.active is not None: + _dict['active'] = self.active + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -24700,242 +28917,272 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this EndpointGatewayReferenceDeleted object.""" + """Return a `str` version of this FlowLogCollectorPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'EndpointGatewayReferenceDeleted') -> bool: + def __eq__(self, other: 'FlowLogCollectorPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'EndpointGatewayReferenceDeleted') -> bool: + def __ne__(self, other: 'FlowLogCollectorPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class EndpointGatewayReservedIP(): +class FlowLogCollectorTarget(): """ - A reserved IP to bind to the endpoint gateway. This can be specified using an existing - reserved IP, or a prototype object for a new reserved IP. The reserved IP will be - bound to the endpoint gateway to function as a virtual private endpoint for the - service. + The target this collector is collecting flow logs for. If the target is an instance, + subnet, or VPC, flow logs will not be collected for any network interfaces within the + target that are themselves the target of a more specific flow log collector. """ def __init__(self) -> None: """ - Initialize a EndpointGatewayReservedIP object. + Initialize a FlowLogCollectorTarget object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['EndpointGatewayReservedIPReservedIPIdentity', 'EndpointGatewayReservedIPReservedIPPrototypeTargetContext'])) + ", ".join(['FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext', 'FlowLogCollectorTargetInstanceReference', 'FlowLogCollectorTargetSubnetReference', 'FlowLogCollectorTargetVPCReference'])) raise Exception(msg) -class EndpointGatewayTarget(): +class FlowLogCollectorTargetPrototype(): """ - The target for this endpoint gateway. + The target this collector will collect flow logs for. If the target is an instance, + subnet, or VPC, flow logs will not be collected for any network interfaces within the + target that are themselves the target of a more specific flow log collector. """ def __init__(self) -> None: """ - Initialize a EndpointGatewayTarget object. + Initialize a FlowLogCollectorTargetPrototype object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['EndpointGatewayTargetProviderCloudServiceReference', 'EndpointGatewayTargetProviderInfrastructureServiceReference'])) + ", ".join(['FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity', 'FlowLogCollectorTargetPrototypeInstanceIdentity', 'FlowLogCollectorTargetPrototypeSubnetIdentity', 'FlowLogCollectorTargetPrototypeVPCIdentity'])) raise Exception(msg) -class EndpointGatewayTargetPrototype(): +class GenericResourceReferenceDeleted(): """ - The target for this endpoint gateway. + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. - :attr str resource_type: The type of target for this endpoint gateway. + :attr str more_info: Link to documentation about deleted resources. """ def __init__(self, - resource_type: str) -> None: + more_info: str) -> None: """ - Initialize a EndpointGatewayTargetPrototype object. + Initialize a GenericResourceReferenceDeleted object. - :param str resource_type: The type of target for this endpoint gateway. + :param str more_info: Link to documentation about deleted resources. """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['EndpointGatewayTargetPrototypeProviderCloudServiceIdentity', 'EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity'])) - raise Exception(msg) + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'EndpointGatewayTargetPrototype': - """Initialize a EndpointGatewayTargetPrototype object from a json dictionary.""" - disc_class = cls._get_class_by_discriminator(_dict) - if disc_class != cls: - return disc_class.from_dict(_dict) - msg = ("Cannot convert dictionary into an instance of base class 'EndpointGatewayTargetPrototype'. " + - "The discriminator value should map to a valid subclass: {1}").format( - ", ".join(['EndpointGatewayTargetPrototypeProviderCloudServiceIdentity', 'EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity'])) - raise Exception(msg) + def from_dict(cls, _dict: Dict) -> 'GenericResourceReferenceDeleted': + """Initialize a GenericResourceReferenceDeleted object from a json dictionary.""" + args = {} + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') + else: + raise ValueError('Required property \'more_info\' not present in GenericResourceReferenceDeleted JSON') + return cls(**args) @classmethod - def _from_dict(cls, _dict: Dict): - """Initialize a EndpointGatewayTargetPrototype object from a json dictionary.""" + def _from_dict(cls, _dict): + """Initialize a GenericResourceReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) - @classmethod - def _get_class_by_discriminator(cls, _dict: Dict) -> object: - mapping = {} - mapping['provider_cloud_service'] = 'EndpointGatewayTargetPrototypeProviderCloudServiceIdentity' - mapping['provider_infrastructure_service'] = 'EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity' - disc_value = _dict.get('resource_type') - if disc_value is None: - raise ValueError('Discriminator property \'resource_type\' not found in EndpointGatewayTargetPrototype JSON') - class_name = mapping.get(disc_value, disc_value) - try: - disc_class = getattr(sys.modules[__name__], class_name) - except AttributeError: - disc_class = cls - if isinstance(disc_class, object): - return disc_class - raise TypeError('%s is not a discriminator class' % class_name) + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info + return _dict - class ResourceTypeEnum(str, Enum): - """ - The type of target for this endpoint gateway. - """ - PROVIDER_CLOUD_SERVICE = 'provider_cloud_service' - PROVIDER_INFRASTRUCTURE_SERVICE = 'provider_infrastructure_service' + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + def __str__(self) -> str: + """Return a `str` version of this GenericResourceReferenceDeleted object.""" + return json.dumps(self.to_dict(), indent=2) -class FloatingIP(): + def __eq__(self, other: 'GenericResourceReferenceDeleted') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'GenericResourceReferenceDeleted') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class IKEPolicy(): """ - FloatingIP. + IKEPolicy. - :attr str address: The globally unique IP address. - :attr datetime created_at: The date and time that the floating IP was created. - :attr str crn: The CRN for this floating IP. - :attr str href: The URL for this floating IP. - :attr str id: The unique identifier for this floating IP. - :attr str name: The unique user-defined name for this floating IP. - :attr ResourceGroupReference resource_group: The resource group for this - floating IP. - :attr str status: The status of the floating IP. - :attr FloatingIPTarget target: (optional) The target of this floating IP. - :attr ZoneReference zone: The zone this floating IP resides in. + :attr str authentication_algorithm: The authentication algorithm. + :attr List[VPNGatewayConnectionReference] connections: The VPN gateway + connections that use this IKE policy. + :attr datetime created_at: The date and time that this IKE policy was created. + :attr int dh_group: The Diffie-Hellman group. + :attr str encryption_algorithm: The encryption algorithm. + :attr str href: The IKE policy's canonical URL. + :attr str id: The unique identifier for this IKE policy. + :attr int ike_version: The IKE protocol version. + :attr int key_lifetime: The key lifetime in seconds. + :attr str name: The user-defined name for this IKE policy. + :attr str negotiation_mode: The IKE negotiation mode. Only `main` is supported. + :attr ResourceGroupReference resource_group: The resource group for this IKE + policy. + :attr str resource_type: The resource type. """ def __init__(self, - address: str, + authentication_algorithm: str, + connections: List['VPNGatewayConnectionReference'], created_at: datetime, - crn: str, + dh_group: int, + encryption_algorithm: str, href: str, id: str, + ike_version: int, + key_lifetime: int, name: str, + negotiation_mode: str, resource_group: 'ResourceGroupReference', - status: str, - zone: 'ZoneReference', - *, - target: 'FloatingIPTarget' = None) -> None: + resource_type: str) -> None: """ - Initialize a FloatingIP object. + Initialize a IKEPolicy object. - :param str address: The globally unique IP address. - :param datetime created_at: The date and time that the floating IP was + :param str authentication_algorithm: The authentication algorithm. + :param List[VPNGatewayConnectionReference] connections: The VPN gateway + connections that use this IKE policy. + :param datetime created_at: The date and time that this IKE policy was created. - :param str crn: The CRN for this floating IP. - :param str href: The URL for this floating IP. - :param str id: The unique identifier for this floating IP. - :param str name: The unique user-defined name for this floating IP. + :param int dh_group: The Diffie-Hellman group. + :param str encryption_algorithm: The encryption algorithm. + :param str href: The IKE policy's canonical URL. + :param str id: The unique identifier for this IKE policy. + :param int ike_version: The IKE protocol version. + :param int key_lifetime: The key lifetime in seconds. + :param str name: The user-defined name for this IKE policy. + :param str negotiation_mode: The IKE negotiation mode. Only `main` is + supported. :param ResourceGroupReference resource_group: The resource group for this - floating IP. - :param str status: The status of the floating IP. - :param ZoneReference zone: The zone this floating IP resides in. - :param FloatingIPTarget target: (optional) The target of this floating IP. + IKE policy. + :param str resource_type: The resource type. """ - self.address = address + self.authentication_algorithm = authentication_algorithm + self.connections = connections self.created_at = created_at - self.crn = crn + self.dh_group = dh_group + self.encryption_algorithm = encryption_algorithm self.href = href self.id = id + self.ike_version = ike_version + self.key_lifetime = key_lifetime self.name = name + self.negotiation_mode = negotiation_mode self.resource_group = resource_group - self.status = status - self.target = target - self.zone = zone + self.resource_type = resource_type @classmethod - def from_dict(cls, _dict: Dict) -> 'FloatingIP': - """Initialize a FloatingIP object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'IKEPolicy': + """Initialize a IKEPolicy object from a json dictionary.""" args = {} - if 'address' in _dict: - args['address'] = _dict.get('address') + if 'authentication_algorithm' in _dict: + args['authentication_algorithm'] = _dict.get('authentication_algorithm') else: - raise ValueError('Required property \'address\' not present in FloatingIP JSON') + raise ValueError('Required property \'authentication_algorithm\' not present in IKEPolicy JSON') + if 'connections' in _dict: + args['connections'] = [VPNGatewayConnectionReference.from_dict(x) for x in _dict.get('connections')] + else: + raise ValueError('Required property \'connections\' not present in IKEPolicy JSON') if 'created_at' in _dict: args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError('Required property \'created_at\' not present in FloatingIP JSON') - if 'crn' in _dict: - args['crn'] = _dict.get('crn') + raise ValueError('Required property \'created_at\' not present in IKEPolicy JSON') + if 'dh_group' in _dict: + args['dh_group'] = _dict.get('dh_group') else: - raise ValueError('Required property \'crn\' not present in FloatingIP JSON') + raise ValueError('Required property \'dh_group\' not present in IKEPolicy JSON') + if 'encryption_algorithm' in _dict: + args['encryption_algorithm'] = _dict.get('encryption_algorithm') + else: + raise ValueError('Required property \'encryption_algorithm\' not present in IKEPolicy JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in FloatingIP JSON') + raise ValueError('Required property \'href\' not present in IKEPolicy JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in FloatingIP JSON') + raise ValueError('Required property \'id\' not present in IKEPolicy JSON') + if 'ike_version' in _dict: + args['ike_version'] = _dict.get('ike_version') + else: + raise ValueError('Required property \'ike_version\' not present in IKEPolicy JSON') + if 'key_lifetime' in _dict: + args['key_lifetime'] = _dict.get('key_lifetime') + else: + raise ValueError('Required property \'key_lifetime\' not present in IKEPolicy JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in FloatingIP JSON') + raise ValueError('Required property \'name\' not present in IKEPolicy JSON') + if 'negotiation_mode' in _dict: + args['negotiation_mode'] = _dict.get('negotiation_mode') + else: + raise ValueError('Required property \'negotiation_mode\' not present in IKEPolicy JSON') if 'resource_group' in _dict: args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) else: - raise ValueError('Required property \'resource_group\' not present in FloatingIP JSON') - if 'status' in _dict: - args['status'] = _dict.get('status') - else: - raise ValueError('Required property \'status\' not present in FloatingIP JSON') - if 'target' in _dict: - args['target'] = _dict.get('target') - if 'zone' in _dict: - args['zone'] = ZoneReference.from_dict(_dict.get('zone')) + raise ValueError('Required property \'resource_group\' not present in IKEPolicy JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') else: - raise ValueError('Required property \'zone\' not present in FloatingIP JSON') + raise ValueError('Required property \'resource_type\' not present in IKEPolicy JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a FloatingIP object from a json dictionary.""" + """Initialize a IKEPolicy object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'address') and self.address is not None: - _dict['address'] = self.address + if hasattr(self, 'authentication_algorithm') and self.authentication_algorithm is not None: + _dict['authentication_algorithm'] = self.authentication_algorithm + if hasattr(self, 'connections') and self.connections is not None: + _dict['connections'] = [x.to_dict() for x in self.connections] if hasattr(self, 'created_at') and self.created_at is not None: _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn + if hasattr(self, 'dh_group') and self.dh_group is not None: + _dict['dh_group'] = self.dh_group + if hasattr(self, 'encryption_algorithm') and self.encryption_algorithm is not None: + _dict['encryption_algorithm'] = self.encryption_algorithm if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id + if hasattr(self, 'ike_version') and self.ike_version is not None: + _dict['ike_version'] = self.ike_version + if hasattr(self, 'key_lifetime') and self.key_lifetime is not None: + _dict['key_lifetime'] = self.key_lifetime if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name + if hasattr(self, 'negotiation_mode') and self.negotiation_mode is not None: + _dict['negotiation_mode'] = self.negotiation_mode if hasattr(self, 'resource_group') and self.resource_group is not None: _dict['resource_group'] = self.resource_group.to_dict() - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status - if hasattr(self, 'target') and self.target is not None: - if isinstance(self.target, dict): - _dict['target'] = self.target - else: - _dict['target'] = self.target.to_dict() - if hasattr(self, 'zone') and self.zone is not None: - _dict['zone'] = self.zone.to_dict() + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type return _dict def _to_dict(self): @@ -24943,111 +29190,119 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this FloatingIP object.""" + """Return a `str` version of this IKEPolicy object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'FloatingIP') -> bool: + def __eq__(self, other: 'IKEPolicy') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'FloatingIP') -> bool: + def __ne__(self, other: 'IKEPolicy') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class StatusEnum(str, Enum): + class AuthenticationAlgorithmEnum(str, Enum): """ - The status of the floating IP. + The authentication algorithm. """ - AVAILABLE = 'available' - DELETING = 'deleting' - FAILED = 'failed' - PENDING = 'pending' + MD5 = 'md5' + SHA1 = 'sha1' + SHA256 = 'sha256' + SHA512 = 'sha512' -class FloatingIPByTargetNetworkInterfaceIdentity(): - """ - The network interface this floating IP is to be bound to. + class EncryptionAlgorithmEnum(str, Enum): + """ + The encryption algorithm. + """ + AES128 = 'aes128' + AES256 = 'aes256' + TRIPLE_DES = 'triple_des' - """ - def __init__(self) -> None: + class NegotiationModeEnum(str, Enum): """ - Initialize a FloatingIPByTargetNetworkInterfaceIdentity object. + The IKE negotiation mode. Only `main` is supported. + """ + MAIN = 'main' + + class ResourceTypeEnum(str, Enum): """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityById', 'FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref'])) - raise Exception(msg) + The resource type. + """ + IKE_POLICY = 'ike_policy' -class FloatingIPCollection(): + +class IKEPolicyCollection(): """ - FloatingIPCollection. + IKEPolicyCollection. - :attr FloatingIPCollectionFirst first: A link to the first page of resources. - :attr List[FloatingIP] floating_ips: Collection of floating IPs. + :attr IKEPolicyCollectionFirst first: A link to the first page of resources. + :attr List[IKEPolicy] ike_policies: Collection of IKE policies. :attr int limit: The maximum number of resources that can be returned by the request. - :attr FloatingIPCollectionNext next: (optional) A link to the next page of + :attr IKEPolicyCollectionNext next: (optional) A link to the next page of resources. This property is present for all pages except the last page. :attr int total_count: The total number of resources across all pages. """ def __init__(self, - first: 'FloatingIPCollectionFirst', - floating_ips: List['FloatingIP'], + first: 'IKEPolicyCollectionFirst', + ike_policies: List['IKEPolicy'], limit: int, total_count: int, *, - next: 'FloatingIPCollectionNext' = None) -> None: + next: 'IKEPolicyCollectionNext' = None) -> None: """ - Initialize a FloatingIPCollection object. + Initialize a IKEPolicyCollection object. - :param FloatingIPCollectionFirst first: A link to the first page of + :param IKEPolicyCollectionFirst first: A link to the first page of resources. - :param List[FloatingIP] floating_ips: Collection of floating IPs. + :param List[IKEPolicy] ike_policies: Collection of IKE policies. :param int limit: The maximum number of resources that can be returned by the request. :param int total_count: The total number of resources across all pages. - :param FloatingIPCollectionNext next: (optional) A link to the next page of + :param IKEPolicyCollectionNext next: (optional) A link to the next page of resources. This property is present for all pages except the last page. """ self.first = first - self.floating_ips = floating_ips + self.ike_policies = ike_policies self.limit = limit self.next = next self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'FloatingIPCollection': - """Initialize a FloatingIPCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'IKEPolicyCollection': + """Initialize a IKEPolicyCollection object from a json dictionary.""" args = {} if 'first' in _dict: - args['first'] = FloatingIPCollectionFirst.from_dict(_dict.get('first')) + args['first'] = IKEPolicyCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'first\' not present in FloatingIPCollection JSON') - if 'floating_ips' in _dict: - args['floating_ips'] = [FloatingIP.from_dict(x) for x in _dict.get('floating_ips')] + raise ValueError('Required property \'first\' not present in IKEPolicyCollection JSON') + if 'ike_policies' in _dict: + args['ike_policies'] = [IKEPolicy.from_dict(x) for x in _dict.get('ike_policies')] else: - raise ValueError('Required property \'floating_ips\' not present in FloatingIPCollection JSON') + raise ValueError('Required property \'ike_policies\' not present in IKEPolicyCollection JSON') if 'limit' in _dict: args['limit'] = _dict.get('limit') else: - raise ValueError('Required property \'limit\' not present in FloatingIPCollection JSON') + raise ValueError('Required property \'limit\' not present in IKEPolicyCollection JSON') if 'next' in _dict: - args['next'] = FloatingIPCollectionNext.from_dict(_dict.get('next')) + args['next'] = IKEPolicyCollectionNext.from_dict(_dict.get('next')) if 'total_count' in _dict: args['total_count'] = _dict.get('total_count') else: - raise ValueError('Required property \'total_count\' not present in FloatingIPCollection JSON') + raise ValueError('Required property \'total_count\' not present in IKEPolicyCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a FloatingIPCollection object from a json dictionary.""" + """Initialize a IKEPolicyCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -25055,8 +29310,8 @@ def to_dict(self) -> Dict: _dict = {} if hasattr(self, 'first') and self.first is not None: _dict['first'] = self.first.to_dict() - if hasattr(self, 'floating_ips') and self.floating_ips is not None: - _dict['floating_ips'] = [x.to_dict() for x in self.floating_ips] + if hasattr(self, 'ike_policies') and self.ike_policies is not None: + _dict['ike_policies'] = [x.to_dict() for x in self.ike_policies] if hasattr(self, 'limit') and self.limit is not None: _dict['limit'] = self.limit if hasattr(self, 'next') and self.next is not None: @@ -25070,20 +29325,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this FloatingIPCollection object.""" + """Return a `str` version of this IKEPolicyCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'FloatingIPCollection') -> bool: + def __eq__(self, other: 'IKEPolicyCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'FloatingIPCollection') -> bool: + def __ne__(self, other: 'IKEPolicyCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class FloatingIPCollectionFirst(): +class IKEPolicyCollectionFirst(): """ A link to the first page of resources. @@ -25093,25 +29348,25 @@ class FloatingIPCollectionFirst(): def __init__(self, href: str) -> None: """ - Initialize a FloatingIPCollectionFirst object. + Initialize a IKEPolicyCollectionFirst object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'FloatingIPCollectionFirst': - """Initialize a FloatingIPCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'IKEPolicyCollectionFirst': + """Initialize a IKEPolicyCollectionFirst object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in FloatingIPCollectionFirst JSON') + raise ValueError('Required property \'href\' not present in IKEPolicyCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a FloatingIPCollectionFirst object from a json dictionary.""" + """Initialize a IKEPolicyCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -25126,20 +29381,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this FloatingIPCollectionFirst object.""" + """Return a `str` version of this IKEPolicyCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'FloatingIPCollectionFirst') -> bool: + def __eq__(self, other: 'IKEPolicyCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'FloatingIPCollectionFirst') -> bool: + def __ne__(self, other: 'IKEPolicyCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class FloatingIPCollectionNext(): +class IKEPolicyCollectionNext(): """ A link to the next page of resources. This property is present for all pages except the last page. @@ -25150,25 +29405,25 @@ class FloatingIPCollectionNext(): def __init__(self, href: str) -> None: """ - Initialize a FloatingIPCollectionNext object. + Initialize a IKEPolicyCollectionNext object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'FloatingIPCollectionNext': - """Initialize a FloatingIPCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'IKEPolicyCollectionNext': + """Initialize a IKEPolicyCollectionNext object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in FloatingIPCollectionNext JSON') + raise ValueError('Required property \'href\' not present in IKEPolicyCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a FloatingIPCollectionNext object from a json dictionary.""" + """Initialize a IKEPolicyCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -25183,74 +29438,95 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this FloatingIPCollectionNext object.""" + """Return a `str` version of this IKEPolicyCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'FloatingIPCollectionNext') -> bool: + def __eq__(self, other: 'IKEPolicyCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'FloatingIPCollectionNext') -> bool: + def __ne__(self, other: 'IKEPolicyCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class FloatingIPPatch(): +class IKEPolicyPatch(): """ - FloatingIPPatch. + IKEPolicyPatch. - :attr str name: (optional) The unique user-defined name for this floating IP. - :attr FloatingIPTargetPatch target: (optional) The network interface to bind the - floating IP to, replacing any existing binding. For - this request to succeed, the floating IP must not be required by another - resource, such - as a public gateway. + :attr str authentication_algorithm: (optional) The authentication algorithm. + :attr int dh_group: (optional) The Diffie-Hellman group. + :attr str encryption_algorithm: (optional) The encryption algorithm. + :attr int ike_version: (optional) The IKE protocol version. + :attr int key_lifetime: (optional) The key lifetime in seconds. + :attr str name: (optional) The user-defined name for this IKE policy. """ def __init__(self, *, - name: str = None, - target: 'FloatingIPTargetPatch' = None) -> None: + authentication_algorithm: str = None, + dh_group: int = None, + encryption_algorithm: str = None, + ike_version: int = None, + key_lifetime: int = None, + name: str = None) -> None: """ - Initialize a FloatingIPPatch object. + Initialize a IKEPolicyPatch object. - :param str name: (optional) The unique user-defined name for this floating - IP. - :param FloatingIPTargetPatch target: (optional) The network interface to - bind the floating IP to, replacing any existing binding. For - this request to succeed, the floating IP must not be required by another - resource, such - as a public gateway. + :param str authentication_algorithm: (optional) The authentication + algorithm. + :param int dh_group: (optional) The Diffie-Hellman group. + :param str encryption_algorithm: (optional) The encryption algorithm. + :param int ike_version: (optional) The IKE protocol version. + :param int key_lifetime: (optional) The key lifetime in seconds. + :param str name: (optional) The user-defined name for this IKE policy. """ + self.authentication_algorithm = authentication_algorithm + self.dh_group = dh_group + self.encryption_algorithm = encryption_algorithm + self.ike_version = ike_version + self.key_lifetime = key_lifetime self.name = name - self.target = target @classmethod - def from_dict(cls, _dict: Dict) -> 'FloatingIPPatch': - """Initialize a FloatingIPPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'IKEPolicyPatch': + """Initialize a IKEPolicyPatch object from a json dictionary.""" args = {} + if 'authentication_algorithm' in _dict: + args['authentication_algorithm'] = _dict.get('authentication_algorithm') + if 'dh_group' in _dict: + args['dh_group'] = _dict.get('dh_group') + if 'encryption_algorithm' in _dict: + args['encryption_algorithm'] = _dict.get('encryption_algorithm') + if 'ike_version' in _dict: + args['ike_version'] = _dict.get('ike_version') + if 'key_lifetime' in _dict: + args['key_lifetime'] = _dict.get('key_lifetime') if 'name' in _dict: args['name'] = _dict.get('name') - if 'target' in _dict: - args['target'] = _dict.get('target') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a FloatingIPPatch object from a json dictionary.""" + """Initialize a IKEPolicyPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'target') and self.target is not None: - if isinstance(self.target, dict): - _dict['target'] = self.target - else: - _dict['target'] = self.target.to_dict() + if hasattr(self, 'authentication_algorithm') and self.authentication_algorithm is not None: + _dict['authentication_algorithm'] = self.authentication_algorithm + if hasattr(self, 'dh_group') and self.dh_group is not None: + _dict['dh_group'] = self.dh_group + if hasattr(self, 'encryption_algorithm') and self.encryption_algorithm is not None: + _dict['encryption_algorithm'] = self.encryption_algorithm + if hasattr(self, 'ike_version') and self.ike_version is not None: + _dict['ike_version'] = self.ike_version + if hasattr(self, 'key_lifetime') and self.key_lifetime is not None: + _dict['key_lifetime'] = self.key_lifetime + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -25258,130 +29534,107 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this FloatingIPPatch object.""" + """Return a `str` version of this IKEPolicyPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'FloatingIPPatch') -> bool: + def __eq__(self, other: 'IKEPolicyPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'FloatingIPPatch') -> bool: + def __ne__(self, other: 'IKEPolicyPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class FloatingIPPrototype(): - """ - FloatingIPPrototype. + class AuthenticationAlgorithmEnum(str, Enum): + """ + The authentication algorithm. + """ + MD5 = 'md5' + SHA1 = 'sha1' + SHA256 = 'sha256' + SHA512 = 'sha512' - :attr str name: (optional) The unique user-defined name for this floating IP. If - unspecified, the name will be a hyphenated list of randomly-selected words. - :attr ResourceGroupIdentity resource_group: (optional) The resource group to - use. If unspecified, the account's [default resource - group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - """ - def __init__(self, - *, - name: str = None, - resource_group: 'ResourceGroupIdentity' = None) -> None: + class EncryptionAlgorithmEnum(str, Enum): """ - Initialize a FloatingIPPrototype object. - - :param str name: (optional) The unique user-defined name for this floating - IP. If unspecified, the name will be a hyphenated list of randomly-selected - words. - :param ResourceGroupIdentity resource_group: (optional) The resource group - to use. If unspecified, the account's [default resource - group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is - used. + The encryption algorithm. """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['FloatingIPPrototypeFloatingIPByZone', 'FloatingIPPrototypeFloatingIPByTarget'])) - raise Exception(msg) + AES128 = 'aes128' + AES256 = 'aes256' + TRIPLE_DES = 'triple_des' -class FloatingIPReference(): + +class IKEPolicyReference(): """ - FloatingIPReference. + IKEPolicyReference. - :attr str address: The globally unique IP address. - :attr str crn: The CRN for this floating IP. - :attr FloatingIPReferenceDeleted deleted: (optional) If present, this property + :attr IKEPolicyReferenceDeleted deleted: (optional) If present, this property indicates the referenced resource has been deleted and provides some supplementary information. - :attr str href: The URL for this floating IP. - :attr str id: The unique identifier for this floating IP. - :attr str name: The unique user-defined name for this floating IP. + :attr str href: The IKE policy's canonical URL. + :attr str id: The unique identifier for this IKE policy. + :attr str name: The user-defined name for this IKE policy. + :attr str resource_type: The resource type. """ def __init__(self, - address: str, - crn: str, href: str, id: str, name: str, + resource_type: str, *, - deleted: 'FloatingIPReferenceDeleted' = None) -> None: + deleted: 'IKEPolicyReferenceDeleted' = None) -> None: """ - Initialize a FloatingIPReference object. + Initialize a IKEPolicyReference object. - :param str address: The globally unique IP address. - :param str crn: The CRN for this floating IP. - :param str href: The URL for this floating IP. - :param str id: The unique identifier for this floating IP. - :param str name: The unique user-defined name for this floating IP. - :param FloatingIPReferenceDeleted deleted: (optional) If present, this + :param str href: The IKE policy's canonical URL. + :param str id: The unique identifier for this IKE policy. + :param str name: The user-defined name for this IKE policy. + :param str resource_type: The resource type. + :param IKEPolicyReferenceDeleted deleted: (optional) If present, this property indicates the referenced resource has been deleted and provides some supplementary information. """ - self.address = address - self.crn = crn self.deleted = deleted self.href = href self.id = id self.name = name + self.resource_type = resource_type @classmethod - def from_dict(cls, _dict: Dict) -> 'FloatingIPReference': - """Initialize a FloatingIPReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'IKEPolicyReference': + """Initialize a IKEPolicyReference object from a json dictionary.""" args = {} - if 'address' in _dict: - args['address'] = _dict.get('address') - else: - raise ValueError('Required property \'address\' not present in FloatingIPReference JSON') - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in FloatingIPReference JSON') if 'deleted' in _dict: - args['deleted'] = FloatingIPReferenceDeleted.from_dict(_dict.get('deleted')) + args['deleted'] = IKEPolicyReferenceDeleted.from_dict(_dict.get('deleted')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in FloatingIPReference JSON') + raise ValueError('Required property \'href\' not present in IKEPolicyReference JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in FloatingIPReference JSON') + raise ValueError('Required property \'id\' not present in IKEPolicyReference JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in FloatingIPReference JSON') + raise ValueError('Required property \'name\' not present in IKEPolicyReference JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in IKEPolicyReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a FloatingIPReference object from a json dictionary.""" + """Initialize a IKEPolicyReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'address') and self.address is not None: - _dict['address'] = self.address - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn if hasattr(self, 'deleted') and self.deleted is not None: _dict['deleted'] = self.deleted.to_dict() if hasattr(self, 'href') and self.href is not None: @@ -25390,6 +29643,8 @@ def to_dict(self) -> Dict: _dict['id'] = self.id if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type return _dict def _to_dict(self): @@ -25397,20 +29652,27 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this FloatingIPReference object.""" + """Return a `str` version of this IKEPolicyReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'FloatingIPReference') -> bool: + def __eq__(self, other: 'IKEPolicyReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'FloatingIPReference') -> bool: + def __ne__(self, other: 'IKEPolicyReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class FloatingIPReferenceDeleted(): + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + IKE_POLICY = 'ike_policy' + + +class IKEPolicyReferenceDeleted(): """ If present, this property indicates the referenced resource has been deleted and provides some supplementary information. @@ -25421,25 +29683,25 @@ class FloatingIPReferenceDeleted(): def __init__(self, more_info: str) -> None: """ - Initialize a FloatingIPReferenceDeleted object. + Initialize a IKEPolicyReferenceDeleted object. :param str more_info: Link to documentation about deleted resources. """ self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'FloatingIPReferenceDeleted': - """Initialize a FloatingIPReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'IKEPolicyReferenceDeleted': + """Initialize a IKEPolicyReferenceDeleted object from a json dictionary.""" args = {} if 'more_info' in _dict: args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'more_info\' not present in FloatingIPReferenceDeleted JSON') + raise ValueError('Required property \'more_info\' not present in IKEPolicyReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a FloatingIPReferenceDeleted object from a json dictionary.""" + """Initialize a IKEPolicyReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -25454,87 +29716,64 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this FloatingIPReferenceDeleted object.""" + """Return a `str` version of this IKEPolicyReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'FloatingIPReferenceDeleted') -> bool: + def __eq__(self, other: 'IKEPolicyReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'FloatingIPReferenceDeleted') -> bool: + def __ne__(self, other: 'IKEPolicyReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class FloatingIPTarget(): - """ - The target of this floating IP. - - """ - - def __init__(self) -> None: - """ - Initialize a FloatingIPTarget object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['FloatingIPTargetNetworkInterfaceReference', 'FloatingIPTargetPublicGatewayReference'])) - raise Exception(msg) - -class FloatingIPTargetPatch(): - """ - The network interface to bind the floating IP to, replacing any existing binding. For - this request to succeed, the floating IP must not be required by another resource, - such as a public gateway. - - """ - - def __init__(self) -> None: - """ - Initialize a FloatingIPTargetPatch object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['FloatingIPTargetPatchNetworkInterfaceIdentityById', 'FloatingIPTargetPatchNetworkInterfaceIdentityByHref'])) - raise Exception(msg) - -class FloatingIPUnpaginatedCollection(): +class IP(): """ - FloatingIPUnpaginatedCollection. + IP. - :attr List[FloatingIP] floating_ips: Collection of floating IPs. + :attr str address: The IP address. + This property may add support for IPv6 addresses in the future. When processing + a value in this property, verify that the address is in an expected format. If + it is not, log an error. Optionally halt processing and surface the error, or + bypass the resource on which the unexpected IP address format was encountered. """ def __init__(self, - floating_ips: List['FloatingIP']) -> None: + address: str) -> None: """ - Initialize a FloatingIPUnpaginatedCollection object. + Initialize a IP object. - :param List[FloatingIP] floating_ips: Collection of floating IPs. + :param str address: The IP address. + This property may add support for IPv6 addresses in the future. When + processing a value in this property, verify that the address is in an + expected format. If it is not, log an error. Optionally halt processing and + surface the error, or bypass the resource on which the unexpected IP + address format was encountered. """ - self.floating_ips = floating_ips + self.address = address @classmethod - def from_dict(cls, _dict: Dict) -> 'FloatingIPUnpaginatedCollection': - """Initialize a FloatingIPUnpaginatedCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'IP': + """Initialize a IP object from a json dictionary.""" args = {} - if 'floating_ips' in _dict: - args['floating_ips'] = [FloatingIP.from_dict(x) for x in _dict.get('floating_ips')] + if 'address' in _dict: + args['address'] = _dict.get('address') else: - raise ValueError('Required property \'floating_ips\' not present in FloatingIPUnpaginatedCollection JSON') + raise ValueError('Required property \'address\' not present in IP JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a FloatingIPUnpaginatedCollection object from a json dictionary.""" + """Initialize a IP object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'floating_ips') and self.floating_ips is not None: - _dict['floating_ips'] = [x.to_dict() for x in self.floating_ips] + if hasattr(self, 'address') and self.address is not None: + _dict['address'] = self.address return _dict def _to_dict(self): @@ -25542,188 +29781,184 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this FloatingIPUnpaginatedCollection object.""" + """Return a `str` version of this IP object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'FloatingIPUnpaginatedCollection') -> bool: + def __eq__(self, other: 'IP') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'FloatingIPUnpaginatedCollection') -> bool: + def __ne__(self, other: 'IP') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class FlowLogCollector(): +class IPsecPolicy(): """ - FlowLogCollector. + IPsecPolicy. - :attr bool active: Indicates whether this collector is active. - :attr bool auto_delete: Indicates whether this flow log collector will be - automatically deleted when `target` is deleted. At present, this is always - `true`, but may be modifiable in the future. - :attr datetime created_at: The date and time that the flow log collector was - created. - :attr str crn: The CRN for this flow log collector. - :attr str href: The URL for this flow log collector. - :attr str id: The unique identifier for this flow log collector. - :attr str lifecycle_state: The lifecycle state of the flow log collector. - :attr str name: The unique user-defined name for this flow log collector. - :attr ResourceGroupReference resource_group: The resource group for this flow - log collector. - :attr LegacyCloudObjectStorageBucketReference storage_bucket: The Cloud Object - Storage bucket where the collected flows are logged. - :attr FlowLogCollectorTarget target: The target this collector is collecting - flow logs for. If the target is an instance, - subnet, or VPC, flow logs will not be collected for any network interfaces - within the - target that are themselves the target of a more specific flow log collector. - :attr VPCReference vpc: The VPC this flow log collector is associated with. + :attr str authentication_algorithm: The authentication algorithm. + :attr List[VPNGatewayConnectionReference] connections: The VPN gateway + connections that use this IPsec policy. + :attr datetime created_at: The date and time that this IPsec policy was created. + :attr str encapsulation_mode: The encapsulation mode used. Only `tunnel` is + supported. + :attr str encryption_algorithm: The encryption algorithm. + :attr str href: The IPsec policy's canonical URL. + :attr str id: The unique identifier for this IPsec policy. + :attr int key_lifetime: The key lifetime in seconds. + :attr str name: The user-defined name for this IPsec policy. + :attr str pfs: Perfect Forward Secrecy. + :attr ResourceGroupReference resource_group: The resource group for this IPsec + policy. + :attr str resource_type: The resource type. + :attr str transform_protocol: The transform protocol used. Only `esp` is + supported. """ def __init__(self, - active: bool, - auto_delete: bool, + authentication_algorithm: str, + connections: List['VPNGatewayConnectionReference'], created_at: datetime, - crn: str, + encapsulation_mode: str, + encryption_algorithm: str, href: str, id: str, - lifecycle_state: str, + key_lifetime: int, name: str, + pfs: str, resource_group: 'ResourceGroupReference', - storage_bucket: 'LegacyCloudObjectStorageBucketReference', - target: 'FlowLogCollectorTarget', - vpc: 'VPCReference') -> None: + resource_type: str, + transform_protocol: str) -> None: """ - Initialize a FlowLogCollector object. + Initialize a IPsecPolicy object. - :param bool active: Indicates whether this collector is active. - :param bool auto_delete: Indicates whether this flow log collector will be - automatically deleted when `target` is deleted. At present, this is always - `true`, but may be modifiable in the future. - :param datetime created_at: The date and time that the flow log collector - was created. - :param str crn: The CRN for this flow log collector. - :param str href: The URL for this flow log collector. - :param str id: The unique identifier for this flow log collector. - :param str lifecycle_state: The lifecycle state of the flow log collector. - :param str name: The unique user-defined name for this flow log collector. + :param str authentication_algorithm: The authentication algorithm. + :param List[VPNGatewayConnectionReference] connections: The VPN gateway + connections that use this IPsec policy. + :param datetime created_at: The date and time that this IPsec policy was + created. + :param str encapsulation_mode: The encapsulation mode used. Only `tunnel` + is supported. + :param str encryption_algorithm: The encryption algorithm. + :param str href: The IPsec policy's canonical URL. + :param str id: The unique identifier for this IPsec policy. + :param int key_lifetime: The key lifetime in seconds. + :param str name: The user-defined name for this IPsec policy. + :param str pfs: Perfect Forward Secrecy. :param ResourceGroupReference resource_group: The resource group for this - flow log collector. - :param LegacyCloudObjectStorageBucketReference storage_bucket: The Cloud - Object Storage bucket where the collected flows are logged. - :param FlowLogCollectorTarget target: The target this collector is - collecting flow logs for. If the target is an instance, - subnet, or VPC, flow logs will not be collected for any network interfaces - within the - target that are themselves the target of a more specific flow log - collector. - :param VPCReference vpc: The VPC this flow log collector is associated - with. + IPsec policy. + :param str resource_type: The resource type. + :param str transform_protocol: The transform protocol used. Only `esp` is + supported. """ - self.active = active - self.auto_delete = auto_delete + self.authentication_algorithm = authentication_algorithm + self.connections = connections self.created_at = created_at - self.crn = crn + self.encapsulation_mode = encapsulation_mode + self.encryption_algorithm = encryption_algorithm self.href = href self.id = id - self.lifecycle_state = lifecycle_state + self.key_lifetime = key_lifetime self.name = name + self.pfs = pfs self.resource_group = resource_group - self.storage_bucket = storage_bucket - self.target = target - self.vpc = vpc + self.resource_type = resource_type + self.transform_protocol = transform_protocol @classmethod - def from_dict(cls, _dict: Dict) -> 'FlowLogCollector': - """Initialize a FlowLogCollector object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'IPsecPolicy': + """Initialize a IPsecPolicy object from a json dictionary.""" args = {} - if 'active' in _dict: - args['active'] = _dict.get('active') + if 'authentication_algorithm' in _dict: + args['authentication_algorithm'] = _dict.get('authentication_algorithm') else: - raise ValueError('Required property \'active\' not present in FlowLogCollector JSON') - if 'auto_delete' in _dict: - args['auto_delete'] = _dict.get('auto_delete') + raise ValueError('Required property \'authentication_algorithm\' not present in IPsecPolicy JSON') + if 'connections' in _dict: + args['connections'] = [VPNGatewayConnectionReference.from_dict(x) for x in _dict.get('connections')] else: - raise ValueError('Required property \'auto_delete\' not present in FlowLogCollector JSON') + raise ValueError('Required property \'connections\' not present in IPsecPolicy JSON') if 'created_at' in _dict: args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError('Required property \'created_at\' not present in FlowLogCollector JSON') - if 'crn' in _dict: - args['crn'] = _dict.get('crn') + raise ValueError('Required property \'created_at\' not present in IPsecPolicy JSON') + if 'encapsulation_mode' in _dict: + args['encapsulation_mode'] = _dict.get('encapsulation_mode') else: - raise ValueError('Required property \'crn\' not present in FlowLogCollector JSON') + raise ValueError('Required property \'encapsulation_mode\' not present in IPsecPolicy JSON') + if 'encryption_algorithm' in _dict: + args['encryption_algorithm'] = _dict.get('encryption_algorithm') + else: + raise ValueError('Required property \'encryption_algorithm\' not present in IPsecPolicy JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in FlowLogCollector JSON') + raise ValueError('Required property \'href\' not present in IPsecPolicy JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in FlowLogCollector JSON') - if 'lifecycle_state' in _dict: - args['lifecycle_state'] = _dict.get('lifecycle_state') + raise ValueError('Required property \'id\' not present in IPsecPolicy JSON') + if 'key_lifetime' in _dict: + args['key_lifetime'] = _dict.get('key_lifetime') else: - raise ValueError('Required property \'lifecycle_state\' not present in FlowLogCollector JSON') + raise ValueError('Required property \'key_lifetime\' not present in IPsecPolicy JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in FlowLogCollector JSON') + raise ValueError('Required property \'name\' not present in IPsecPolicy JSON') + if 'pfs' in _dict: + args['pfs'] = _dict.get('pfs') + else: + raise ValueError('Required property \'pfs\' not present in IPsecPolicy JSON') if 'resource_group' in _dict: args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) else: - raise ValueError('Required property \'resource_group\' not present in FlowLogCollector JSON') - if 'storage_bucket' in _dict: - args['storage_bucket'] = LegacyCloudObjectStorageBucketReference.from_dict(_dict.get('storage_bucket')) - else: - raise ValueError('Required property \'storage_bucket\' not present in FlowLogCollector JSON') - if 'target' in _dict: - args['target'] = _dict.get('target') + raise ValueError('Required property \'resource_group\' not present in IPsecPolicy JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') else: - raise ValueError('Required property \'target\' not present in FlowLogCollector JSON') - if 'vpc' in _dict: - args['vpc'] = VPCReference.from_dict(_dict.get('vpc')) + raise ValueError('Required property \'resource_type\' not present in IPsecPolicy JSON') + if 'transform_protocol' in _dict: + args['transform_protocol'] = _dict.get('transform_protocol') else: - raise ValueError('Required property \'vpc\' not present in FlowLogCollector JSON') + raise ValueError('Required property \'transform_protocol\' not present in IPsecPolicy JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a FlowLogCollector object from a json dictionary.""" + """Initialize a IPsecPolicy object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'active') and self.active is not None: - _dict['active'] = self.active - if hasattr(self, 'auto_delete') and self.auto_delete is not None: - _dict['auto_delete'] = self.auto_delete + if hasattr(self, 'authentication_algorithm') and self.authentication_algorithm is not None: + _dict['authentication_algorithm'] = self.authentication_algorithm + if hasattr(self, 'connections') and self.connections is not None: + _dict['connections'] = [x.to_dict() for x in self.connections] if hasattr(self, 'created_at') and self.created_at is not None: _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn + if hasattr(self, 'encapsulation_mode') and self.encapsulation_mode is not None: + _dict['encapsulation_mode'] = self.encapsulation_mode + if hasattr(self, 'encryption_algorithm') and self.encryption_algorithm is not None: + _dict['encryption_algorithm'] = self.encryption_algorithm if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id - if hasattr(self, 'lifecycle_state') and self.lifecycle_state is not None: - _dict['lifecycle_state'] = self.lifecycle_state + if hasattr(self, 'key_lifetime') and self.key_lifetime is not None: + _dict['key_lifetime'] = self.key_lifetime if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name + if hasattr(self, 'pfs') and self.pfs is not None: + _dict['pfs'] = self.pfs if hasattr(self, 'resource_group') and self.resource_group is not None: _dict['resource_group'] = self.resource_group.to_dict() - if hasattr(self, 'storage_bucket') and self.storage_bucket is not None: - _dict['storage_bucket'] = self.storage_bucket.to_dict() - if hasattr(self, 'target') and self.target is not None: - if isinstance(self.target, dict): - _dict['target'] = self.target - else: - _dict['target'] = self.target.to_dict() - if hasattr(self, 'vpc') and self.vpc is not None: - _dict['vpc'] = self.vpc.to_dict() + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + if hasattr(self, 'transform_protocol') and self.transform_protocol is not None: + _dict['transform_protocol'] = self.transform_protocol return _dict def _to_dict(self): @@ -25731,102 +29966,137 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this FlowLogCollector object.""" + """Return a `str` version of this IPsecPolicy object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'FlowLogCollector') -> bool: + def __eq__(self, other: 'IPsecPolicy') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'FlowLogCollector') -> bool: + def __ne__(self, other: 'IPsecPolicy') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class LifecycleStateEnum(str, Enum): + class AuthenticationAlgorithmEnum(str, Enum): """ - The lifecycle state of the flow log collector. + The authentication algorithm. """ - DELETING = 'deleting' - FAILED = 'failed' - PENDING = 'pending' - STABLE = 'stable' - SUSPENDED = 'suspended' - UPDATING = 'updating' - WAITING = 'waiting' + MD5 = 'md5' + SHA1 = 'sha1' + SHA256 = 'sha256' + SHA512 = 'sha512' -class FlowLogCollectorCollection(): + class EncapsulationModeEnum(str, Enum): + """ + The encapsulation mode used. Only `tunnel` is supported. + """ + TUNNEL = 'tunnel' + + + class EncryptionAlgorithmEnum(str, Enum): + """ + The encryption algorithm. + """ + AES128 = 'aes128' + AES256 = 'aes256' + TRIPLE_DES = 'triple_des' + + + class PfsEnum(str, Enum): + """ + Perfect Forward Secrecy. + """ + DISABLED = 'disabled' + GROUP_14 = 'group_14' + GROUP_19 = 'group_19' + GROUP_2 = 'group_2' + GROUP_5 = 'group_5' + + + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + IPSEC_POLICY = 'ipsec_policy' + + + class TransformProtocolEnum(str, Enum): + """ + The transform protocol used. Only `esp` is supported. + """ + ESP = 'esp' + + +class IPsecPolicyCollection(): """ - FlowLogCollectorCollection. + IPsecPolicyCollection. - :attr FlowLogCollectorCollectionFirst first: A link to the first page of - resources. - :attr List[FlowLogCollector] flow_log_collectors: Collection of flow log - collectors. + :attr IPsecPolicyCollectionFirst first: A link to the first page of resources. + :attr List[IPsecPolicy] ipsec_policies: Collection of IPsec policies. :attr int limit: The maximum number of resources that can be returned by the request. - :attr FlowLogCollectorCollectionNext next: (optional) A link to the next page of + :attr IPsecPolicyCollectionNext next: (optional) A link to the next page of resources. This property is present for all pages except the last page. :attr int total_count: The total number of resources across all pages. """ def __init__(self, - first: 'FlowLogCollectorCollectionFirst', - flow_log_collectors: List['FlowLogCollector'], + first: 'IPsecPolicyCollectionFirst', + ipsec_policies: List['IPsecPolicy'], limit: int, total_count: int, *, - next: 'FlowLogCollectorCollectionNext' = None) -> None: + next: 'IPsecPolicyCollectionNext' = None) -> None: """ - Initialize a FlowLogCollectorCollection object. + Initialize a IPsecPolicyCollection object. - :param FlowLogCollectorCollectionFirst first: A link to the first page of + :param IPsecPolicyCollectionFirst first: A link to the first page of resources. - :param List[FlowLogCollector] flow_log_collectors: Collection of flow log - collectors. + :param List[IPsecPolicy] ipsec_policies: Collection of IPsec policies. :param int limit: The maximum number of resources that can be returned by the request. :param int total_count: The total number of resources across all pages. - :param FlowLogCollectorCollectionNext next: (optional) A link to the next - page of resources. This property is present for all pages + :param IPsecPolicyCollectionNext next: (optional) A link to the next page + of resources. This property is present for all pages except the last page. """ self.first = first - self.flow_log_collectors = flow_log_collectors + self.ipsec_policies = ipsec_policies self.limit = limit self.next = next self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'FlowLogCollectorCollection': - """Initialize a FlowLogCollectorCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'IPsecPolicyCollection': + """Initialize a IPsecPolicyCollection object from a json dictionary.""" args = {} if 'first' in _dict: - args['first'] = FlowLogCollectorCollectionFirst.from_dict(_dict.get('first')) + args['first'] = IPsecPolicyCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'first\' not present in FlowLogCollectorCollection JSON') - if 'flow_log_collectors' in _dict: - args['flow_log_collectors'] = [FlowLogCollector.from_dict(x) for x in _dict.get('flow_log_collectors')] + raise ValueError('Required property \'first\' not present in IPsecPolicyCollection JSON') + if 'ipsec_policies' in _dict: + args['ipsec_policies'] = [IPsecPolicy.from_dict(x) for x in _dict.get('ipsec_policies')] else: - raise ValueError('Required property \'flow_log_collectors\' not present in FlowLogCollectorCollection JSON') + raise ValueError('Required property \'ipsec_policies\' not present in IPsecPolicyCollection JSON') if 'limit' in _dict: args['limit'] = _dict.get('limit') else: - raise ValueError('Required property \'limit\' not present in FlowLogCollectorCollection JSON') + raise ValueError('Required property \'limit\' not present in IPsecPolicyCollection JSON') if 'next' in _dict: - args['next'] = FlowLogCollectorCollectionNext.from_dict(_dict.get('next')) + args['next'] = IPsecPolicyCollectionNext.from_dict(_dict.get('next')) if 'total_count' in _dict: args['total_count'] = _dict.get('total_count') else: - raise ValueError('Required property \'total_count\' not present in FlowLogCollectorCollection JSON') + raise ValueError('Required property \'total_count\' not present in IPsecPolicyCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a FlowLogCollectorCollection object from a json dictionary.""" + """Initialize a IPsecPolicyCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -25834,8 +30104,8 @@ def to_dict(self) -> Dict: _dict = {} if hasattr(self, 'first') and self.first is not None: _dict['first'] = self.first.to_dict() - if hasattr(self, 'flow_log_collectors') and self.flow_log_collectors is not None: - _dict['flow_log_collectors'] = [x.to_dict() for x in self.flow_log_collectors] + if hasattr(self, 'ipsec_policies') and self.ipsec_policies is not None: + _dict['ipsec_policies'] = [x.to_dict() for x in self.ipsec_policies] if hasattr(self, 'limit') and self.limit is not None: _dict['limit'] = self.limit if hasattr(self, 'next') and self.next is not None: @@ -25849,20 +30119,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this FlowLogCollectorCollection object.""" + """Return a `str` version of this IPsecPolicyCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'FlowLogCollectorCollection') -> bool: + def __eq__(self, other: 'IPsecPolicyCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'FlowLogCollectorCollection') -> bool: + def __ne__(self, other: 'IPsecPolicyCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class FlowLogCollectorCollectionFirst(): +class IPsecPolicyCollectionFirst(): """ A link to the first page of resources. @@ -25872,25 +30142,25 @@ class FlowLogCollectorCollectionFirst(): def __init__(self, href: str) -> None: """ - Initialize a FlowLogCollectorCollectionFirst object. + Initialize a IPsecPolicyCollectionFirst object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'FlowLogCollectorCollectionFirst': - """Initialize a FlowLogCollectorCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'IPsecPolicyCollectionFirst': + """Initialize a IPsecPolicyCollectionFirst object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in FlowLogCollectorCollectionFirst JSON') + raise ValueError('Required property \'href\' not present in IPsecPolicyCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a FlowLogCollectorCollectionFirst object from a json dictionary.""" + """Initialize a IPsecPolicyCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -25905,20 +30175,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this FlowLogCollectorCollectionFirst object.""" + """Return a `str` version of this IPsecPolicyCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'FlowLogCollectorCollectionFirst') -> bool: + def __eq__(self, other: 'IPsecPolicyCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'FlowLogCollectorCollectionFirst') -> bool: + def __ne__(self, other: 'IPsecPolicyCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class FlowLogCollectorCollectionNext(): +class IPsecPolicyCollectionNext(): """ A link to the next page of resources. This property is present for all pages except the last page. @@ -25929,25 +30199,25 @@ class FlowLogCollectorCollectionNext(): def __init__(self, href: str) -> None: """ - Initialize a FlowLogCollectorCollectionNext object. + Initialize a IPsecPolicyCollectionNext object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'FlowLogCollectorCollectionNext': - """Initialize a FlowLogCollectorCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'IPsecPolicyCollectionNext': + """Initialize a IPsecPolicyCollectionNext object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in FlowLogCollectorCollectionNext JSON') + raise ValueError('Required property \'href\' not present in IPsecPolicyCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a FlowLogCollectorCollectionNext object from a json dictionary.""" + """Initialize a IPsecPolicyCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -25962,68 +30232,87 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this FlowLogCollectorCollectionNext object.""" + """Return a `str` version of this IPsecPolicyCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'FlowLogCollectorCollectionNext') -> bool: + def __eq__(self, other: 'IPsecPolicyCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'FlowLogCollectorCollectionNext') -> bool: + def __ne__(self, other: 'IPsecPolicyCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class FlowLogCollectorPatch(): +class IPsecPolicyPatch(): """ - FlowLogCollectorPatch. + IPsecPolicyPatch. - :attr bool active: (optional) Indicates whether this collector is active. - Updating to false deactivates the collector and updating to true activates the - collector. - :attr str name: (optional) The unique user-defined name for this flow log - collector. + :attr str authentication_algorithm: (optional) The authentication algorithm. + :attr str encryption_algorithm: (optional) The encryption algorithm. + :attr int key_lifetime: (optional) The key lifetime in seconds. + :attr str name: (optional) The user-defined name for this IPsec policy. + :attr str pfs: (optional) Perfect Forward Secrecy. """ def __init__(self, *, - active: bool = None, - name: str = None) -> None: + authentication_algorithm: str = None, + encryption_algorithm: str = None, + key_lifetime: int = None, + name: str = None, + pfs: str = None) -> None: """ - Initialize a FlowLogCollectorPatch object. + Initialize a IPsecPolicyPatch object. - :param bool active: (optional) Indicates whether this collector is active. - Updating to false deactivates the collector and updating to true activates - the collector. - :param str name: (optional) The unique user-defined name for this flow log - collector. + :param str authentication_algorithm: (optional) The authentication + algorithm. + :param str encryption_algorithm: (optional) The encryption algorithm. + :param int key_lifetime: (optional) The key lifetime in seconds. + :param str name: (optional) The user-defined name for this IPsec policy. + :param str pfs: (optional) Perfect Forward Secrecy. """ - self.active = active + self.authentication_algorithm = authentication_algorithm + self.encryption_algorithm = encryption_algorithm + self.key_lifetime = key_lifetime self.name = name + self.pfs = pfs @classmethod - def from_dict(cls, _dict: Dict) -> 'FlowLogCollectorPatch': - """Initialize a FlowLogCollectorPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'IPsecPolicyPatch': + """Initialize a IPsecPolicyPatch object from a json dictionary.""" args = {} - if 'active' in _dict: - args['active'] = _dict.get('active') + if 'authentication_algorithm' in _dict: + args['authentication_algorithm'] = _dict.get('authentication_algorithm') + if 'encryption_algorithm' in _dict: + args['encryption_algorithm'] = _dict.get('encryption_algorithm') + if 'key_lifetime' in _dict: + args['key_lifetime'] = _dict.get('key_lifetime') if 'name' in _dict: args['name'] = _dict.get('name') + if 'pfs' in _dict: + args['pfs'] = _dict.get('pfs') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a FlowLogCollectorPatch object from a json dictionary.""" + """Initialize a IPsecPolicyPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'active') and self.active is not None: - _dict['active'] = self.active + if hasattr(self, 'authentication_algorithm') and self.authentication_algorithm is not None: + _dict['authentication_algorithm'] = self.authentication_algorithm + if hasattr(self, 'encryption_algorithm') and self.encryption_algorithm is not None: + _dict['encryption_algorithm'] = self.encryption_algorithm + if hasattr(self, 'key_lifetime') and self.key_lifetime is not None: + _dict['key_lifetime'] = self.key_lifetime if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name + if hasattr(self, 'pfs') and self.pfs is not None: + _dict['pfs'] = self.pfs return _dict def _to_dict(self): @@ -26031,54 +30320,156 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this FlowLogCollectorPatch object.""" + """Return a `str` version of this IPsecPolicyPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'FlowLogCollectorPatch') -> bool: + def __eq__(self, other: 'IPsecPolicyPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'FlowLogCollectorPatch') -> bool: + def __ne__(self, other: 'IPsecPolicyPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class FlowLogCollectorTarget(): - """ - The target this collector is collecting flow logs for. If the target is an instance, - subnet, or VPC, flow logs will not be collected for any network interfaces within the - target that are themselves the target of a more specific flow log collector. + class AuthenticationAlgorithmEnum(str, Enum): + """ + The authentication algorithm. + """ + MD5 = 'md5' + SHA1 = 'sha1' + SHA256 = 'sha256' + SHA512 = 'sha512' - """ - def __init__(self) -> None: + class EncryptionAlgorithmEnum(str, Enum): """ - Initialize a FlowLogCollectorTarget object. + The encryption algorithm. + """ + AES128 = 'aes128' + AES256 = 'aes256' + TRIPLE_DES = 'triple_des' + + class PfsEnum(str, Enum): """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext', 'FlowLogCollectorTargetInstanceReference', 'FlowLogCollectorTargetSubnetReference', 'FlowLogCollectorTargetVPCReference'])) - raise Exception(msg) + Perfect Forward Secrecy. + """ + DISABLED = 'disabled' + GROUP_14 = 'group_14' + GROUP_19 = 'group_19' + GROUP_2 = 'group_2' + GROUP_5 = 'group_5' -class FlowLogCollectorTargetPrototype(): + +class IPsecPolicyReference(): """ - The target this collector will collect flow logs for. If the target is an instance, - subnet, or VPC, flow logs will not be collected for any network interfaces within the - target that are themselves the target of a more specific flow log collector. + IPsecPolicyReference. + :attr IPsecPolicyReferenceDeleted deleted: (optional) If present, this property + indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str href: The IPsec policy's canonical URL. + :attr str id: The unique identifier for this IPsec policy. + :attr str name: The user-defined name for this IPsec policy. + :attr str resource_type: The resource type. """ - def __init__(self) -> None: + def __init__(self, + href: str, + id: str, + name: str, + resource_type: str, + *, + deleted: 'IPsecPolicyReferenceDeleted' = None) -> None: """ - Initialize a FlowLogCollectorTargetPrototype object. + Initialize a IPsecPolicyReference object. + :param str href: The IPsec policy's canonical URL. + :param str id: The unique identifier for this IPsec policy. + :param str name: The user-defined name for this IPsec policy. + :param str resource_type: The resource type. + :param IPsecPolicyReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides + some supplementary information. """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity', 'FlowLogCollectorTargetPrototypeInstanceIdentity', 'FlowLogCollectorTargetPrototypeSubnetIdentity', 'FlowLogCollectorTargetPrototypeVPCIdentity'])) - raise Exception(msg) + self.deleted = deleted + self.href = href + self.id = id + self.name = name + self.resource_type = resource_type -class GenericResourceReferenceDeleted(): + @classmethod + def from_dict(cls, _dict: Dict) -> 'IPsecPolicyReference': + """Initialize a IPsecPolicyReference object from a json dictionary.""" + args = {} + if 'deleted' in _dict: + args['deleted'] = IPsecPolicyReferenceDeleted.from_dict(_dict.get('deleted')) + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in IPsecPolicyReference JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in IPsecPolicyReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in IPsecPolicyReference JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in IPsecPolicyReference JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a IPsecPolicyReference object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this IPsecPolicyReference object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'IPsecPolicyReference') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'IPsecPolicyReference') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + IPSEC_POLICY = 'ipsec_policy' + + +class IPsecPolicyReferenceDeleted(): """ If present, this property indicates the referenced resource has been deleted and provides some supplementary information. @@ -26089,25 +30480,25 @@ class GenericResourceReferenceDeleted(): def __init__(self, more_info: str) -> None: """ - Initialize a GenericResourceReferenceDeleted object. + Initialize a IPsecPolicyReferenceDeleted object. :param str more_info: Link to documentation about deleted resources. """ self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'GenericResourceReferenceDeleted': - """Initialize a GenericResourceReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'IPsecPolicyReferenceDeleted': + """Initialize a IPsecPolicyReferenceDeleted object from a json dictionary.""" args = {} if 'more_info' in _dict: args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'more_info\' not present in GenericResourceReferenceDeleted JSON') + raise ValueError('Required property \'more_info\' not present in IPsecPolicyReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a GenericResourceReferenceDeleted object from a json dictionary.""" + """Initialize a IPsecPolicyReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -26122,181 +30513,256 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this GenericResourceReferenceDeleted object.""" + """Return a `str` version of this IPsecPolicyReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'GenericResourceReferenceDeleted') -> bool: + def __eq__(self, other: 'IPsecPolicyReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'GenericResourceReferenceDeleted') -> bool: + def __ne__(self, other: 'IPsecPolicyReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class IKEPolicy(): +class Image(): """ - IKEPolicy. + Image. - :attr str authentication_algorithm: The authentication algorithm. - :attr List[VPNGatewayConnectionReference] connections: The VPN gateway - connections that use this IKE policy. - :attr datetime created_at: The date and time that this IKE policy was created. - :attr int dh_group: The Diffie-Hellman group. - :attr str encryption_algorithm: The encryption algorithm. - :attr str href: The IKE policy's canonical URL. - :attr str id: The unique identifier for this IKE policy. - :attr int ike_version: The IKE protocol version. - :attr int key_lifetime: The key lifetime in seconds. - :attr str name: The user-defined name for this IKE policy. - :attr str negotiation_mode: The IKE negotiation mode. Only `main` is supported. - :attr ResourceGroupReference resource_group: The resource group for this IKE - policy. - :attr str resource_type: The resource type. + :attr datetime created_at: The date and time that the image was created. + :attr str crn: The CRN for this image. + :attr str encryption: The type of encryption used on the image. + :attr EncryptionKeyReference encryption_key: (optional) The key that will be + used to encrypt volumes created from this image (unless an + alternate `encryption_key` is specified at volume creation). + This property will be present for images with an `encryption` type of + `user_managed`. + :attr ImageFile file: Details for the stored image file. + :attr str href: The URL for this image. + :attr str id: The unique identifier for this image. + :attr int minimum_provisioned_size: (optional) The minimum size (in gigabytes) + of a volume onto which this image may be provisioned. + This property may be absent if the image has a `status` of `pending`, + `tentative`, or + `failed`. + :attr str name: The user-defined or system-provided name for this image. + :attr OperatingSystem operating_system: (optional) The operating system included + in this image. + :attr ResourceGroupReference resource_group: The resource group for this image. + :attr VolumeReference source_volume: (optional) The volume used to create this + image (this may be + [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + If absent, this image was not created from a volume. + :attr str status: The status of this image + - available: image can be used (provisionable) + - deleting: image is being deleted, and can no longer be used to provision new + resources + - deprecated: image can be used, but is slated to become `obsolete` + (provisionable) + - failed: image is corrupt or did not pass validation + - obsolete: image can no longer be used to provision new resources + - pending: image is being imported and is not yet `available` + - tentative: image import has timed out (contact support) + - unusable: image cannot be used (see `status_reasons[]` for possible + remediation) + The enumerated values for this property are expected to expand in the future. + When processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the image on which the unexpected + property value was encountered. + :attr List[ImageStatusReason] status_reasons: The reasons for the current status + (if any). + The enumerated reason code values for this property will expand in the future. + When processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the resource on which the unexpected + reason code was encountered. + :attr str visibility: Whether the image is publicly visible or private to the + account. """ def __init__(self, - authentication_algorithm: str, - connections: List['VPNGatewayConnectionReference'], created_at: datetime, - dh_group: int, - encryption_algorithm: str, + crn: str, + encryption: str, + file: 'ImageFile', href: str, id: str, - ike_version: int, - key_lifetime: int, name: str, - negotiation_mode: str, resource_group: 'ResourceGroupReference', - resource_type: str) -> None: + status: str, + status_reasons: List['ImageStatusReason'], + visibility: str, + *, + encryption_key: 'EncryptionKeyReference' = None, + minimum_provisioned_size: int = None, + operating_system: 'OperatingSystem' = None, + source_volume: 'VolumeReference' = None) -> None: """ - Initialize a IKEPolicy object. + Initialize a Image object. - :param str authentication_algorithm: The authentication algorithm. - :param List[VPNGatewayConnectionReference] connections: The VPN gateway - connections that use this IKE policy. - :param datetime created_at: The date and time that this IKE policy was - created. - :param int dh_group: The Diffie-Hellman group. - :param str encryption_algorithm: The encryption algorithm. - :param str href: The IKE policy's canonical URL. - :param str id: The unique identifier for this IKE policy. - :param int ike_version: The IKE protocol version. - :param int key_lifetime: The key lifetime in seconds. - :param str name: The user-defined name for this IKE policy. - :param str negotiation_mode: The IKE negotiation mode. Only `main` is - supported. + :param datetime created_at: The date and time that the image was created. + :param str crn: The CRN for this image. + :param str encryption: The type of encryption used on the image. + :param ImageFile file: Details for the stored image file. + :param str href: The URL for this image. + :param str id: The unique identifier for this image. + :param str name: The user-defined or system-provided name for this image. :param ResourceGroupReference resource_group: The resource group for this - IKE policy. - :param str resource_type: The resource type. + image. + :param str status: The status of this image + - available: image can be used (provisionable) + - deleting: image is being deleted, and can no longer be used to provision + new + resources + - deprecated: image can be used, but is slated to become `obsolete` + (provisionable) + - failed: image is corrupt or did not pass validation + - obsolete: image can no longer be used to provision new resources + - pending: image is being imported and is not yet `available` + - tentative: image import has timed out (contact support) + - unusable: image cannot be used (see `status_reasons[]` for possible + remediation) + The enumerated values for this property are expected to expand in the + future. When processing this property, check for and log unknown values. + Optionally halt processing and surface the error, or bypass the image on + which the unexpected property value was encountered. + :param List[ImageStatusReason] status_reasons: The reasons for the current + status (if any). + The enumerated reason code values for this property will expand in the + future. When processing this property, check for and log unknown values. + Optionally halt processing and surface the error, or bypass the resource on + which the unexpected reason code was encountered. + :param str visibility: Whether the image is publicly visible or private to + the account. + :param EncryptionKeyReference encryption_key: (optional) The key that will + be used to encrypt volumes created from this image (unless an + alternate `encryption_key` is specified at volume creation). + This property will be present for images with an `encryption` type of + `user_managed`. + :param int minimum_provisioned_size: (optional) The minimum size (in + gigabytes) of a volume onto which this image may be provisioned. + This property may be absent if the image has a `status` of `pending`, + `tentative`, or + `failed`. + :param OperatingSystem operating_system: (optional) The operating system + included in this image. + :param VolumeReference source_volume: (optional) The volume used to create + this image (this may be + [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + If absent, this image was not created from a volume. """ - self.authentication_algorithm = authentication_algorithm - self.connections = connections self.created_at = created_at - self.dh_group = dh_group - self.encryption_algorithm = encryption_algorithm + self.crn = crn + self.encryption = encryption + self.encryption_key = encryption_key + self.file = file self.href = href self.id = id - self.ike_version = ike_version - self.key_lifetime = key_lifetime + self.minimum_provisioned_size = minimum_provisioned_size self.name = name - self.negotiation_mode = negotiation_mode + self.operating_system = operating_system self.resource_group = resource_group - self.resource_type = resource_type + self.source_volume = source_volume + self.status = status + self.status_reasons = status_reasons + self.visibility = visibility @classmethod - def from_dict(cls, _dict: Dict) -> 'IKEPolicy': - """Initialize a IKEPolicy object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'Image': + """Initialize a Image object from a json dictionary.""" args = {} - if 'authentication_algorithm' in _dict: - args['authentication_algorithm'] = _dict.get('authentication_algorithm') - else: - raise ValueError('Required property \'authentication_algorithm\' not present in IKEPolicy JSON') - if 'connections' in _dict: - args['connections'] = [VPNGatewayConnectionReference.from_dict(x) for x in _dict.get('connections')] - else: - raise ValueError('Required property \'connections\' not present in IKEPolicy JSON') if 'created_at' in _dict: args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError('Required property \'created_at\' not present in IKEPolicy JSON') - if 'dh_group' in _dict: - args['dh_group'] = _dict.get('dh_group') + raise ValueError('Required property \'created_at\' not present in Image JSON') + if 'crn' in _dict: + args['crn'] = _dict.get('crn') else: - raise ValueError('Required property \'dh_group\' not present in IKEPolicy JSON') - if 'encryption_algorithm' in _dict: - args['encryption_algorithm'] = _dict.get('encryption_algorithm') + raise ValueError('Required property \'crn\' not present in Image JSON') + if 'encryption' in _dict: + args['encryption'] = _dict.get('encryption') + else: + raise ValueError('Required property \'encryption\' not present in Image JSON') + if 'encryption_key' in _dict: + args['encryption_key'] = EncryptionKeyReference.from_dict(_dict.get('encryption_key')) + if 'file' in _dict: + args['file'] = ImageFile.from_dict(_dict.get('file')) else: - raise ValueError('Required property \'encryption_algorithm\' not present in IKEPolicy JSON') + raise ValueError('Required property \'file\' not present in Image JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in IKEPolicy JSON') + raise ValueError('Required property \'href\' not present in Image JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in IKEPolicy JSON') - if 'ike_version' in _dict: - args['ike_version'] = _dict.get('ike_version') - else: - raise ValueError('Required property \'ike_version\' not present in IKEPolicy JSON') - if 'key_lifetime' in _dict: - args['key_lifetime'] = _dict.get('key_lifetime') - else: - raise ValueError('Required property \'key_lifetime\' not present in IKEPolicy JSON') + raise ValueError('Required property \'id\' not present in Image JSON') + if 'minimum_provisioned_size' in _dict: + args['minimum_provisioned_size'] = _dict.get('minimum_provisioned_size') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in IKEPolicy JSON') - if 'negotiation_mode' in _dict: - args['negotiation_mode'] = _dict.get('negotiation_mode') - else: - raise ValueError('Required property \'negotiation_mode\' not present in IKEPolicy JSON') + raise ValueError('Required property \'name\' not present in Image JSON') + if 'operating_system' in _dict: + args['operating_system'] = OperatingSystem.from_dict(_dict.get('operating_system')) if 'resource_group' in _dict: args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) else: - raise ValueError('Required property \'resource_group\' not present in IKEPolicy JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') + raise ValueError('Required property \'resource_group\' not present in Image JSON') + if 'source_volume' in _dict: + args['source_volume'] = VolumeReference.from_dict(_dict.get('source_volume')) + if 'status' in _dict: + args['status'] = _dict.get('status') else: - raise ValueError('Required property \'resource_type\' not present in IKEPolicy JSON') + raise ValueError('Required property \'status\' not present in Image JSON') + if 'status_reasons' in _dict: + args['status_reasons'] = [ImageStatusReason.from_dict(x) for x in _dict.get('status_reasons')] + else: + raise ValueError('Required property \'status_reasons\' not present in Image JSON') + if 'visibility' in _dict: + args['visibility'] = _dict.get('visibility') + else: + raise ValueError('Required property \'visibility\' not present in Image JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a IKEPolicy object from a json dictionary.""" + """Initialize a Image object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'authentication_algorithm') and self.authentication_algorithm is not None: - _dict['authentication_algorithm'] = self.authentication_algorithm - if hasattr(self, 'connections') and self.connections is not None: - _dict['connections'] = [x.to_dict() for x in self.connections] if hasattr(self, 'created_at') and self.created_at is not None: _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'dh_group') and self.dh_group is not None: - _dict['dh_group'] = self.dh_group - if hasattr(self, 'encryption_algorithm') and self.encryption_algorithm is not None: - _dict['encryption_algorithm'] = self.encryption_algorithm + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'encryption') and self.encryption is not None: + _dict['encryption'] = self.encryption + if hasattr(self, 'encryption_key') and self.encryption_key is not None: + _dict['encryption_key'] = self.encryption_key.to_dict() + if hasattr(self, 'file') and self.file is not None: + _dict['file'] = self.file.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id - if hasattr(self, 'ike_version') and self.ike_version is not None: - _dict['ike_version'] = self.ike_version - if hasattr(self, 'key_lifetime') and self.key_lifetime is not None: - _dict['key_lifetime'] = self.key_lifetime + if hasattr(self, 'minimum_provisioned_size') and self.minimum_provisioned_size is not None: + _dict['minimum_provisioned_size'] = self.minimum_provisioned_size if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'negotiation_mode') and self.negotiation_mode is not None: - _dict['negotiation_mode'] = self.negotiation_mode + if hasattr(self, 'operating_system') and self.operating_system is not None: + _dict['operating_system'] = self.operating_system.to_dict() if hasattr(self, 'resource_group') and self.resource_group is not None: _dict['resource_group'] = self.resource_group.to_dict() - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type + if hasattr(self, 'source_volume') and self.source_volume is not None: + _dict['source_volume'] = self.source_volume.to_dict() + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'status_reasons') and self.status_reasons is not None: + _dict['status_reasons'] = [x.to_dict() for x in self.status_reasons] + if hasattr(self, 'visibility') and self.visibility is not None: + _dict['visibility'] = self.visibility return _dict def _to_dict(self): @@ -26304,119 +30770,120 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this IKEPolicy object.""" + """Return a `str` version of this Image object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'IKEPolicy') -> bool: + def __eq__(self, other: 'Image') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'IKEPolicy') -> bool: + def __ne__(self, other: 'Image') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class AuthenticationAlgorithmEnum(str, Enum): - """ - The authentication algorithm. - """ - MD5 = 'md5' - SHA1 = 'sha1' - SHA256 = 'sha256' - SHA512 = 'sha512' - - - class EncryptionAlgorithmEnum(str, Enum): + class EncryptionEnum(str, Enum): """ - The encryption algorithm. + The type of encryption used on the image. """ - AES128 = 'aes128' - AES256 = 'aes256' - TRIPLE_DES = 'triple_des' + NONE = 'none' + USER_MANAGED = 'user_managed' - class NegotiationModeEnum(str, Enum): + class StatusEnum(str, Enum): """ - The IKE negotiation mode. Only `main` is supported. + The status of this image + - available: image can be used (provisionable) + - deleting: image is being deleted, and can no longer be used to provision new + resources + - deprecated: image can be used, but is slated to become `obsolete` + (provisionable) + - failed: image is corrupt or did not pass validation + - obsolete: image can no longer be used to provision new resources + - pending: image is being imported and is not yet `available` + - tentative: image import has timed out (contact support) + - unusable: image cannot be used (see `status_reasons[]` for possible remediation) + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the image on which the unexpected + property value was encountered. """ - MAIN = 'main' + AVAILABLE = 'available' + DELETING = 'deleting' + DEPRECATED = 'deprecated' + FAILED = 'failed' + PENDING = 'pending' + TENTATIVE = 'tentative' + UNUSABLE = 'unusable' - class ResourceTypeEnum(str, Enum): + class VisibilityEnum(str, Enum): """ - The resource type. + Whether the image is publicly visible or private to the account. """ - IKE_POLICY = 'ike_policy' + PRIVATE = 'private' + PUBLIC = 'public' -class IKEPolicyCollection(): +class ImageCollection(): """ - IKEPolicyCollection. + ImageCollection. - :attr IKEPolicyCollectionFirst first: A link to the first page of resources. - :attr List[IKEPolicy] ike_policies: Collection of IKE policies. + :attr ImageCollectionFirst first: A link to the first page of resources. + :attr List[Image] images: Collection of images. :attr int limit: The maximum number of resources that can be returned by the request. - :attr IKEPolicyCollectionNext next: (optional) A link to the next page of - resources. This property is present for all pages + :attr ImageCollectionNext next: (optional) A link to the next page of resources. + This property is present for all pages except the last page. - :attr int total_count: The total number of resources across all pages. """ def __init__(self, - first: 'IKEPolicyCollectionFirst', - ike_policies: List['IKEPolicy'], + first: 'ImageCollectionFirst', + images: List['Image'], limit: int, - total_count: int, *, - next: 'IKEPolicyCollectionNext' = None) -> None: + next: 'ImageCollectionNext' = None) -> None: """ - Initialize a IKEPolicyCollection object. + Initialize a ImageCollection object. - :param IKEPolicyCollectionFirst first: A link to the first page of - resources. - :param List[IKEPolicy] ike_policies: Collection of IKE policies. + :param ImageCollectionFirst first: A link to the first page of resources. + :param List[Image] images: Collection of images. :param int limit: The maximum number of resources that can be returned by the request. - :param int total_count: The total number of resources across all pages. - :param IKEPolicyCollectionNext next: (optional) A link to the next page of + :param ImageCollectionNext next: (optional) A link to the next page of resources. This property is present for all pages except the last page. """ self.first = first - self.ike_policies = ike_policies + self.images = images self.limit = limit self.next = next - self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'IKEPolicyCollection': - """Initialize a IKEPolicyCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ImageCollection': + """Initialize a ImageCollection object from a json dictionary.""" args = {} if 'first' in _dict: - args['first'] = IKEPolicyCollectionFirst.from_dict(_dict.get('first')) + args['first'] = ImageCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'first\' not present in IKEPolicyCollection JSON') - if 'ike_policies' in _dict: - args['ike_policies'] = [IKEPolicy.from_dict(x) for x in _dict.get('ike_policies')] + raise ValueError('Required property \'first\' not present in ImageCollection JSON') + if 'images' in _dict: + args['images'] = [Image.from_dict(x) for x in _dict.get('images')] else: - raise ValueError('Required property \'ike_policies\' not present in IKEPolicyCollection JSON') + raise ValueError('Required property \'images\' not present in ImageCollection JSON') if 'limit' in _dict: args['limit'] = _dict.get('limit') else: - raise ValueError('Required property \'limit\' not present in IKEPolicyCollection JSON') + raise ValueError('Required property \'limit\' not present in ImageCollection JSON') if 'next' in _dict: - args['next'] = IKEPolicyCollectionNext.from_dict(_dict.get('next')) - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') - else: - raise ValueError('Required property \'total_count\' not present in IKEPolicyCollection JSON') + args['next'] = ImageCollectionNext.from_dict(_dict.get('next')) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a IKEPolicyCollection object from a json dictionary.""" + """Initialize a ImageCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -26424,14 +30891,12 @@ def to_dict(self) -> Dict: _dict = {} if hasattr(self, 'first') and self.first is not None: _dict['first'] = self.first.to_dict() - if hasattr(self, 'ike_policies') and self.ike_policies is not None: - _dict['ike_policies'] = [x.to_dict() for x in self.ike_policies] + if hasattr(self, 'images') and self.images is not None: + _dict['images'] = [x.to_dict() for x in self.images] if hasattr(self, 'limit') and self.limit is not None: _dict['limit'] = self.limit if hasattr(self, 'next') and self.next is not None: _dict['next'] = self.next.to_dict() - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count return _dict def _to_dict(self): @@ -26439,20 +30904,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this IKEPolicyCollection object.""" + """Return a `str` version of this ImageCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'IKEPolicyCollection') -> bool: + def __eq__(self, other: 'ImageCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'IKEPolicyCollection') -> bool: + def __ne__(self, other: 'ImageCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class IKEPolicyCollectionFirst(): +class ImageCollectionFirst(): """ A link to the first page of resources. @@ -26462,25 +30927,25 @@ class IKEPolicyCollectionFirst(): def __init__(self, href: str) -> None: """ - Initialize a IKEPolicyCollectionFirst object. + Initialize a ImageCollectionFirst object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'IKEPolicyCollectionFirst': - """Initialize a IKEPolicyCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ImageCollectionFirst': + """Initialize a ImageCollectionFirst object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in IKEPolicyCollectionFirst JSON') + raise ValueError('Required property \'href\' not present in ImageCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a IKEPolicyCollectionFirst object from a json dictionary.""" + """Initialize a ImageCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -26495,20 +30960,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this IKEPolicyCollectionFirst object.""" + """Return a `str` version of this ImageCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'IKEPolicyCollectionFirst') -> bool: + def __eq__(self, other: 'ImageCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'IKEPolicyCollectionFirst') -> bool: + def __ne__(self, other: 'ImageCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class IKEPolicyCollectionNext(): +class ImageCollectionNext(): """ A link to the next page of resources. This property is present for all pages except the last page. @@ -26519,25 +30984,25 @@ class IKEPolicyCollectionNext(): def __init__(self, href: str) -> None: """ - Initialize a IKEPolicyCollectionNext object. + Initialize a ImageCollectionNext object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'IKEPolicyCollectionNext': - """Initialize a IKEPolicyCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ImageCollectionNext': + """Initialize a ImageCollectionNext object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in IKEPolicyCollectionNext JSON') + raise ValueError('Required property \'href\' not present in ImageCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a IKEPolicyCollectionNext object from a json dictionary.""" + """Initialize a ImageCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -26552,277 +31017,77 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this IKEPolicyCollectionNext object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'IKEPolicyCollectionNext') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'IKEPolicyCollectionNext') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - -class IKEPolicyPatch(): - """ - IKEPolicyPatch. - - :attr str authentication_algorithm: (optional) The authentication algorithm. - :attr int dh_group: (optional) The Diffie-Hellman group. - :attr str encryption_algorithm: (optional) The encryption algorithm. - :attr int ike_version: (optional) The IKE protocol version. - :attr int key_lifetime: (optional) The key lifetime in seconds. - :attr str name: (optional) The user-defined name for this IKE policy. - """ - - def __init__(self, - *, - authentication_algorithm: str = None, - dh_group: int = None, - encryption_algorithm: str = None, - ike_version: int = None, - key_lifetime: int = None, - name: str = None) -> None: - """ - Initialize a IKEPolicyPatch object. - - :param str authentication_algorithm: (optional) The authentication - algorithm. - :param int dh_group: (optional) The Diffie-Hellman group. - :param str encryption_algorithm: (optional) The encryption algorithm. - :param int ike_version: (optional) The IKE protocol version. - :param int key_lifetime: (optional) The key lifetime in seconds. - :param str name: (optional) The user-defined name for this IKE policy. - """ - self.authentication_algorithm = authentication_algorithm - self.dh_group = dh_group - self.encryption_algorithm = encryption_algorithm - self.ike_version = ike_version - self.key_lifetime = key_lifetime - self.name = name - - @classmethod - def from_dict(cls, _dict: Dict) -> 'IKEPolicyPatch': - """Initialize a IKEPolicyPatch object from a json dictionary.""" - args = {} - if 'authentication_algorithm' in _dict: - args['authentication_algorithm'] = _dict.get('authentication_algorithm') - if 'dh_group' in _dict: - args['dh_group'] = _dict.get('dh_group') - if 'encryption_algorithm' in _dict: - args['encryption_algorithm'] = _dict.get('encryption_algorithm') - if 'ike_version' in _dict: - args['ike_version'] = _dict.get('ike_version') - if 'key_lifetime' in _dict: - args['key_lifetime'] = _dict.get('key_lifetime') - if 'name' in _dict: - args['name'] = _dict.get('name') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a IKEPolicyPatch object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'authentication_algorithm') and self.authentication_algorithm is not None: - _dict['authentication_algorithm'] = self.authentication_algorithm - if hasattr(self, 'dh_group') and self.dh_group is not None: - _dict['dh_group'] = self.dh_group - if hasattr(self, 'encryption_algorithm') and self.encryption_algorithm is not None: - _dict['encryption_algorithm'] = self.encryption_algorithm - if hasattr(self, 'ike_version') and self.ike_version is not None: - _dict['ike_version'] = self.ike_version - if hasattr(self, 'key_lifetime') and self.key_lifetime is not None: - _dict['key_lifetime'] = self.key_lifetime - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this IKEPolicyPatch object.""" + """Return a `str` version of this ImageCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'IKEPolicyPatch') -> bool: + def __eq__(self, other: 'ImageCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'IKEPolicyPatch') -> bool: + def __ne__(self, other: 'ImageCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class AuthenticationAlgorithmEnum(str, Enum): - """ - The authentication algorithm. - """ - MD5 = 'md5' - SHA1 = 'sha1' - SHA256 = 'sha256' - SHA512 = 'sha512' - - - class EncryptionAlgorithmEnum(str, Enum): - """ - The encryption algorithm. - """ - AES128 = 'aes128' - AES256 = 'aes256' - TRIPLE_DES = 'triple_des' - - -class IKEPolicyReference(): +class ImageFile(): """ - IKEPolicyReference. + ImageFile. - :attr IKEPolicyReferenceDeleted deleted: (optional) If present, this property - indicates the referenced resource has been deleted and provides - some supplementary information. - :attr str href: The IKE policy's canonical URL. - :attr str id: The unique identifier for this IKE policy. - :attr str name: The user-defined name for this IKE policy. - :attr str resource_type: The resource type. + :attr ImageFileChecksums checksums: (optional) Checksums for this image file. + This property may be absent if the associated image has a `status` of `pending` + or + `failed`. + :attr int size: (optional) The size of the stored image file rounded up to the + next gigabyte. + This property may be absent if the associated image has a `status` of `pending` + or + `failed`. """ def __init__(self, - href: str, - id: str, - name: str, - resource_type: str, *, - deleted: 'IKEPolicyReferenceDeleted' = None) -> None: - """ - Initialize a IKEPolicyReference object. - - :param str href: The IKE policy's canonical URL. - :param str id: The unique identifier for this IKE policy. - :param str name: The user-defined name for this IKE policy. - :param str resource_type: The resource type. - :param IKEPolicyReferenceDeleted deleted: (optional) If present, this - property indicates the referenced resource has been deleted and provides - some supplementary information. - """ - self.deleted = deleted - self.href = href - self.id = id - self.name = name - self.resource_type = resource_type - - @classmethod - def from_dict(cls, _dict: Dict) -> 'IKEPolicyReference': - """Initialize a IKEPolicyReference object from a json dictionary.""" - args = {} - if 'deleted' in _dict: - args['deleted'] = IKEPolicyReferenceDeleted.from_dict(_dict.get('deleted')) - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in IKEPolicyReference JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in IKEPolicyReference JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in IKEPolicyReference JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in IKEPolicyReference JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a IKEPolicyReference object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this IKEPolicyReference object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'IKEPolicyReference') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'IKEPolicyReference') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - - class ResourceTypeEnum(str, Enum): - """ - The resource type. - """ - IKE_POLICY = 'ike_policy' - - -class IKEPolicyReferenceDeleted(): - """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. - - :attr str more_info: Link to documentation about deleted resources. - """ - - def __init__(self, - more_info: str) -> None: + checksums: 'ImageFileChecksums' = None, + size: int = None) -> None: """ - Initialize a IKEPolicyReferenceDeleted object. + Initialize a ImageFile object. - :param str more_info: Link to documentation about deleted resources. + :param ImageFileChecksums checksums: (optional) Checksums for this image + file. + This property may be absent if the associated image has a `status` of + `pending` or + `failed`. + :param int size: (optional) The size of the stored image file rounded up to + the next gigabyte. + This property may be absent if the associated image has a `status` of + `pending` or + `failed`. """ - self.more_info = more_info + self.checksums = checksums + self.size = size @classmethod - def from_dict(cls, _dict: Dict) -> 'IKEPolicyReferenceDeleted': - """Initialize a IKEPolicyReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ImageFile': + """Initialize a ImageFile object from a json dictionary.""" args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') - else: - raise ValueError('Required property \'more_info\' not present in IKEPolicyReferenceDeleted JSON') + if 'checksums' in _dict: + args['checksums'] = ImageFileChecksums.from_dict(_dict.get('checksums')) + if 'size' in _dict: + args['size'] = _dict.get('size') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a IKEPolicyReferenceDeleted object from a json dictionary.""" + """Initialize a ImageFile object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'checksums') and self.checksums is not None: + _dict['checksums'] = self.checksums.to_dict() + if hasattr(self, 'size') and self.size is not None: + _dict['size'] = self.size return _dict def _to_dict(self): @@ -26830,64 +31095,54 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this IKEPolicyReferenceDeleted object.""" + """Return a `str` version of this ImageFile object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'IKEPolicyReferenceDeleted') -> bool: + def __eq__(self, other: 'ImageFile') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'IKEPolicyReferenceDeleted') -> bool: + def __ne__(self, other: 'ImageFile') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class IP(): +class ImageFileChecksums(): """ - IP. + ImageFileChecksums. - :attr str address: The IP address. - This property may add support for IPv6 addresses in the future. When processing - a value in this property, verify that the address is in an expected format. If - it is not, log an error. Optionally halt processing and surface the error, or - bypass the resource on which the unexpected IP address format was encountered. + :attr str sha256: (optional) The SHA256 fingerprint of the image file. """ def __init__(self, - address: str) -> None: + *, + sha256: str = None) -> None: """ - Initialize a IP object. + Initialize a ImageFileChecksums object. - :param str address: The IP address. - This property may add support for IPv6 addresses in the future. When - processing a value in this property, verify that the address is in an - expected format. If it is not, log an error. Optionally halt processing and - surface the error, or bypass the resource on which the unexpected IP - address format was encountered. + :param str sha256: (optional) The SHA256 fingerprint of the image file. """ - self.address = address + self.sha256 = sha256 @classmethod - def from_dict(cls, _dict: Dict) -> 'IP': - """Initialize a IP object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ImageFileChecksums': + """Initialize a ImageFileChecksums object from a json dictionary.""" args = {} - if 'address' in _dict: - args['address'] = _dict.get('address') - else: - raise ValueError('Required property \'address\' not present in IP JSON') + if 'sha256' in _dict: + args['sha256'] = _dict.get('sha256') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a IP object from a json dictionary.""" + """Initialize a ImageFileChecksums object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'address') and self.address is not None: - _dict['address'] = self.address + if hasattr(self, 'sha256') and self.sha256 is not None: + _dict['sha256'] = self.sha256 return _dict def _to_dict(self): @@ -26895,184 +31150,55 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this IP object.""" + """Return a `str` version of this ImageFileChecksums object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'IP') -> bool: + def __eq__(self, other: 'ImageFileChecksums') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'IP') -> bool: + def __ne__(self, other: 'ImageFileChecksums') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class IPsecPolicy(): +class ImageFilePrototype(): """ - IPsecPolicy. + ImageFilePrototype. - :attr str authentication_algorithm: The authentication algorithm. - :attr List[VPNGatewayConnectionReference] connections: The VPN gateway - connections that use this IPsec policy. - :attr datetime created_at: The date and time that this IPsec policy was created. - :attr str encapsulation_mode: The encapsulation mode used. Only `tunnel` is - supported. - :attr str encryption_algorithm: The encryption algorithm. - :attr str href: The IPsec policy's canonical URL. - :attr str id: The unique identifier for this IPsec policy. - :attr int key_lifetime: The key lifetime in seconds. - :attr str name: The user-defined name for this IPsec policy. - :attr str pfs: Perfect Forward Secrecy. - :attr ResourceGroupReference resource_group: The resource group for this IPsec - policy. - :attr str resource_type: The resource type. - :attr str transform_protocol: The transform protocol used. Only `esp` is - supported. + :attr str href: The Cloud Object Storage location of the image file. """ def __init__(self, - authentication_algorithm: str, - connections: List['VPNGatewayConnectionReference'], - created_at: datetime, - encapsulation_mode: str, - encryption_algorithm: str, - href: str, - id: str, - key_lifetime: int, - name: str, - pfs: str, - resource_group: 'ResourceGroupReference', - resource_type: str, - transform_protocol: str) -> None: + href: str) -> None: """ - Initialize a IPsecPolicy object. + Initialize a ImageFilePrototype object. - :param str authentication_algorithm: The authentication algorithm. - :param List[VPNGatewayConnectionReference] connections: The VPN gateway - connections that use this IPsec policy. - :param datetime created_at: The date and time that this IPsec policy was - created. - :param str encapsulation_mode: The encapsulation mode used. Only `tunnel` - is supported. - :param str encryption_algorithm: The encryption algorithm. - :param str href: The IPsec policy's canonical URL. - :param str id: The unique identifier for this IPsec policy. - :param int key_lifetime: The key lifetime in seconds. - :param str name: The user-defined name for this IPsec policy. - :param str pfs: Perfect Forward Secrecy. - :param ResourceGroupReference resource_group: The resource group for this - IPsec policy. - :param str resource_type: The resource type. - :param str transform_protocol: The transform protocol used. Only `esp` is - supported. + :param str href: The Cloud Object Storage location of the image file. """ - self.authentication_algorithm = authentication_algorithm - self.connections = connections - self.created_at = created_at - self.encapsulation_mode = encapsulation_mode - self.encryption_algorithm = encryption_algorithm self.href = href - self.id = id - self.key_lifetime = key_lifetime - self.name = name - self.pfs = pfs - self.resource_group = resource_group - self.resource_type = resource_type - self.transform_protocol = transform_protocol @classmethod - def from_dict(cls, _dict: Dict) -> 'IPsecPolicy': - """Initialize a IPsecPolicy object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ImageFilePrototype': + """Initialize a ImageFilePrototype object from a json dictionary.""" args = {} - if 'authentication_algorithm' in _dict: - args['authentication_algorithm'] = _dict.get('authentication_algorithm') - else: - raise ValueError('Required property \'authentication_algorithm\' not present in IPsecPolicy JSON') - if 'connections' in _dict: - args['connections'] = [VPNGatewayConnectionReference.from_dict(x) for x in _dict.get('connections')] - else: - raise ValueError('Required property \'connections\' not present in IPsecPolicy JSON') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - else: - raise ValueError('Required property \'created_at\' not present in IPsecPolicy JSON') - if 'encapsulation_mode' in _dict: - args['encapsulation_mode'] = _dict.get('encapsulation_mode') - else: - raise ValueError('Required property \'encapsulation_mode\' not present in IPsecPolicy JSON') - if 'encryption_algorithm' in _dict: - args['encryption_algorithm'] = _dict.get('encryption_algorithm') - else: - raise ValueError('Required property \'encryption_algorithm\' not present in IPsecPolicy JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in IPsecPolicy JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in IPsecPolicy JSON') - if 'key_lifetime' in _dict: - args['key_lifetime'] = _dict.get('key_lifetime') - else: - raise ValueError('Required property \'key_lifetime\' not present in IPsecPolicy JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in IPsecPolicy JSON') - if 'pfs' in _dict: - args['pfs'] = _dict.get('pfs') - else: - raise ValueError('Required property \'pfs\' not present in IPsecPolicy JSON') - if 'resource_group' in _dict: - args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) - else: - raise ValueError('Required property \'resource_group\' not present in IPsecPolicy JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in IPsecPolicy JSON') - if 'transform_protocol' in _dict: - args['transform_protocol'] = _dict.get('transform_protocol') - else: - raise ValueError('Required property \'transform_protocol\' not present in IPsecPolicy JSON') + raise ValueError('Required property \'href\' not present in ImageFilePrototype JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a IPsecPolicy object from a json dictionary.""" + """Initialize a ImageFilePrototype object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'authentication_algorithm') and self.authentication_algorithm is not None: - _dict['authentication_algorithm'] = self.authentication_algorithm - if hasattr(self, 'connections') and self.connections is not None: - _dict['connections'] = [x.to_dict() for x in self.connections] - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'encapsulation_mode') and self.encapsulation_mode is not None: - _dict['encapsulation_mode'] = self.encapsulation_mode - if hasattr(self, 'encryption_algorithm') and self.encryption_algorithm is not None: - _dict['encryption_algorithm'] = self.encryption_algorithm if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'key_lifetime') and self.key_lifetime is not None: - _dict['key_lifetime'] = self.key_lifetime - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'pfs') and self.pfs is not None: - _dict['pfs'] = self.pfs - if hasattr(self, 'resource_group') and self.resource_group is not None: - _dict['resource_group'] = self.resource_group.to_dict() - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type - if hasattr(self, 'transform_protocol') and self.transform_protocol is not None: - _dict['transform_protocol'] = self.transform_protocol return _dict def _to_dict(self): @@ -27080,152 +31206,71 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this IPsecPolicy object.""" + """Return a `str` version of this ImageFilePrototype object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'IPsecPolicy') -> bool: + def __eq__(self, other: 'ImageFilePrototype') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'IPsecPolicy') -> bool: + def __ne__(self, other: 'ImageFilePrototype') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class AuthenticationAlgorithmEnum(str, Enum): - """ - The authentication algorithm. - """ - MD5 = 'md5' - SHA1 = 'sha1' - SHA256 = 'sha256' - SHA512 = 'sha512' - - - class EncapsulationModeEnum(str, Enum): - """ - The encapsulation mode used. Only `tunnel` is supported. - """ - TUNNEL = 'tunnel' - - - class EncryptionAlgorithmEnum(str, Enum): - """ - The encryption algorithm. - """ - AES128 = 'aes128' - AES256 = 'aes256' - TRIPLE_DES = 'triple_des' - - - class PfsEnum(str, Enum): - """ - Perfect Forward Secrecy. - """ - DISABLED = 'disabled' - GROUP_14 = 'group_14' - GROUP_19 = 'group_19' - GROUP_2 = 'group_2' - GROUP_5 = 'group_5' +class ImageIdentity(): + """ + Identifies an image by a unique property. + """ - class ResourceTypeEnum(str, Enum): - """ - The resource type. + def __init__(self) -> None: """ - IPSEC_POLICY = 'ipsec_policy' - + Initialize a ImageIdentity object. - class TransformProtocolEnum(str, Enum): - """ - The transform protocol used. Only `esp` is supported. """ - ESP = 'esp' - + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['ImageIdentityById', 'ImageIdentityByCRN', 'ImageIdentityByHref'])) + raise Exception(msg) -class IPsecPolicyCollection(): +class ImagePatch(): """ - IPsecPolicyCollection. + ImagePatch. - :attr IPsecPolicyCollectionFirst first: A link to the first page of resources. - :attr List[IPsecPolicy] ipsec_policies: Collection of IPsec policies. - :attr int limit: The maximum number of resources that can be returned by the - request. - :attr IPsecPolicyCollectionNext next: (optional) A link to the next page of - resources. This property is present for all pages - except the last page. - :attr int total_count: The total number of resources across all pages. + :attr str name: (optional) The unique user-defined name for this image. Names + starting with `ibm-` are not allowed. """ def __init__(self, - first: 'IPsecPolicyCollectionFirst', - ipsec_policies: List['IPsecPolicy'], - limit: int, - total_count: int, *, - next: 'IPsecPolicyCollectionNext' = None) -> None: + name: str = None) -> None: """ - Initialize a IPsecPolicyCollection object. + Initialize a ImagePatch object. - :param IPsecPolicyCollectionFirst first: A link to the first page of - resources. - :param List[IPsecPolicy] ipsec_policies: Collection of IPsec policies. - :param int limit: The maximum number of resources that can be returned by - the request. - :param int total_count: The total number of resources across all pages. - :param IPsecPolicyCollectionNext next: (optional) A link to the next page - of resources. This property is present for all pages - except the last page. + :param str name: (optional) The unique user-defined name for this image. + Names starting with `ibm-` are not allowed. """ - self.first = first - self.ipsec_policies = ipsec_policies - self.limit = limit - self.next = next - self.total_count = total_count + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'IPsecPolicyCollection': - """Initialize a IPsecPolicyCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ImagePatch': + """Initialize a ImagePatch object from a json dictionary.""" args = {} - if 'first' in _dict: - args['first'] = IPsecPolicyCollectionFirst.from_dict(_dict.get('first')) - else: - raise ValueError('Required property \'first\' not present in IPsecPolicyCollection JSON') - if 'ipsec_policies' in _dict: - args['ipsec_policies'] = [IPsecPolicy.from_dict(x) for x in _dict.get('ipsec_policies')] - else: - raise ValueError('Required property \'ipsec_policies\' not present in IPsecPolicyCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') - else: - raise ValueError('Required property \'limit\' not present in IPsecPolicyCollection JSON') - if 'next' in _dict: - args['next'] = IPsecPolicyCollectionNext.from_dict(_dict.get('next')) - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') - else: - raise ValueError('Required property \'total_count\' not present in IPsecPolicyCollection JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a IPsecPolicyCollection object from a json dictionary.""" + """Initialize a ImagePatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'ipsec_policies') and self.ipsec_policies is not None: - _dict['ipsec_policies'] = [x.to_dict() for x in self.ipsec_policies] - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -27233,55 +31278,129 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this IPsecPolicyCollection object.""" + """Return a `str` version of this ImagePatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'IPsecPolicyCollection') -> bool: + def __eq__(self, other: 'ImagePatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'IPsecPolicyCollection') -> bool: + def __ne__(self, other: 'ImagePatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class IPsecPolicyCollectionFirst(): +class ImagePrototype(): """ - A link to the first page of resources. + ImagePrototype. - :attr str href: The URL for a page of resources. + :attr str name: (optional) The unique user-defined name for this image. Names + starting with `ibm-` are not allowed. If unspecified, the name will be a + hyphenated list of randomly-selected words. + :attr ResourceGroupIdentity resource_group: (optional) The resource group to + use. If unspecified, the account's [default resource + group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. """ def __init__(self, - href: str) -> None: + *, + name: str = None, + resource_group: 'ResourceGroupIdentity' = None) -> None: """ - Initialize a IPsecPolicyCollectionFirst object. + Initialize a ImagePrototype object. - :param str href: The URL for a page of resources. + :param str name: (optional) The unique user-defined name for this image. + Names starting with `ibm-` are not allowed. If unspecified, the name will + be a hyphenated list of randomly-selected words. + :param ResourceGroupIdentity resource_group: (optional) The resource group + to use. If unspecified, the account's [default resource + group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is + used. + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['ImagePrototypeImageByFile', 'ImagePrototypeImageBySourceVolume'])) + raise Exception(msg) + +class ImageReference(): + """ + ImageReference. + + :attr str crn: The CRN for this image. + :attr ImageReferenceDeleted deleted: (optional) If present, this property + indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str href: The URL for this image. + :attr str id: The unique identifier for this image. + :attr str name: The user-defined or system-provided name for this image. + """ + + def __init__(self, + crn: str, + href: str, + id: str, + name: str, + *, + deleted: 'ImageReferenceDeleted' = None) -> None: + """ + Initialize a ImageReference object. + + :param str crn: The CRN for this image. + :param str href: The URL for this image. + :param str id: The unique identifier for this image. + :param str name: The user-defined or system-provided name for this image. + :param ImageReferenceDeleted deleted: (optional) If present, this property + indicates the referenced resource has been deleted and provides + some supplementary information. """ + self.crn = crn + self.deleted = deleted self.href = href + self.id = id + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'IPsecPolicyCollectionFirst': - """Initialize a IPsecPolicyCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ImageReference': + """Initialize a ImageReference object from a json dictionary.""" args = {} + if 'crn' in _dict: + args['crn'] = _dict.get('crn') + else: + raise ValueError('Required property \'crn\' not present in ImageReference JSON') + if 'deleted' in _dict: + args['deleted'] = ImageReferenceDeleted.from_dict(_dict.get('deleted')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in IPsecPolicyCollectionFirst JSON') + raise ValueError('Required property \'href\' not present in ImageReference JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in ImageReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in ImageReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a IPsecPolicyCollectionFirst object from a json dictionary.""" + """Initialize a ImageReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -27289,56 +31408,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this IPsecPolicyCollectionFirst object.""" + """Return a `str` version of this ImageReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'IPsecPolicyCollectionFirst') -> bool: + def __eq__(self, other: 'ImageReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'IPsecPolicyCollectionFirst') -> bool: + def __ne__(self, other: 'ImageReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class IPsecPolicyCollectionNext(): +class ImageReferenceDeleted(): """ - A link to the next page of resources. This property is present for all pages except - the last page. + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. - :attr str href: The URL for a page of resources. + :attr str more_info: Link to documentation about deleted resources. """ def __init__(self, - href: str) -> None: + more_info: str) -> None: """ - Initialize a IPsecPolicyCollectionNext object. + Initialize a ImageReferenceDeleted object. - :param str href: The URL for a page of resources. + :param str more_info: Link to documentation about deleted resources. """ - self.href = href + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'IPsecPolicyCollectionNext': - """Initialize a IPsecPolicyCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ImageReferenceDeleted': + """Initialize a ImageReferenceDeleted object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'href\' not present in IPsecPolicyCollectionNext JSON') + raise ValueError('Required property \'more_info\' not present in ImageReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a IPsecPolicyCollectionNext object from a json dictionary.""" + """Initialize a ImageReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -27346,87 +31465,76 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this IPsecPolicyCollectionNext object.""" + """Return a `str` version of this ImageReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'IPsecPolicyCollectionNext') -> bool: + def __eq__(self, other: 'ImageReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'IPsecPolicyCollectionNext') -> bool: + def __ne__(self, other: 'ImageReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class IPsecPolicyPatch(): +class ImageStatusReason(): """ - IPsecPolicyPatch. + ImageStatusReason. - :attr str authentication_algorithm: (optional) The authentication algorithm. - :attr str encryption_algorithm: (optional) The encryption algorithm. - :attr int key_lifetime: (optional) The key lifetime in seconds. - :attr str name: (optional) The user-defined name for this IPsec policy. - :attr str pfs: (optional) Perfect Forward Secrecy. + :attr str code: A snake case string succinctly identifying the status reason. + :attr str message: An explanation of the status reason. + :attr str more_info: (optional) Link to documentation about this status reason. """ def __init__(self, + code: str, + message: str, *, - authentication_algorithm: str = None, - encryption_algorithm: str = None, - key_lifetime: int = None, - name: str = None, - pfs: str = None) -> None: + more_info: str = None) -> None: """ - Initialize a IPsecPolicyPatch object. + Initialize a ImageStatusReason object. - :param str authentication_algorithm: (optional) The authentication - algorithm. - :param str encryption_algorithm: (optional) The encryption algorithm. - :param int key_lifetime: (optional) The key lifetime in seconds. - :param str name: (optional) The user-defined name for this IPsec policy. - :param str pfs: (optional) Perfect Forward Secrecy. + :param str code: A snake case string succinctly identifying the status + reason. + :param str message: An explanation of the status reason. + :param str more_info: (optional) Link to documentation about this status + reason. """ - self.authentication_algorithm = authentication_algorithm - self.encryption_algorithm = encryption_algorithm - self.key_lifetime = key_lifetime - self.name = name - self.pfs = pfs + self.code = code + self.message = message + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'IPsecPolicyPatch': - """Initialize a IPsecPolicyPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ImageStatusReason': + """Initialize a ImageStatusReason object from a json dictionary.""" args = {} - if 'authentication_algorithm' in _dict: - args['authentication_algorithm'] = _dict.get('authentication_algorithm') - if 'encryption_algorithm' in _dict: - args['encryption_algorithm'] = _dict.get('encryption_algorithm') - if 'key_lifetime' in _dict: - args['key_lifetime'] = _dict.get('key_lifetime') - if 'name' in _dict: - args['name'] = _dict.get('name') - if 'pfs' in _dict: - args['pfs'] = _dict.get('pfs') + if 'code' in _dict: + args['code'] = _dict.get('code') + else: + raise ValueError('Required property \'code\' not present in ImageStatusReason JSON') + if 'message' in _dict: + args['message'] = _dict.get('message') + else: + raise ValueError('Required property \'message\' not present in ImageStatusReason JSON') + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a IPsecPolicyPatch object from a json dictionary.""" + """Initialize a ImageStatusReason object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'authentication_algorithm') and self.authentication_algorithm is not None: - _dict['authentication_algorithm'] = self.authentication_algorithm - if hasattr(self, 'encryption_algorithm') and self.encryption_algorithm is not None: - _dict['encryption_algorithm'] = self.encryption_algorithm - if hasattr(self, 'key_lifetime') and self.key_lifetime is not None: - _dict['key_lifetime'] = self.key_lifetime - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'pfs') and self.pfs is not None: - _dict['pfs'] = self.pfs + if hasattr(self, 'code') and self.code is not None: + _dict['code'] = self.code + if hasattr(self, 'message') and self.message is not None: + _dict['message'] = self.message + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -27434,128 +31542,398 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this IPsecPolicyPatch object.""" + """Return a `str` version of this ImageStatusReason object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'IPsecPolicyPatch') -> bool: + def __eq__(self, other: 'ImageStatusReason') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'IPsecPolicyPatch') -> bool: + def __ne__(self, other: 'ImageStatusReason') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class AuthenticationAlgorithmEnum(str, Enum): - """ - The authentication algorithm. - """ - MD5 = 'md5' - SHA1 = 'sha1' - SHA256 = 'sha256' - SHA512 = 'sha512' - - - class EncryptionAlgorithmEnum(str, Enum): - """ - The encryption algorithm. - """ - AES128 = 'aes128' - AES256 = 'aes256' - TRIPLE_DES = 'triple_des' - - - class PfsEnum(str, Enum): + class CodeEnum(str, Enum): """ - Perfect Forward Secrecy. + A snake case string succinctly identifying the status reason. """ - DISABLED = 'disabled' - GROUP_14 = 'group_14' - GROUP_19 = 'group_19' - GROUP_2 = 'group_2' - GROUP_5 = 'group_5' + ENCRYPTION_KEY_DELETED = 'encryption_key_deleted' + ENCRYPTION_KEY_DISABLED = 'encryption_key_disabled' + IMAGE_REQUEST_IN_PROGRESS = 'image_request_in_progress' + IMAGE_REQUEST_QUEUED = 'image_request_queued' -class IPsecPolicyReference(): +class Instance(): """ - IPsecPolicyReference. + Instance. - :attr IPsecPolicyReferenceDeleted deleted: (optional) If present, this property - indicates the referenced resource has been deleted and provides - some supplementary information. - :attr str href: The IPsec policy's canonical URL. - :attr str id: The unique identifier for this IPsec policy. - :attr str name: The user-defined name for this IPsec policy. + :attr InstanceAvailabilityPolicy availability_policy: The availability policy + for this virtual server instance. + :attr int bandwidth: The total bandwidth (in megabits per second) shared across + the virtual server instance's network interfaces and storage volumes. + :attr VolumeAttachmentReferenceInstanceContext boot_volume_attachment: Boot + volume attachment. + :attr datetime created_at: The date and time that the virtual server instance + was created. + :attr str crn: The CRN for this virtual server instance. + :attr DedicatedHostReference dedicated_host: (optional) If present, the + dedicated host this virtual server instance has been placed on. + :attr List[InstanceDisk] disks: The instance disks for this virtual server + instance. + :attr InstanceGPU gpu: (optional) The virtual server instance GPU configuration. + :attr str href: The URL for this virtual server instance. + :attr str id: The unique identifier for this virtual server instance. + :attr ImageReference image: (optional) The image the virtual server instance was + provisioned from. + :attr int memory: The amount of memory, truncated to whole gibibytes. + :attr InstanceMetadataService metadata_service: The metadata service + configuration. + :attr str name: The user-defined name for this virtual server instance (and + default system hostname). + :attr List[NetworkInterfaceInstanceContextReference] network_interfaces: The + network interfaces for this virtual server instance, including the primary + network interface. + :attr InstancePlacementTarget placement_target: (optional) The placement + restrictions for the virtual server instance. + :attr NetworkInterfaceInstanceContextReference primary_network_interface: + Primary network interface. + :attr InstanceProfileReference profile: The profile for this virtual server + instance. + :attr ResourceGroupReference resource_group: The resource group for this + instance. :attr str resource_type: The resource type. + :attr bool startable: Indicates whether the state of the virtual server instance + permits a start request. + :attr str status: The status of the virtual server instance. + :attr List[InstanceStatusReason] status_reasons: The reasons for the current + status (if any). + The enumerated reason code values for this property will expand in the future. + When processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the resource on which the unexpected + reason code was encountered. + :attr int total_network_bandwidth: The amount of bandwidth (in megabits per + second) allocated exclusively to instance network interfaces. + :attr int total_volume_bandwidth: The amount of bandwidth (in megabits per + second) allocated exclusively to instance storage volumes. An increase in this + value will result in a corresponding decrease to + `total_network_bandwidth`. + :attr InstanceVCPU vcpu: The virtual server instance VCPU configuration. + :attr List[VolumeAttachmentReferenceInstanceContext] volume_attachments: The + volume attachments for this virtual server instance, including the boot volume + attachment. + :attr VPCReference vpc: The VPC this virtual server instance resides in. + :attr ZoneReference zone: The zone this virtual server instance resides in. """ def __init__(self, + availability_policy: 'InstanceAvailabilityPolicy', + bandwidth: int, + boot_volume_attachment: 'VolumeAttachmentReferenceInstanceContext', + created_at: datetime, + crn: str, + disks: List['InstanceDisk'], href: str, id: str, + memory: int, + metadata_service: 'InstanceMetadataService', name: str, + network_interfaces: List['NetworkInterfaceInstanceContextReference'], + primary_network_interface: 'NetworkInterfaceInstanceContextReference', + profile: 'InstanceProfileReference', + resource_group: 'ResourceGroupReference', resource_type: str, + startable: bool, + status: str, + status_reasons: List['InstanceStatusReason'], + total_network_bandwidth: int, + total_volume_bandwidth: int, + vcpu: 'InstanceVCPU', + volume_attachments: List['VolumeAttachmentReferenceInstanceContext'], + vpc: 'VPCReference', + zone: 'ZoneReference', *, - deleted: 'IPsecPolicyReferenceDeleted' = None) -> None: + dedicated_host: 'DedicatedHostReference' = None, + gpu: 'InstanceGPU' = None, + image: 'ImageReference' = None, + placement_target: 'InstancePlacementTarget' = None) -> None: """ - Initialize a IPsecPolicyReference object. + Initialize a Instance object. - :param str href: The IPsec policy's canonical URL. - :param str id: The unique identifier for this IPsec policy. - :param str name: The user-defined name for this IPsec policy. + :param InstanceAvailabilityPolicy availability_policy: The availability + policy for this virtual server instance. + :param int bandwidth: The total bandwidth (in megabits per second) shared + across the virtual server instance's network interfaces and storage + volumes. + :param VolumeAttachmentReferenceInstanceContext boot_volume_attachment: + Boot volume attachment. + :param datetime created_at: The date and time that the virtual server + instance was created. + :param str crn: The CRN for this virtual server instance. + :param List[InstanceDisk] disks: The instance disks for this virtual server + instance. + :param str href: The URL for this virtual server instance. + :param str id: The unique identifier for this virtual server instance. + :param int memory: The amount of memory, truncated to whole gibibytes. + :param InstanceMetadataService metadata_service: The metadata service + configuration. + :param str name: The user-defined name for this virtual server instance + (and default system hostname). + :param List[NetworkInterfaceInstanceContextReference] network_interfaces: + The network interfaces for this virtual server instance, including the + primary network interface. + :param NetworkInterfaceInstanceContextReference primary_network_interface: + Primary network interface. + :param InstanceProfileReference profile: The profile for this virtual + server instance. + :param ResourceGroupReference resource_group: The resource group for this + instance. :param str resource_type: The resource type. - :param IPsecPolicyReferenceDeleted deleted: (optional) If present, this - property indicates the referenced resource has been deleted and provides - some supplementary information. + :param bool startable: Indicates whether the state of the virtual server + instance permits a start request. + :param str status: The status of the virtual server instance. + :param List[InstanceStatusReason] status_reasons: The reasons for the + current status (if any). + The enumerated reason code values for this property will expand in the + future. When processing this property, check for and log unknown values. + Optionally halt processing and surface the error, or bypass the resource on + which the unexpected reason code was encountered. + :param int total_network_bandwidth: The amount of bandwidth (in megabits + per second) allocated exclusively to instance network interfaces. + :param int total_volume_bandwidth: The amount of bandwidth (in megabits per + second) allocated exclusively to instance storage volumes. An increase in + this value will result in a corresponding decrease to + `total_network_bandwidth`. + :param InstanceVCPU vcpu: The virtual server instance VCPU configuration. + :param List[VolumeAttachmentReferenceInstanceContext] volume_attachments: + The volume attachments for this virtual server instance, including the boot + volume attachment. + :param VPCReference vpc: The VPC this virtual server instance resides in. + :param ZoneReference zone: The zone this virtual server instance resides + in. + :param DedicatedHostReference dedicated_host: (optional) If present, the + dedicated host this virtual server instance has been placed on. + :param InstanceGPU gpu: (optional) The virtual server instance GPU + configuration. + :param ImageReference image: (optional) The image the virtual server + instance was provisioned from. + :param InstancePlacementTarget placement_target: (optional) The placement + restrictions for the virtual server instance. """ - self.deleted = deleted + self.availability_policy = availability_policy + self.bandwidth = bandwidth + self.boot_volume_attachment = boot_volume_attachment + self.created_at = created_at + self.crn = crn + self.dedicated_host = dedicated_host + self.disks = disks + self.gpu = gpu self.href = href self.id = id + self.image = image + self.memory = memory + self.metadata_service = metadata_service self.name = name + self.network_interfaces = network_interfaces + self.placement_target = placement_target + self.primary_network_interface = primary_network_interface + self.profile = profile + self.resource_group = resource_group self.resource_type = resource_type + self.startable = startable + self.status = status + self.status_reasons = status_reasons + self.total_network_bandwidth = total_network_bandwidth + self.total_volume_bandwidth = total_volume_bandwidth + self.vcpu = vcpu + self.volume_attachments = volume_attachments + self.vpc = vpc + self.zone = zone @classmethod - def from_dict(cls, _dict: Dict) -> 'IPsecPolicyReference': - """Initialize a IPsecPolicyReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'Instance': + """Initialize a Instance object from a json dictionary.""" args = {} - if 'deleted' in _dict: - args['deleted'] = IPsecPolicyReferenceDeleted.from_dict(_dict.get('deleted')) + if 'availability_policy' in _dict: + args['availability_policy'] = InstanceAvailabilityPolicy.from_dict(_dict.get('availability_policy')) + else: + raise ValueError('Required property \'availability_policy\' not present in Instance JSON') + if 'bandwidth' in _dict: + args['bandwidth'] = _dict.get('bandwidth') + else: + raise ValueError('Required property \'bandwidth\' not present in Instance JSON') + if 'boot_volume_attachment' in _dict: + args['boot_volume_attachment'] = VolumeAttachmentReferenceInstanceContext.from_dict(_dict.get('boot_volume_attachment')) + else: + raise ValueError('Required property \'boot_volume_attachment\' not present in Instance JSON') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) + else: + raise ValueError('Required property \'created_at\' not present in Instance JSON') + if 'crn' in _dict: + args['crn'] = _dict.get('crn') + else: + raise ValueError('Required property \'crn\' not present in Instance JSON') + if 'dedicated_host' in _dict: + args['dedicated_host'] = DedicatedHostReference.from_dict(_dict.get('dedicated_host')) + if 'disks' in _dict: + args['disks'] = [InstanceDisk.from_dict(x) for x in _dict.get('disks')] + else: + raise ValueError('Required property \'disks\' not present in Instance JSON') + if 'gpu' in _dict: + args['gpu'] = InstanceGPU.from_dict(_dict.get('gpu')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in IPsecPolicyReference JSON') + raise ValueError('Required property \'href\' not present in Instance JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in IPsecPolicyReference JSON') + raise ValueError('Required property \'id\' not present in Instance JSON') + if 'image' in _dict: + args['image'] = ImageReference.from_dict(_dict.get('image')) + if 'memory' in _dict: + args['memory'] = _dict.get('memory') + else: + raise ValueError('Required property \'memory\' not present in Instance JSON') + if 'metadata_service' in _dict: + args['metadata_service'] = InstanceMetadataService.from_dict(_dict.get('metadata_service')) + else: + raise ValueError('Required property \'metadata_service\' not present in Instance JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in IPsecPolicyReference JSON') + raise ValueError('Required property \'name\' not present in Instance JSON') + if 'network_interfaces' in _dict: + args['network_interfaces'] = [NetworkInterfaceInstanceContextReference.from_dict(x) for x in _dict.get('network_interfaces')] + else: + raise ValueError('Required property \'network_interfaces\' not present in Instance JSON') + if 'placement_target' in _dict: + args['placement_target'] = _dict.get('placement_target') + if 'primary_network_interface' in _dict: + args['primary_network_interface'] = NetworkInterfaceInstanceContextReference.from_dict(_dict.get('primary_network_interface')) + else: + raise ValueError('Required property \'primary_network_interface\' not present in Instance JSON') + if 'profile' in _dict: + args['profile'] = InstanceProfileReference.from_dict(_dict.get('profile')) + else: + raise ValueError('Required property \'profile\' not present in Instance JSON') + if 'resource_group' in _dict: + args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) + else: + raise ValueError('Required property \'resource_group\' not present in Instance JSON') if 'resource_type' in _dict: args['resource_type'] = _dict.get('resource_type') else: - raise ValueError('Required property \'resource_type\' not present in IPsecPolicyReference JSON') + raise ValueError('Required property \'resource_type\' not present in Instance JSON') + if 'startable' in _dict: + args['startable'] = _dict.get('startable') + else: + raise ValueError('Required property \'startable\' not present in Instance JSON') + if 'status' in _dict: + args['status'] = _dict.get('status') + else: + raise ValueError('Required property \'status\' not present in Instance JSON') + if 'status_reasons' in _dict: + args['status_reasons'] = [InstanceStatusReason.from_dict(x) for x in _dict.get('status_reasons')] + else: + raise ValueError('Required property \'status_reasons\' not present in Instance JSON') + if 'total_network_bandwidth' in _dict: + args['total_network_bandwidth'] = _dict.get('total_network_bandwidth') + else: + raise ValueError('Required property \'total_network_bandwidth\' not present in Instance JSON') + if 'total_volume_bandwidth' in _dict: + args['total_volume_bandwidth'] = _dict.get('total_volume_bandwidth') + else: + raise ValueError('Required property \'total_volume_bandwidth\' not present in Instance JSON') + if 'vcpu' in _dict: + args['vcpu'] = InstanceVCPU.from_dict(_dict.get('vcpu')) + else: + raise ValueError('Required property \'vcpu\' not present in Instance JSON') + if 'volume_attachments' in _dict: + args['volume_attachments'] = [VolumeAttachmentReferenceInstanceContext.from_dict(x) for x in _dict.get('volume_attachments')] + else: + raise ValueError('Required property \'volume_attachments\' not present in Instance JSON') + if 'vpc' in _dict: + args['vpc'] = VPCReference.from_dict(_dict.get('vpc')) + else: + raise ValueError('Required property \'vpc\' not present in Instance JSON') + if 'zone' in _dict: + args['zone'] = ZoneReference.from_dict(_dict.get('zone')) + else: + raise ValueError('Required property \'zone\' not present in Instance JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a IPsecPolicyReference object from a json dictionary.""" + """Initialize a Instance object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() + if hasattr(self, 'availability_policy') and self.availability_policy is not None: + _dict['availability_policy'] = self.availability_policy.to_dict() + if hasattr(self, 'bandwidth') and self.bandwidth is not None: + _dict['bandwidth'] = self.bandwidth + if hasattr(self, 'boot_volume_attachment') and self.boot_volume_attachment is not None: + _dict['boot_volume_attachment'] = self.boot_volume_attachment.to_dict() + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'dedicated_host') and self.dedicated_host is not None: + _dict['dedicated_host'] = self.dedicated_host.to_dict() + if hasattr(self, 'disks') and self.disks is not None: + _dict['disks'] = [x.to_dict() for x in self.disks] + if hasattr(self, 'gpu') and self.gpu is not None: + _dict['gpu'] = self.gpu.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id + if hasattr(self, 'image') and self.image is not None: + _dict['image'] = self.image.to_dict() + if hasattr(self, 'memory') and self.memory is not None: + _dict['memory'] = self.memory + if hasattr(self, 'metadata_service') and self.metadata_service is not None: + _dict['metadata_service'] = self.metadata_service.to_dict() if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name + if hasattr(self, 'network_interfaces') and self.network_interfaces is not None: + _dict['network_interfaces'] = [x.to_dict() for x in self.network_interfaces] + if hasattr(self, 'placement_target') and self.placement_target is not None: + if isinstance(self.placement_target, dict): + _dict['placement_target'] = self.placement_target + else: + _dict['placement_target'] = self.placement_target.to_dict() + if hasattr(self, 'primary_network_interface') and self.primary_network_interface is not None: + _dict['primary_network_interface'] = self.primary_network_interface.to_dict() + if hasattr(self, 'profile') and self.profile is not None: + _dict['profile'] = self.profile.to_dict() + if hasattr(self, 'resource_group') and self.resource_group is not None: + _dict['resource_group'] = self.resource_group.to_dict() if hasattr(self, 'resource_type') and self.resource_type is not None: _dict['resource_type'] = self.resource_type + if hasattr(self, 'startable') and self.startable is not None: + _dict['startable'] = self.startable + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'status_reasons') and self.status_reasons is not None: + _dict['status_reasons'] = [x.to_dict() for x in self.status_reasons] + if hasattr(self, 'total_network_bandwidth') and self.total_network_bandwidth is not None: + _dict['total_network_bandwidth'] = self.total_network_bandwidth + if hasattr(self, 'total_volume_bandwidth') and self.total_volume_bandwidth is not None: + _dict['total_volume_bandwidth'] = self.total_volume_bandwidth + if hasattr(self, 'vcpu') and self.vcpu is not None: + _dict['vcpu'] = self.vcpu.to_dict() + if hasattr(self, 'volume_attachments') and self.volume_attachments is not None: + _dict['volume_attachments'] = [x.to_dict() for x in self.volume_attachments] + if hasattr(self, 'vpc') and self.vpc is not None: + _dict['vpc'] = self.vpc.to_dict() + if hasattr(self, 'zone') and self.zone is not None: + _dict['zone'] = self.zone.to_dict() return _dict def _to_dict(self): @@ -27563,16 +31941,16 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this IPsecPolicyReference object.""" + """Return a `str` version of this Instance object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'IPsecPolicyReference') -> bool: + def __eq__(self, other: 'Instance') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'IPsecPolicyReference') -> bool: + def __ne__(self, other: 'Instance') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other @@ -27580,303 +31958,133 @@ class ResourceTypeEnum(str, Enum): """ The resource type. """ - IPSEC_POLICY = 'ipsec_policy' - - -class IPsecPolicyReferenceDeleted(): - """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. + INSTANCE = 'instance' - :attr str more_info: Link to documentation about deleted resources. - """ - def __init__(self, - more_info: str) -> None: + class StatusEnum(str, Enum): """ - Initialize a IPsecPolicyReferenceDeleted object. - - :param str more_info: Link to documentation about deleted resources. + The status of the virtual server instance. """ - self.more_info = more_info - - @classmethod - def from_dict(cls, _dict: Dict) -> 'IPsecPolicyReferenceDeleted': - """Initialize a IPsecPolicyReferenceDeleted object from a json dictionary.""" - args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') - else: - raise ValueError('Required property \'more_info\' not present in IPsecPolicyReferenceDeleted JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a IPsecPolicyReferenceDeleted object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this IPsecPolicyReferenceDeleted object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'IPsecPolicyReferenceDeleted') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ + DELETING = 'deleting' + FAILED = 'failed' + PAUSED = 'paused' + PAUSING = 'pausing' + PENDING = 'pending' + RESTARTING = 'restarting' + RESUMING = 'resuming' + RUNNING = 'running' + STARTING = 'starting' + STOPPED = 'stopped' + STOPPING = 'stopping' - def __ne__(self, other: 'IPsecPolicyReferenceDeleted') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other -class Image(): +class InstanceAction(): """ - Image. + InstanceAction. - :attr datetime created_at: The date and time that the image was created. - :attr str crn: The CRN for this image. - :attr str encryption: The type of encryption used on the image. - :attr EncryptionKeyReference encryption_key: (optional) The key that will be - used to encrypt volumes created from this image (unless an - alternate `encryption_key` is specified at volume creation). - This property will be present for images with an `encryption` type of - `user_managed`. - :attr ImageFile file: Details for the stored image file. - :attr str href: The URL for this image. - :attr str id: The unique identifier for this image. - :attr int minimum_provisioned_size: (optional) The minimum size (in gigabytes) - of a volume onto which this image may be provisioned. - This property may be absent if the image has a `status` of `pending`, - `tentative`, or - `failed`. - :attr str name: The user-defined or system-provided name for this image. - :attr OperatingSystem operating_system: (optional) The operating system included - in this image. - :attr ResourceGroupReference resource_group: The resource group for this image. - :attr VolumeReference source_volume: (optional) The volume used to create this - image (this may be - [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). - If absent, this image was not created from a volume. - :attr str status: The status of this image - - available: image can be used (provisionable) - - deleting: image is being deleted, and can no longer be used to provision new - resources - - deprecated: image can be used, but is slated to become `obsolete` - (provisionable) - - failed: image is corrupt or did not pass validation - - obsolete: image can no longer be used to provision new resources - - pending: image is being imported and is not yet `available` - - tentative: image import has timed out (contact support) - - unusable: image cannot be used (see `status_reasons[]` for possible - remediation) - The enumerated values for this property are expected to expand in the future. - When processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the image on which the unexpected - property value was encountered. - :attr List[ImageStatusReason] status_reasons: The reasons for the current status - (if any). - The enumerated reason code values for this property will expand in the future. - When processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the resource on which the unexpected - reason code was encountered. - :attr str visibility: Whether the image is publicly visible or private to the - account. + :attr datetime completed_at: (optional) The date and time that the action was + completed. + :attr datetime created_at: The date and time that the action was created. + :attr bool force: (optional) If set to true, the action will be forced + immediately, and all queued actions deleted. Ignored for the start action. + :attr str href: The URL for this instance action. + :attr str id: The identifier for this instance action. + :attr datetime started_at: (optional) The date and time that the action was + started. + :attr str status: The current status of this action. + :attr str type: The type of action. """ def __init__(self, created_at: datetime, - crn: str, - encryption: str, - file: 'ImageFile', href: str, id: str, - name: str, - resource_group: 'ResourceGroupReference', status: str, - status_reasons: List['ImageStatusReason'], - visibility: str, + type: str, *, - encryption_key: 'EncryptionKeyReference' = None, - minimum_provisioned_size: int = None, - operating_system: 'OperatingSystem' = None, - source_volume: 'VolumeReference' = None) -> None: + completed_at: datetime = None, + force: bool = None, + started_at: datetime = None) -> None: """ - Initialize a Image object. + Initialize a InstanceAction object. - :param datetime created_at: The date and time that the image was created. - :param str crn: The CRN for this image. - :param str encryption: The type of encryption used on the image. - :param ImageFile file: Details for the stored image file. - :param str href: The URL for this image. - :param str id: The unique identifier for this image. - :param str name: The user-defined or system-provided name for this image. - :param ResourceGroupReference resource_group: The resource group for this - image. - :param str status: The status of this image - - available: image can be used (provisionable) - - deleting: image is being deleted, and can no longer be used to provision - new - resources - - deprecated: image can be used, but is slated to become `obsolete` - (provisionable) - - failed: image is corrupt or did not pass validation - - obsolete: image can no longer be used to provision new resources - - pending: image is being imported and is not yet `available` - - tentative: image import has timed out (contact support) - - unusable: image cannot be used (see `status_reasons[]` for possible - remediation) - The enumerated values for this property are expected to expand in the - future. When processing this property, check for and log unknown values. - Optionally halt processing and surface the error, or bypass the image on - which the unexpected property value was encountered. - :param List[ImageStatusReason] status_reasons: The reasons for the current - status (if any). - The enumerated reason code values for this property will expand in the - future. When processing this property, check for and log unknown values. - Optionally halt processing and surface the error, or bypass the resource on - which the unexpected reason code was encountered. - :param str visibility: Whether the image is publicly visible or private to - the account. - :param EncryptionKeyReference encryption_key: (optional) The key that will - be used to encrypt volumes created from this image (unless an - alternate `encryption_key` is specified at volume creation). - This property will be present for images with an `encryption` type of - `user_managed`. - :param int minimum_provisioned_size: (optional) The minimum size (in - gigabytes) of a volume onto which this image may be provisioned. - This property may be absent if the image has a `status` of `pending`, - `tentative`, or - `failed`. - :param OperatingSystem operating_system: (optional) The operating system - included in this image. - :param VolumeReference source_volume: (optional) The volume used to create - this image (this may be - [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). - If absent, this image was not created from a volume. + :param datetime created_at: The date and time that the action was created. + :param str href: The URL for this instance action. + :param str id: The identifier for this instance action. + :param str status: The current status of this action. + :param str type: The type of action. + :param datetime completed_at: (optional) The date and time that the action + was completed. + :param bool force: (optional) If set to true, the action will be forced + immediately, and all queued actions deleted. Ignored for the start action. + :param datetime started_at: (optional) The date and time that the action + was started. """ + self.completed_at = completed_at self.created_at = created_at - self.crn = crn - self.encryption = encryption - self.encryption_key = encryption_key - self.file = file + self.force = force self.href = href self.id = id - self.minimum_provisioned_size = minimum_provisioned_size - self.name = name - self.operating_system = operating_system - self.resource_group = resource_group - self.source_volume = source_volume + self.started_at = started_at self.status = status - self.status_reasons = status_reasons - self.visibility = visibility + self.type = type @classmethod - def from_dict(cls, _dict: Dict) -> 'Image': - """Initialize a Image object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceAction': + """Initialize a InstanceAction object from a json dictionary.""" args = {} + if 'completed_at' in _dict: + args['completed_at'] = string_to_datetime(_dict.get('completed_at')) if 'created_at' in _dict: args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError('Required property \'created_at\' not present in Image JSON') - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in Image JSON') - if 'encryption' in _dict: - args['encryption'] = _dict.get('encryption') - else: - raise ValueError('Required property \'encryption\' not present in Image JSON') - if 'encryption_key' in _dict: - args['encryption_key'] = EncryptionKeyReference.from_dict(_dict.get('encryption_key')) - if 'file' in _dict: - args['file'] = ImageFile.from_dict(_dict.get('file')) - else: - raise ValueError('Required property \'file\' not present in Image JSON') + raise ValueError('Required property \'created_at\' not present in InstanceAction JSON') + if 'force' in _dict: + args['force'] = _dict.get('force') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in Image JSON') + raise ValueError('Required property \'href\' not present in InstanceAction JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in Image JSON') - if 'minimum_provisioned_size' in _dict: - args['minimum_provisioned_size'] = _dict.get('minimum_provisioned_size') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in Image JSON') - if 'operating_system' in _dict: - args['operating_system'] = OperatingSystem.from_dict(_dict.get('operating_system')) - if 'resource_group' in _dict: - args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) - else: - raise ValueError('Required property \'resource_group\' not present in Image JSON') - if 'source_volume' in _dict: - args['source_volume'] = VolumeReference.from_dict(_dict.get('source_volume')) + raise ValueError('Required property \'id\' not present in InstanceAction JSON') + if 'started_at' in _dict: + args['started_at'] = string_to_datetime(_dict.get('started_at')) if 'status' in _dict: args['status'] = _dict.get('status') else: - raise ValueError('Required property \'status\' not present in Image JSON') - if 'status_reasons' in _dict: - args['status_reasons'] = [ImageStatusReason.from_dict(x) for x in _dict.get('status_reasons')] - else: - raise ValueError('Required property \'status_reasons\' not present in Image JSON') - if 'visibility' in _dict: - args['visibility'] = _dict.get('visibility') + raise ValueError('Required property \'status\' not present in InstanceAction JSON') + if 'type' in _dict: + args['type'] = _dict.get('type') else: - raise ValueError('Required property \'visibility\' not present in Image JSON') + raise ValueError('Required property \'type\' not present in InstanceAction JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a Image object from a json dictionary.""" + """Initialize a InstanceAction object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'completed_at') and self.completed_at is not None: + _dict['completed_at'] = datetime_to_string(self.completed_at) if hasattr(self, 'created_at') and self.created_at is not None: _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - if hasattr(self, 'encryption') and self.encryption is not None: - _dict['encryption'] = self.encryption - if hasattr(self, 'encryption_key') and self.encryption_key is not None: - _dict['encryption_key'] = self.encryption_key.to_dict() - if hasattr(self, 'file') and self.file is not None: - _dict['file'] = self.file.to_dict() + if hasattr(self, 'force') and self.force is not None: + _dict['force'] = self.force if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id - if hasattr(self, 'minimum_provisioned_size') and self.minimum_provisioned_size is not None: - _dict['minimum_provisioned_size'] = self.minimum_provisioned_size - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'operating_system') and self.operating_system is not None: - _dict['operating_system'] = self.operating_system.to_dict() - if hasattr(self, 'resource_group') and self.resource_group is not None: - _dict['resource_group'] = self.resource_group.to_dict() - if hasattr(self, 'source_volume') and self.source_volume is not None: - _dict['source_volume'] = self.source_volume.to_dict() + if hasattr(self, 'started_at') and self.started_at is not None: + _dict['started_at'] = datetime_to_string(self.started_at) if hasattr(self, 'status') and self.status is not None: _dict['status'] = self.status - if hasattr(self, 'status_reasons') and self.status_reasons is not None: - _dict['status_reasons'] = [x.to_dict() for x in self.status_reasons] - if hasattr(self, 'visibility') and self.visibility is not None: - _dict['visibility'] = self.visibility + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type return _dict def _to_dict(self): @@ -27884,133 +32092,90 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this Image object.""" + """Return a `str` version of this InstanceAction object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'Image') -> bool: + def __eq__(self, other: 'InstanceAction') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'Image') -> bool: + def __ne__(self, other: 'InstanceAction') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class EncryptionEnum(str, Enum): - """ - The type of encryption used on the image. - """ - NONE = 'none' - USER_MANAGED = 'user_managed' - - class StatusEnum(str, Enum): """ - The status of this image - - available: image can be used (provisionable) - - deleting: image is being deleted, and can no longer be used to provision new - resources - - deprecated: image can be used, but is slated to become `obsolete` - (provisionable) - - failed: image is corrupt or did not pass validation - - obsolete: image can no longer be used to provision new resources - - pending: image is being imported and is not yet `available` - - tentative: image import has timed out (contact support) - - unusable: image cannot be used (see `status_reasons[]` for possible remediation) - The enumerated values for this property are expected to expand in the future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the image on which the unexpected - property value was encountered. + The current status of this action. """ - AVAILABLE = 'available' - DELETING = 'deleting' - DEPRECATED = 'deprecated' + COMPLETED = 'completed' FAILED = 'failed' PENDING = 'pending' - TENTATIVE = 'tentative' - UNUSABLE = 'unusable' + RUNNING = 'running' - class VisibilityEnum(str, Enum): + class TypeEnum(str, Enum): """ - Whether the image is publicly visible or private to the account. + The type of action. """ - PRIVATE = 'private' - PUBLIC = 'public' + REBOOT = 'reboot' + START = 'start' + STOP = 'stop' -class ImageCollection(): +class InstanceAvailabilityPolicy(): """ - ImageCollection. + InstanceAvailabilityPolicy. - :attr ImageCollectionFirst first: A link to the first page of resources. - :attr List[Image] images: Collection of images. - :attr int limit: The maximum number of resources that can be returned by the - request. - :attr ImageCollectionNext next: (optional) A link to the next page of resources. - This property is present for all pages - except the last page. + :attr str host_failure: The action to perform if the compute host experiences a + failure. + - `restart`: Automatically restart the virtual server instance after host + failure + - `stop`: Leave the virtual server instance stopped after host failure + The enumerated values for this property are expected to expand in the future. + When processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the instance on which the unexpected + property value was encountered. """ def __init__(self, - first: 'ImageCollectionFirst', - images: List['Image'], - limit: int, - *, - next: 'ImageCollectionNext' = None) -> None: + host_failure: str) -> None: """ - Initialize a ImageCollection object. + Initialize a InstanceAvailabilityPolicy object. - :param ImageCollectionFirst first: A link to the first page of resources. - :param List[Image] images: Collection of images. - :param int limit: The maximum number of resources that can be returned by - the request. - :param ImageCollectionNext next: (optional) A link to the next page of - resources. This property is present for all pages - except the last page. + :param str host_failure: The action to perform if the compute host + experiences a failure. + - `restart`: Automatically restart the virtual server instance after host + failure + - `stop`: Leave the virtual server instance stopped after host failure + The enumerated values for this property are expected to expand in the + future. When processing this property, check for and log unknown values. + Optionally halt processing and surface the error, or bypass the instance on + which the unexpected property value was encountered. """ - self.first = first - self.images = images - self.limit = limit - self.next = next + self.host_failure = host_failure @classmethod - def from_dict(cls, _dict: Dict) -> 'ImageCollection': - """Initialize a ImageCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceAvailabilityPolicy': + """Initialize a InstanceAvailabilityPolicy object from a json dictionary.""" args = {} - if 'first' in _dict: - args['first'] = ImageCollectionFirst.from_dict(_dict.get('first')) - else: - raise ValueError('Required property \'first\' not present in ImageCollection JSON') - if 'images' in _dict: - args['images'] = [Image.from_dict(x) for x in _dict.get('images')] - else: - raise ValueError('Required property \'images\' not present in ImageCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') + if 'host_failure' in _dict: + args['host_failure'] = _dict.get('host_failure') else: - raise ValueError('Required property \'limit\' not present in ImageCollection JSON') - if 'next' in _dict: - args['next'] = ImageCollectionNext.from_dict(_dict.get('next')) + raise ValueError('Required property \'host_failure\' not present in InstanceAvailabilityPolicy JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ImageCollection object from a json dictionary.""" + """Initialize a InstanceAvailabilityPolicy object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'images') and self.images is not None: - _dict['images'] = [x.to_dict() for x in self.images] - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next.to_dict() + if hasattr(self, 'host_failure') and self.host_failure is not None: + _dict['host_failure'] = self.host_failure return _dict def _to_dict(self): @@ -28018,55 +32183,84 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ImageCollection object.""" + """Return a `str` version of this InstanceAvailabilityPolicy object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ImageCollection') -> bool: + def __eq__(self, other: 'InstanceAvailabilityPolicy') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ImageCollection') -> bool: + def __ne__(self, other: 'InstanceAvailabilityPolicy') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ImageCollectionFirst(): + class HostFailureEnum(str, Enum): + """ + The action to perform if the compute host experiences a failure. + - `restart`: Automatically restart the virtual server instance after host failure + - `stop`: Leave the virtual server instance stopped after host failure + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the instance on which the unexpected + property value was encountered. + """ + RESTART = 'restart' + STOP = 'stop' + + +class InstanceAvailabilityPolicyPatch(): """ - A link to the first page of resources. + InstanceAvailabilityPolicyPatch. - :attr str href: The URL for a page of resources. + :attr str host_failure: (optional) The action to perform if the compute host + experiences a failure. + - `restart`: Automatically restart the virtual server instance after host + failure + - `stop`: Leave the virtual server instance stopped after host failure + The enumerated values for this property are expected to expand in the future. + When processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the instance on which the unexpected + property value was encountered. """ def __init__(self, - href: str) -> None: + *, + host_failure: str = None) -> None: """ - Initialize a ImageCollectionFirst object. + Initialize a InstanceAvailabilityPolicyPatch object. - :param str href: The URL for a page of resources. + :param str host_failure: (optional) The action to perform if the compute + host experiences a failure. + - `restart`: Automatically restart the virtual server instance after host + failure + - `stop`: Leave the virtual server instance stopped after host failure + The enumerated values for this property are expected to expand in the + future. When processing this property, check for and log unknown values. + Optionally halt processing and surface the error, or bypass the instance on + which the unexpected property value was encountered. """ - self.href = href + self.host_failure = host_failure @classmethod - def from_dict(cls, _dict: Dict) -> 'ImageCollectionFirst': - """Initialize a ImageCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceAvailabilityPolicyPatch': + """Initialize a InstanceAvailabilityPolicyPatch object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in ImageCollectionFirst JSON') + if 'host_failure' in _dict: + args['host_failure'] = _dict.get('host_failure') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ImageCollectionFirst object from a json dictionary.""" + """Initialize a InstanceAvailabilityPolicyPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'host_failure') and self.host_failure is not None: + _dict['host_failure'] = self.host_failure return _dict def _to_dict(self): @@ -28074,56 +32268,84 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ImageCollectionFirst object.""" + """Return a `str` version of this InstanceAvailabilityPolicyPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ImageCollectionFirst') -> bool: + def __eq__(self, other: 'InstanceAvailabilityPolicyPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ImageCollectionFirst') -> bool: + def __ne__(self, other: 'InstanceAvailabilityPolicyPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ImageCollectionNext(): + class HostFailureEnum(str, Enum): + """ + The action to perform if the compute host experiences a failure. + - `restart`: Automatically restart the virtual server instance after host failure + - `stop`: Leave the virtual server instance stopped after host failure + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the instance on which the unexpected + property value was encountered. + """ + RESTART = 'restart' + STOP = 'stop' + + +class InstanceAvailabilityPrototype(): """ - A link to the next page of resources. This property is present for all pages except - the last page. + InstanceAvailabilityPrototype. - :attr str href: The URL for a page of resources. + :attr str host_failure: (optional) The action to perform if the compute host + experiences a failure. + - `restart`: Automatically restart the virtual server instance after host + failure + - `stop`: Leave the virtual server instance stopped after host failure + The enumerated values for this property are expected to expand in the future. + When processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the instance on which the unexpected + property value was encountered. """ def __init__(self, - href: str) -> None: + *, + host_failure: str = None) -> None: """ - Initialize a ImageCollectionNext object. + Initialize a InstanceAvailabilityPrototype object. - :param str href: The URL for a page of resources. + :param str host_failure: (optional) The action to perform if the compute + host experiences a failure. + - `restart`: Automatically restart the virtual server instance after host + failure + - `stop`: Leave the virtual server instance stopped after host failure + The enumerated values for this property are expected to expand in the + future. When processing this property, check for and log unknown values. + Optionally halt processing and surface the error, or bypass the instance on + which the unexpected property value was encountered. """ - self.href = href + self.host_failure = host_failure @classmethod - def from_dict(cls, _dict: Dict) -> 'ImageCollectionNext': - """Initialize a ImageCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceAvailabilityPrototype': + """Initialize a InstanceAvailabilityPrototype object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in ImageCollectionNext JSON') + if 'host_failure' in _dict: + args['host_failure'] = _dict.get('host_failure') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ImageCollectionNext object from a json dictionary.""" + """Initialize a InstanceAvailabilityPrototype object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'host_failure') and self.host_failure is not None: + _dict['host_failure'] = self.host_failure return _dict def _to_dict(self): @@ -28131,77 +32353,115 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ImageCollectionNext object.""" + """Return a `str` version of this InstanceAvailabilityPrototype object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ImageCollectionNext') -> bool: + def __eq__(self, other: 'InstanceAvailabilityPrototype') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ImageCollectionNext') -> bool: + def __ne__(self, other: 'InstanceAvailabilityPrototype') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ImageFile(): + class HostFailureEnum(str, Enum): + """ + The action to perform if the compute host experiences a failure. + - `restart`: Automatically restart the virtual server instance after host failure + - `stop`: Leave the virtual server instance stopped after host failure + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the instance on which the unexpected + property value was encountered. + """ + RESTART = 'restart' + STOP = 'stop' + + +class InstanceCollection(): """ - ImageFile. + InstanceCollection. - :attr ImageFileChecksums checksums: (optional) Checksums for this image file. - This property may be absent if the associated image has a `status` of `pending` - or - `failed`. - :attr int size: (optional) The size of the stored image file rounded up to the - next gigabyte. - This property may be absent if the associated image has a `status` of `pending` - or - `failed`. + :attr InstanceCollectionFirst first: A link to the first page of resources. + :attr List[Instance] instances: Collection of virtual server instances. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr InstanceCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages + except the last page. + :attr int total_count: The total number of resources across all pages. """ def __init__(self, + first: 'InstanceCollectionFirst', + instances: List['Instance'], + limit: int, + total_count: int, *, - checksums: 'ImageFileChecksums' = None, - size: int = None) -> None: + next: 'InstanceCollectionNext' = None) -> None: """ - Initialize a ImageFile object. + Initialize a InstanceCollection object. - :param ImageFileChecksums checksums: (optional) Checksums for this image - file. - This property may be absent if the associated image has a `status` of - `pending` or - `failed`. - :param int size: (optional) The size of the stored image file rounded up to - the next gigabyte. - This property may be absent if the associated image has a `status` of - `pending` or - `failed`. + :param InstanceCollectionFirst first: A link to the first page of + resources. + :param List[Instance] instances: Collection of virtual server instances. + :param int limit: The maximum number of resources that can be returned by + the request. + :param int total_count: The total number of resources across all pages. + :param InstanceCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages + except the last page. """ - self.checksums = checksums - self.size = size + self.first = first + self.instances = instances + self.limit = limit + self.next = next + self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'ImageFile': - """Initialize a ImageFile object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceCollection': + """Initialize a InstanceCollection object from a json dictionary.""" args = {} - if 'checksums' in _dict: - args['checksums'] = ImageFileChecksums.from_dict(_dict.get('checksums')) - if 'size' in _dict: - args['size'] = _dict.get('size') + if 'first' in _dict: + args['first'] = InstanceCollectionFirst.from_dict(_dict.get('first')) + else: + raise ValueError('Required property \'first\' not present in InstanceCollection JSON') + if 'instances' in _dict: + args['instances'] = [Instance.from_dict(x) for x in _dict.get('instances')] + else: + raise ValueError('Required property \'instances\' not present in InstanceCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') + else: + raise ValueError('Required property \'limit\' not present in InstanceCollection JSON') + if 'next' in _dict: + args['next'] = InstanceCollectionNext.from_dict(_dict.get('next')) + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') + else: + raise ValueError('Required property \'total_count\' not present in InstanceCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ImageFile object from a json dictionary.""" + """Initialize a InstanceCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'checksums') and self.checksums is not None: - _dict['checksums'] = self.checksums.to_dict() - if hasattr(self, 'size') and self.size is not None: - _dict['size'] = self.size + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'instances') and self.instances is not None: + _dict['instances'] = [x.to_dict() for x in self.instances] + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count return _dict def _to_dict(self): @@ -28209,54 +32469,55 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ImageFile object.""" + """Return a `str` version of this InstanceCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ImageFile') -> bool: + def __eq__(self, other: 'InstanceCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ImageFile') -> bool: + def __ne__(self, other: 'InstanceCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ImageFileChecksums(): +class InstanceCollectionFirst(): """ - ImageFileChecksums. + A link to the first page of resources. - :attr str sha256: (optional) The SHA256 fingerprint of the image file. + :attr str href: The URL for a page of resources. """ def __init__(self, - *, - sha256: str = None) -> None: + href: str) -> None: """ - Initialize a ImageFileChecksums object. + Initialize a InstanceCollectionFirst object. - :param str sha256: (optional) The SHA256 fingerprint of the image file. + :param str href: The URL for a page of resources. """ - self.sha256 = sha256 + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'ImageFileChecksums': - """Initialize a ImageFileChecksums object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceCollectionFirst': + """Initialize a InstanceCollectionFirst object from a json dictionary.""" args = {} - if 'sha256' in _dict: - args['sha256'] = _dict.get('sha256') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in InstanceCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ImageFileChecksums object from a json dictionary.""" + """Initialize a InstanceCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'sha256') and self.sha256 is not None: - _dict['sha256'] = self.sha256 + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -28264,48 +32525,49 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ImageFileChecksums object.""" + """Return a `str` version of this InstanceCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ImageFileChecksums') -> bool: + def __eq__(self, other: 'InstanceCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ImageFileChecksums') -> bool: + def __ne__(self, other: 'InstanceCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ImageFilePrototype(): +class InstanceCollectionNext(): """ - ImageFilePrototype. + A link to the next page of resources. This property is present for all pages except + the last page. - :attr str href: The Cloud Object Storage location of the image file. + :attr str href: The URL for a page of resources. """ def __init__(self, href: str) -> None: """ - Initialize a ImageFilePrototype object. + Initialize a InstanceCollectionNext object. - :param str href: The Cloud Object Storage location of the image file. + :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'ImageFilePrototype': - """Initialize a ImageFilePrototype object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceCollectionNext': + """Initialize a InstanceCollectionNext object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in ImageFilePrototype JSON') + raise ValueError('Required property \'href\' not present in InstanceCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ImageFilePrototype object from a json dictionary.""" + """Initialize a InstanceCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -28320,71 +32582,115 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ImageFilePrototype object.""" + """Return a `str` version of this InstanceCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ImageFilePrototype') -> bool: + def __eq__(self, other: 'InstanceCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ImageFilePrototype') -> bool: + def __ne__(self, other: 'InstanceCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ImageIdentity(): - """ - Identifies an image by a unique property. - - """ - - def __init__(self) -> None: - """ - Initialize a ImageIdentity object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['ImageIdentityById', 'ImageIdentityByCRN', 'ImageIdentityByHref'])) - raise Exception(msg) - -class ImagePatch(): +class InstanceConsoleAccessToken(): """ - ImagePatch. + The instance console access token information. - :attr str name: (optional) The unique user-defined name for this image. Names - starting with `ibm-` are not allowed. + :attr str access_token: A URL safe single-use token used to access the console + WebSocket. + :attr str console_type: The instance console type for which this token may be + used. + :attr datetime created_at: The date and time that the access token was created. + :attr datetime expires_at: The date and time that the access token will expire. + :attr bool force: Indicates whether to disconnect an existing serial console + session as the serial console cannot be shared. This has no effect on VNC + consoles. + :attr str href: The URL to access this instance console. """ def __init__(self, - *, - name: str = None) -> None: + access_token: str, + console_type: str, + created_at: datetime, + expires_at: datetime, + force: bool, + href: str) -> None: """ - Initialize a ImagePatch object. + Initialize a InstanceConsoleAccessToken object. - :param str name: (optional) The unique user-defined name for this image. - Names starting with `ibm-` are not allowed. + :param str access_token: A URL safe single-use token used to access the + console WebSocket. + :param str console_type: The instance console type for which this token may + be used. + :param datetime created_at: The date and time that the access token was + created. + :param datetime expires_at: The date and time that the access token will + expire. + :param bool force: Indicates whether to disconnect an existing serial + console session as the serial console cannot be shared. This has no effect + on VNC consoles. + :param str href: The URL to access this instance console. """ - self.name = name + self.access_token = access_token + self.console_type = console_type + self.created_at = created_at + self.expires_at = expires_at + self.force = force + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'ImagePatch': - """Initialize a ImagePatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceConsoleAccessToken': + """Initialize a InstanceConsoleAccessToken object from a json dictionary.""" args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') + if 'access_token' in _dict: + args['access_token'] = _dict.get('access_token') + else: + raise ValueError('Required property \'access_token\' not present in InstanceConsoleAccessToken JSON') + if 'console_type' in _dict: + args['console_type'] = _dict.get('console_type') + else: + raise ValueError('Required property \'console_type\' not present in InstanceConsoleAccessToken JSON') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) + else: + raise ValueError('Required property \'created_at\' not present in InstanceConsoleAccessToken JSON') + if 'expires_at' in _dict: + args['expires_at'] = string_to_datetime(_dict.get('expires_at')) + else: + raise ValueError('Required property \'expires_at\' not present in InstanceConsoleAccessToken JSON') + if 'force' in _dict: + args['force'] = _dict.get('force') + else: + raise ValueError('Required property \'force\' not present in InstanceConsoleAccessToken JSON') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in InstanceConsoleAccessToken JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ImagePatch object from a json dictionary.""" + """Initialize a InstanceConsoleAccessToken object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name + if hasattr(self, 'access_token') and self.access_token is not None: + _dict['access_token'] = self.access_token + if hasattr(self, 'console_type') and self.console_type is not None: + _dict['console_type'] = self.console_type + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'expires_at') and self.expires_at is not None: + _dict['expires_at'] = datetime_to_string(self.expires_at) + if hasattr(self, 'force') and self.force is not None: + _dict['force'] = self.force + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -28392,129 +32698,84 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ImagePatch object.""" + """Return a `str` version of this InstanceConsoleAccessToken object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ImagePatch') -> bool: + def __eq__(self, other: 'InstanceConsoleAccessToken') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ImagePatch') -> bool: + def __ne__(self, other: 'InstanceConsoleAccessToken') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ImagePrototype(): - """ - ImagePrototype. - - :attr str name: (optional) The unique user-defined name for this image. Names - starting with `ibm-` are not allowed. If unspecified, the name will be a - hyphenated list of randomly-selected words. - :attr ResourceGroupIdentity resource_group: (optional) The resource group to - use. If unspecified, the account's [default resource - group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - """ - - def __init__(self, - *, - name: str = None, - resource_group: 'ResourceGroupIdentity' = None) -> None: + class ConsoleTypeEnum(str, Enum): """ - Initialize a ImagePrototype object. - - :param str name: (optional) The unique user-defined name for this image. - Names starting with `ibm-` are not allowed. If unspecified, the name will - be a hyphenated list of randomly-selected words. - :param ResourceGroupIdentity resource_group: (optional) The resource group - to use. If unspecified, the account's [default resource - group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is - used. + The instance console type for which this token may be used. """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['ImagePrototypeImageByFile', 'ImagePrototypeImageBySourceVolume'])) - raise Exception(msg) + SERIAL = 'serial' + VNC = 'vnc' -class ImageReference(): + +class InstanceDefaultTrustedProfilePrototype(): """ - ImageReference. + InstanceDefaultTrustedProfilePrototype. - :attr str crn: The CRN for this image. - :attr ImageReferenceDeleted deleted: (optional) If present, this property - indicates the referenced resource has been deleted and provides - some supplementary information. - :attr str href: The URL for this image. - :attr str id: The unique identifier for this image. - :attr str name: The user-defined or system-provided name for this image. + :attr bool auto_link: (optional) If set to `true`, the system will create a link + to the specified `target` trusted profile during instance creation. Regardless + of whether a link is created by the system or manually using the IAM Identity + service, it will be automatically deleted when the instance is deleted. + :attr TrustedProfileIdentity target: The default IAM trusted profile to use for + this virtual server instance. """ def __init__(self, - crn: str, - href: str, - id: str, - name: str, + target: 'TrustedProfileIdentity', *, - deleted: 'ImageReferenceDeleted' = None) -> None: + auto_link: bool = None) -> None: """ - Initialize a ImageReference object. + Initialize a InstanceDefaultTrustedProfilePrototype object. - :param str crn: The CRN for this image. - :param str href: The URL for this image. - :param str id: The unique identifier for this image. - :param str name: The user-defined or system-provided name for this image. - :param ImageReferenceDeleted deleted: (optional) If present, this property - indicates the referenced resource has been deleted and provides - some supplementary information. + :param TrustedProfileIdentity target: The default IAM trusted profile to + use for this virtual server instance. + :param bool auto_link: (optional) If set to `true`, the system will create + a link to the specified `target` trusted profile during instance creation. + Regardless of whether a link is created by the system or manually using the + IAM Identity service, it will be automatically deleted when the instance is + deleted. """ - self.crn = crn - self.deleted = deleted - self.href = href - self.id = id - self.name = name + self.auto_link = auto_link + self.target = target @classmethod - def from_dict(cls, _dict: Dict) -> 'ImageReference': - """Initialize a ImageReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceDefaultTrustedProfilePrototype': + """Initialize a InstanceDefaultTrustedProfilePrototype object from a json dictionary.""" args = {} - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in ImageReference JSON') - if 'deleted' in _dict: - args['deleted'] = ImageReferenceDeleted.from_dict(_dict.get('deleted')) - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in ImageReference JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in ImageReference JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') + if 'auto_link' in _dict: + args['auto_link'] = _dict.get('auto_link') + if 'target' in _dict: + args['target'] = _dict.get('target') else: - raise ValueError('Required property \'name\' not present in ImageReference JSON') + raise ValueError('Required property \'target\' not present in InstanceDefaultTrustedProfilePrototype JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ImageReference object from a json dictionary.""" + """Initialize a InstanceDefaultTrustedProfilePrototype object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name + if hasattr(self, 'auto_link') and self.auto_link is not None: + _dict['auto_link'] = self.auto_link + if hasattr(self, 'target') and self.target is not None: + if isinstance(self.target, dict): + _dict['target'] = self.target + else: + _dict['target'] = self.target.to_dict() return _dict def _to_dict(self): @@ -28522,56 +32783,123 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ImageReference object.""" + """Return a `str` version of this InstanceDefaultTrustedProfilePrototype object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ImageReference') -> bool: + def __eq__(self, other: 'InstanceDefaultTrustedProfilePrototype') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ImageReference') -> bool: + def __ne__(self, other: 'InstanceDefaultTrustedProfilePrototype') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ImageReferenceDeleted(): +class InstanceDisk(): """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. + InstanceDisk. - :attr str more_info: Link to documentation about deleted resources. + :attr datetime created_at: The date and time that the disk was created. + :attr str href: The URL for this instance disk. + :attr str id: The unique identifier for this instance disk. + :attr str interface_type: The disk interface used for attaching the disk. + The enumerated values for this property are expected to expand in the future. + When processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the resource on which the unexpected + property value was encountered. + :attr str name: The user-defined name for this disk. + :attr str resource_type: The resource type. + :attr int size: The size of the disk in GB (gigabytes). """ def __init__(self, - more_info: str) -> None: + created_at: datetime, + href: str, + id: str, + interface_type: str, + name: str, + resource_type: str, + size: int) -> None: """ - Initialize a ImageReferenceDeleted object. + Initialize a InstanceDisk object. - :param str more_info: Link to documentation about deleted resources. + :param datetime created_at: The date and time that the disk was created. + :param str href: The URL for this instance disk. + :param str id: The unique identifier for this instance disk. + :param str interface_type: The disk interface used for attaching the disk. + The enumerated values for this property are expected to expand in the + future. When processing this property, check for and log unknown values. + Optionally halt processing and surface the error, or bypass the resource on + which the unexpected property value was encountered. + :param str name: The user-defined name for this disk. + :param str resource_type: The resource type. + :param int size: The size of the disk in GB (gigabytes). """ - self.more_info = more_info + self.created_at = created_at + self.href = href + self.id = id + self.interface_type = interface_type + self.name = name + self.resource_type = resource_type + self.size = size @classmethod - def from_dict(cls, _dict: Dict) -> 'ImageReferenceDeleted': - """Initialize a ImageReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceDisk': + """Initialize a InstanceDisk object from a json dictionary.""" args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError('Required property \'more_info\' not present in ImageReferenceDeleted JSON') + raise ValueError('Required property \'created_at\' not present in InstanceDisk JSON') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in InstanceDisk JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in InstanceDisk JSON') + if 'interface_type' in _dict: + args['interface_type'] = _dict.get('interface_type') + else: + raise ValueError('Required property \'interface_type\' not present in InstanceDisk JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in InstanceDisk JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in InstanceDisk JSON') + if 'size' in _dict: + args['size'] = _dict.get('size') + else: + raise ValueError('Required property \'size\' not present in InstanceDisk JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ImageReferenceDeleted object from a json dictionary.""" + """Initialize a InstanceDisk object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'interface_type') and self.interface_type is not None: + _dict['interface_type'] = self.interface_type + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + if hasattr(self, 'size') and self.size is not None: + _dict['size'] = self.size return _dict def _to_dict(self): @@ -28579,76 +32907,74 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ImageReferenceDeleted object.""" + """Return a `str` version of this InstanceDisk object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ImageReferenceDeleted') -> bool: + def __eq__(self, other: 'InstanceDisk') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ImageReferenceDeleted') -> bool: + def __ne__(self, other: 'InstanceDisk') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ImageStatusReason(): + class InterfaceTypeEnum(str, Enum): + """ + The disk interface used for attaching the disk. + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the resource on which the unexpected + property value was encountered. + """ + NVME = 'nvme' + VIRTIO_BLK = 'virtio_blk' + + + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + INSTANCE_DISK = 'instance_disk' + + +class InstanceDiskCollection(): """ - ImageStatusReason. + InstanceDiskCollection. - :attr str code: A snake case string succinctly identifying the status reason. - :attr str message: An explanation of the status reason. - :attr str more_info: (optional) Link to documentation about this status reason. + :attr List[InstanceDisk] disks: Collection of the instance's disks. """ def __init__(self, - code: str, - message: str, - *, - more_info: str = None) -> None: + disks: List['InstanceDisk']) -> None: """ - Initialize a ImageStatusReason object. + Initialize a InstanceDiskCollection object. - :param str code: A snake case string succinctly identifying the status - reason. - :param str message: An explanation of the status reason. - :param str more_info: (optional) Link to documentation about this status - reason. + :param List[InstanceDisk] disks: Collection of the instance's disks. """ - self.code = code - self.message = message - self.more_info = more_info + self.disks = disks @classmethod - def from_dict(cls, _dict: Dict) -> 'ImageStatusReason': - """Initialize a ImageStatusReason object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceDiskCollection': + """Initialize a InstanceDiskCollection object from a json dictionary.""" args = {} - if 'code' in _dict: - args['code'] = _dict.get('code') - else: - raise ValueError('Required property \'code\' not present in ImageStatusReason JSON') - if 'message' in _dict: - args['message'] = _dict.get('message') + if 'disks' in _dict: + args['disks'] = [InstanceDisk.from_dict(x) for x in _dict.get('disks')] else: - raise ValueError('Required property \'message\' not present in ImageStatusReason JSON') - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') + raise ValueError('Required property \'disks\' not present in InstanceDiskCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ImageStatusReason object from a json dictionary.""" + """Initialize a InstanceDiskCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'code') and self.code is not None: - _dict['code'] = self.code - if hasattr(self, 'message') and self.message is not None: - _dict['message'] = self.message - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'disks') and self.disks is not None: + _dict['disks'] = [x.to_dict() for x in self.disks] return _dict def _to_dict(self): @@ -28656,398 +32982,54 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ImageStatusReason object.""" + """Return a `str` version of this InstanceDiskCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ImageStatusReason') -> bool: + def __eq__(self, other: 'InstanceDiskCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ImageStatusReason') -> bool: + def __ne__(self, other: 'InstanceDiskCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class CodeEnum(str, Enum): - """ - A snake case string succinctly identifying the status reason. - """ - ENCRYPTION_KEY_DELETED = 'encryption_key_deleted' - ENCRYPTION_KEY_DISABLED = 'encryption_key_disabled' - IMAGE_REQUEST_IN_PROGRESS = 'image_request_in_progress' - IMAGE_REQUEST_QUEUED = 'image_request_queued' - - -class Instance(): +class InstanceDiskPatch(): """ - Instance. + InstanceDiskPatch. - :attr InstanceAvailabilityPolicy availability_policy: The availability policy - for this virtual server instance. - :attr int bandwidth: The total bandwidth (in megabits per second) shared across - the virtual server instance's network interfaces and storage volumes. - :attr VolumeAttachmentReferenceInstanceContext boot_volume_attachment: Boot - volume attachment. - :attr datetime created_at: The date and time that the virtual server instance - was created. - :attr str crn: The CRN for this virtual server instance. - :attr DedicatedHostReference dedicated_host: (optional) If present, the - dedicated host this virtual server instance has been placed on. - :attr List[InstanceDisk] disks: The instance disks for this virtual server - instance. - :attr InstanceGPU gpu: (optional) The virtual server instance GPU configuration. - :attr str href: The URL for this virtual server instance. - :attr str id: The unique identifier for this virtual server instance. - :attr ImageReference image: (optional) The image the virtual server instance was - provisioned from. - :attr int memory: The amount of memory, truncated to whole gibibytes. - :attr InstanceMetadataService metadata_service: The metadata service - configuration. - :attr str name: The user-defined name for this virtual server instance (and - default system hostname). - :attr List[NetworkInterfaceInstanceContextReference] network_interfaces: The - network interfaces for this virtual server instance, including the primary - network interface. - :attr InstancePlacementTarget placement_target: (optional) The placement - restrictions for the virtual server instance. - :attr NetworkInterfaceInstanceContextReference primary_network_interface: - Primary network interface. - :attr InstanceProfileReference profile: The profile for this virtual server - instance. - :attr ResourceGroupReference resource_group: The resource group for this - instance. - :attr str resource_type: The resource type. - :attr bool startable: Indicates whether the state of the virtual server instance - permits a start request. - :attr str status: The status of the virtual server instance. - :attr List[InstanceStatusReason] status_reasons: The reasons for the current - status (if any). - The enumerated reason code values for this property will expand in the future. - When processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the resource on which the unexpected - reason code was encountered. - :attr int total_network_bandwidth: The amount of bandwidth (in megabits per - second) allocated exclusively to instance network interfaces. - :attr int total_volume_bandwidth: The amount of bandwidth (in megabits per - second) allocated exclusively to instance storage volumes. An increase in this - value will result in a corresponding decrease to - `total_network_bandwidth`. - :attr InstanceVCPU vcpu: The virtual server instance VCPU configuration. - :attr List[VolumeAttachmentReferenceInstanceContext] volume_attachments: The - volume attachments for this virtual server instance, including the boot volume - attachment. - :attr VPCReference vpc: The VPC this virtual server instance resides in. - :attr ZoneReference zone: The zone this virtual server instance resides in. + :attr str name: (optional) The user-defined name for this disk. """ def __init__(self, - availability_policy: 'InstanceAvailabilityPolicy', - bandwidth: int, - boot_volume_attachment: 'VolumeAttachmentReferenceInstanceContext', - created_at: datetime, - crn: str, - disks: List['InstanceDisk'], - href: str, - id: str, - memory: int, - metadata_service: 'InstanceMetadataService', - name: str, - network_interfaces: List['NetworkInterfaceInstanceContextReference'], - primary_network_interface: 'NetworkInterfaceInstanceContextReference', - profile: 'InstanceProfileReference', - resource_group: 'ResourceGroupReference', - resource_type: str, - startable: bool, - status: str, - status_reasons: List['InstanceStatusReason'], - total_network_bandwidth: int, - total_volume_bandwidth: int, - vcpu: 'InstanceVCPU', - volume_attachments: List['VolumeAttachmentReferenceInstanceContext'], - vpc: 'VPCReference', - zone: 'ZoneReference', *, - dedicated_host: 'DedicatedHostReference' = None, - gpu: 'InstanceGPU' = None, - image: 'ImageReference' = None, - placement_target: 'InstancePlacementTarget' = None) -> None: + name: str = None) -> None: """ - Initialize a Instance object. + Initialize a InstanceDiskPatch object. - :param InstanceAvailabilityPolicy availability_policy: The availability - policy for this virtual server instance. - :param int bandwidth: The total bandwidth (in megabits per second) shared - across the virtual server instance's network interfaces and storage - volumes. - :param VolumeAttachmentReferenceInstanceContext boot_volume_attachment: - Boot volume attachment. - :param datetime created_at: The date and time that the virtual server - instance was created. - :param str crn: The CRN for this virtual server instance. - :param List[InstanceDisk] disks: The instance disks for this virtual server - instance. - :param str href: The URL for this virtual server instance. - :param str id: The unique identifier for this virtual server instance. - :param int memory: The amount of memory, truncated to whole gibibytes. - :param InstanceMetadataService metadata_service: The metadata service - configuration. - :param str name: The user-defined name for this virtual server instance - (and default system hostname). - :param List[NetworkInterfaceInstanceContextReference] network_interfaces: - The network interfaces for this virtual server instance, including the - primary network interface. - :param NetworkInterfaceInstanceContextReference primary_network_interface: - Primary network interface. - :param InstanceProfileReference profile: The profile for this virtual - server instance. - :param ResourceGroupReference resource_group: The resource group for this - instance. - :param str resource_type: The resource type. - :param bool startable: Indicates whether the state of the virtual server - instance permits a start request. - :param str status: The status of the virtual server instance. - :param List[InstanceStatusReason] status_reasons: The reasons for the - current status (if any). - The enumerated reason code values for this property will expand in the - future. When processing this property, check for and log unknown values. - Optionally halt processing and surface the error, or bypass the resource on - which the unexpected reason code was encountered. - :param int total_network_bandwidth: The amount of bandwidth (in megabits - per second) allocated exclusively to instance network interfaces. - :param int total_volume_bandwidth: The amount of bandwidth (in megabits per - second) allocated exclusively to instance storage volumes. An increase in - this value will result in a corresponding decrease to - `total_network_bandwidth`. - :param InstanceVCPU vcpu: The virtual server instance VCPU configuration. - :param List[VolumeAttachmentReferenceInstanceContext] volume_attachments: - The volume attachments for this virtual server instance, including the boot - volume attachment. - :param VPCReference vpc: The VPC this virtual server instance resides in. - :param ZoneReference zone: The zone this virtual server instance resides - in. - :param DedicatedHostReference dedicated_host: (optional) If present, the - dedicated host this virtual server instance has been placed on. - :param InstanceGPU gpu: (optional) The virtual server instance GPU - configuration. - :param ImageReference image: (optional) The image the virtual server - instance was provisioned from. - :param InstancePlacementTarget placement_target: (optional) The placement - restrictions for the virtual server instance. + :param str name: (optional) The user-defined name for this disk. """ - self.availability_policy = availability_policy - self.bandwidth = bandwidth - self.boot_volume_attachment = boot_volume_attachment - self.created_at = created_at - self.crn = crn - self.dedicated_host = dedicated_host - self.disks = disks - self.gpu = gpu - self.href = href - self.id = id - self.image = image - self.memory = memory - self.metadata_service = metadata_service self.name = name - self.network_interfaces = network_interfaces - self.placement_target = placement_target - self.primary_network_interface = primary_network_interface - self.profile = profile - self.resource_group = resource_group - self.resource_type = resource_type - self.startable = startable - self.status = status - self.status_reasons = status_reasons - self.total_network_bandwidth = total_network_bandwidth - self.total_volume_bandwidth = total_volume_bandwidth - self.vcpu = vcpu - self.volume_attachments = volume_attachments - self.vpc = vpc - self.zone = zone @classmethod - def from_dict(cls, _dict: Dict) -> 'Instance': - """Initialize a Instance object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceDiskPatch': + """Initialize a InstanceDiskPatch object from a json dictionary.""" args = {} - if 'availability_policy' in _dict: - args['availability_policy'] = InstanceAvailabilityPolicy.from_dict(_dict.get('availability_policy')) - else: - raise ValueError('Required property \'availability_policy\' not present in Instance JSON') - if 'bandwidth' in _dict: - args['bandwidth'] = _dict.get('bandwidth') - else: - raise ValueError('Required property \'bandwidth\' not present in Instance JSON') - if 'boot_volume_attachment' in _dict: - args['boot_volume_attachment'] = VolumeAttachmentReferenceInstanceContext.from_dict(_dict.get('boot_volume_attachment')) - else: - raise ValueError('Required property \'boot_volume_attachment\' not present in Instance JSON') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - else: - raise ValueError('Required property \'created_at\' not present in Instance JSON') - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in Instance JSON') - if 'dedicated_host' in _dict: - args['dedicated_host'] = DedicatedHostReference.from_dict(_dict.get('dedicated_host')) - if 'disks' in _dict: - args['disks'] = [InstanceDisk.from_dict(x) for x in _dict.get('disks')] - else: - raise ValueError('Required property \'disks\' not present in Instance JSON') - if 'gpu' in _dict: - args['gpu'] = InstanceGPU.from_dict(_dict.get('gpu')) - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in Instance JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in Instance JSON') - if 'image' in _dict: - args['image'] = ImageReference.from_dict(_dict.get('image')) - if 'memory' in _dict: - args['memory'] = _dict.get('memory') - else: - raise ValueError('Required property \'memory\' not present in Instance JSON') - if 'metadata_service' in _dict: - args['metadata_service'] = InstanceMetadataService.from_dict(_dict.get('metadata_service')) - else: - raise ValueError('Required property \'metadata_service\' not present in Instance JSON') if 'name' in _dict: args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in Instance JSON') - if 'network_interfaces' in _dict: - args['network_interfaces'] = [NetworkInterfaceInstanceContextReference.from_dict(x) for x in _dict.get('network_interfaces')] - else: - raise ValueError('Required property \'network_interfaces\' not present in Instance JSON') - if 'placement_target' in _dict: - args['placement_target'] = _dict.get('placement_target') - if 'primary_network_interface' in _dict: - args['primary_network_interface'] = NetworkInterfaceInstanceContextReference.from_dict(_dict.get('primary_network_interface')) - else: - raise ValueError('Required property \'primary_network_interface\' not present in Instance JSON') - if 'profile' in _dict: - args['profile'] = InstanceProfileReference.from_dict(_dict.get('profile')) - else: - raise ValueError('Required property \'profile\' not present in Instance JSON') - if 'resource_group' in _dict: - args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) - else: - raise ValueError('Required property \'resource_group\' not present in Instance JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in Instance JSON') - if 'startable' in _dict: - args['startable'] = _dict.get('startable') - else: - raise ValueError('Required property \'startable\' not present in Instance JSON') - if 'status' in _dict: - args['status'] = _dict.get('status') - else: - raise ValueError('Required property \'status\' not present in Instance JSON') - if 'status_reasons' in _dict: - args['status_reasons'] = [InstanceStatusReason.from_dict(x) for x in _dict.get('status_reasons')] - else: - raise ValueError('Required property \'status_reasons\' not present in Instance JSON') - if 'total_network_bandwidth' in _dict: - args['total_network_bandwidth'] = _dict.get('total_network_bandwidth') - else: - raise ValueError('Required property \'total_network_bandwidth\' not present in Instance JSON') - if 'total_volume_bandwidth' in _dict: - args['total_volume_bandwidth'] = _dict.get('total_volume_bandwidth') - else: - raise ValueError('Required property \'total_volume_bandwidth\' not present in Instance JSON') - if 'vcpu' in _dict: - args['vcpu'] = InstanceVCPU.from_dict(_dict.get('vcpu')) - else: - raise ValueError('Required property \'vcpu\' not present in Instance JSON') - if 'volume_attachments' in _dict: - args['volume_attachments'] = [VolumeAttachmentReferenceInstanceContext.from_dict(x) for x in _dict.get('volume_attachments')] - else: - raise ValueError('Required property \'volume_attachments\' not present in Instance JSON') - if 'vpc' in _dict: - args['vpc'] = VPCReference.from_dict(_dict.get('vpc')) - else: - raise ValueError('Required property \'vpc\' not present in Instance JSON') - if 'zone' in _dict: - args['zone'] = ZoneReference.from_dict(_dict.get('zone')) - else: - raise ValueError('Required property \'zone\' not present in Instance JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a Instance object from a json dictionary.""" + """Initialize a InstanceDiskPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'availability_policy') and self.availability_policy is not None: - _dict['availability_policy'] = self.availability_policy.to_dict() - if hasattr(self, 'bandwidth') and self.bandwidth is not None: - _dict['bandwidth'] = self.bandwidth - if hasattr(self, 'boot_volume_attachment') and self.boot_volume_attachment is not None: - _dict['boot_volume_attachment'] = self.boot_volume_attachment.to_dict() - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - if hasattr(self, 'dedicated_host') and self.dedicated_host is not None: - _dict['dedicated_host'] = self.dedicated_host.to_dict() - if hasattr(self, 'disks') and self.disks is not None: - _dict['disks'] = [x.to_dict() for x in self.disks] - if hasattr(self, 'gpu') and self.gpu is not None: - _dict['gpu'] = self.gpu.to_dict() - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'image') and self.image is not None: - _dict['image'] = self.image.to_dict() - if hasattr(self, 'memory') and self.memory is not None: - _dict['memory'] = self.memory - if hasattr(self, 'metadata_service') and self.metadata_service is not None: - _dict['metadata_service'] = self.metadata_service.to_dict() if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'network_interfaces') and self.network_interfaces is not None: - _dict['network_interfaces'] = [x.to_dict() for x in self.network_interfaces] - if hasattr(self, 'placement_target') and self.placement_target is not None: - if isinstance(self.placement_target, dict): - _dict['placement_target'] = self.placement_target - else: - _dict['placement_target'] = self.placement_target.to_dict() - if hasattr(self, 'primary_network_interface') and self.primary_network_interface is not None: - _dict['primary_network_interface'] = self.primary_network_interface.to_dict() - if hasattr(self, 'profile') and self.profile is not None: - _dict['profile'] = self.profile.to_dict() - if hasattr(self, 'resource_group') and self.resource_group is not None: - _dict['resource_group'] = self.resource_group.to_dict() - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type - if hasattr(self, 'startable') and self.startable is not None: - _dict['startable'] = self.startable - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status - if hasattr(self, 'status_reasons') and self.status_reasons is not None: - _dict['status_reasons'] = [x.to_dict() for x in self.status_reasons] - if hasattr(self, 'total_network_bandwidth') and self.total_network_bandwidth is not None: - _dict['total_network_bandwidth'] = self.total_network_bandwidth - if hasattr(self, 'total_volume_bandwidth') and self.total_volume_bandwidth is not None: - _dict['total_volume_bandwidth'] = self.total_volume_bandwidth - if hasattr(self, 'vcpu') and self.vcpu is not None: - _dict['vcpu'] = self.vcpu.to_dict() - if hasattr(self, 'volume_attachments') and self.volume_attachments is not None: - _dict['volume_attachments'] = [x.to_dict() for x in self.volume_attachments] - if hasattr(self, 'vpc') and self.vpc is not None: - _dict['vpc'] = self.vpc.to_dict() - if hasattr(self, 'zone') and self.zone is not None: - _dict['zone'] = self.zone.to_dict() return _dict def _to_dict(self): @@ -29055,150 +33037,98 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this Instance object.""" + """Return a `str` version of this InstanceDiskPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'Instance') -> bool: + def __eq__(self, other: 'InstanceDiskPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'Instance') -> bool: + def __ne__(self, other: 'InstanceDiskPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ResourceTypeEnum(str, Enum): - """ - The resource type. - """ - INSTANCE = 'instance' - - - class StatusEnum(str, Enum): - """ - The status of the virtual server instance. - """ - DELETING = 'deleting' - FAILED = 'failed' - PAUSED = 'paused' - PAUSING = 'pausing' - PENDING = 'pending' - RESTARTING = 'restarting' - RESUMING = 'resuming' - RUNNING = 'running' - STARTING = 'starting' - STOPPED = 'stopped' - STOPPING = 'stopping' - - -class InstanceAction(): +class InstanceDiskReference(): """ - InstanceAction. + InstanceDiskReference. - :attr datetime completed_at: (optional) The date and time that the action was - completed. - :attr datetime created_at: The date and time that the action was created. - :attr bool force: (optional) If set to true, the action will be forced - immediately, and all queued actions deleted. Ignored for the start action. - :attr str href: The URL for this instance action. - :attr str id: The identifier for this instance action. - :attr datetime started_at: (optional) The date and time that the action was - started. - :attr str status: The current status of this action. - :attr str type: The type of action. + :attr InstanceDiskReferenceDeleted deleted: (optional) If present, this property + indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str href: The URL for this instance disk. + :attr str id: The unique identifier for this instance disk. + :attr str name: The user-defined name for this disk. + :attr str resource_type: The resource type. """ def __init__(self, - created_at: datetime, href: str, id: str, - status: str, - type: str, + name: str, + resource_type: str, *, - completed_at: datetime = None, - force: bool = None, - started_at: datetime = None) -> None: + deleted: 'InstanceDiskReferenceDeleted' = None) -> None: """ - Initialize a InstanceAction object. + Initialize a InstanceDiskReference object. - :param datetime created_at: The date and time that the action was created. - :param str href: The URL for this instance action. - :param str id: The identifier for this instance action. - :param str status: The current status of this action. - :param str type: The type of action. - :param datetime completed_at: (optional) The date and time that the action - was completed. - :param bool force: (optional) If set to true, the action will be forced - immediately, and all queued actions deleted. Ignored for the start action. - :param datetime started_at: (optional) The date and time that the action - was started. + :param str href: The URL for this instance disk. + :param str id: The unique identifier for this instance disk. + :param str name: The user-defined name for this disk. + :param str resource_type: The resource type. + :param InstanceDiskReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides + some supplementary information. """ - self.completed_at = completed_at - self.created_at = created_at - self.force = force + self.deleted = deleted self.href = href self.id = id - self.started_at = started_at - self.status = status - self.type = type + self.name = name + self.resource_type = resource_type @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceAction': - """Initialize a InstanceAction object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceDiskReference': + """Initialize a InstanceDiskReference object from a json dictionary.""" args = {} - if 'completed_at' in _dict: - args['completed_at'] = string_to_datetime(_dict.get('completed_at')) - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - else: - raise ValueError('Required property \'created_at\' not present in InstanceAction JSON') - if 'force' in _dict: - args['force'] = _dict.get('force') + if 'deleted' in _dict: + args['deleted'] = InstanceDiskReferenceDeleted.from_dict(_dict.get('deleted')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in InstanceAction JSON') + raise ValueError('Required property \'href\' not present in InstanceDiskReference JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in InstanceAction JSON') - if 'started_at' in _dict: - args['started_at'] = string_to_datetime(_dict.get('started_at')) - if 'status' in _dict: - args['status'] = _dict.get('status') + raise ValueError('Required property \'id\' not present in InstanceDiskReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') else: - raise ValueError('Required property \'status\' not present in InstanceAction JSON') - if 'type' in _dict: - args['type'] = _dict.get('type') + raise ValueError('Required property \'name\' not present in InstanceDiskReference JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') else: - raise ValueError('Required property \'type\' not present in InstanceAction JSON') + raise ValueError('Required property \'resource_type\' not present in InstanceDiskReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceAction object from a json dictionary.""" + """Initialize a InstanceDiskReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'completed_at') and self.completed_at is not None: - _dict['completed_at'] = datetime_to_string(self.completed_at) - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'force') and self.force is not None: - _dict['force'] = self.force + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id - if hasattr(self, 'started_at') and self.started_at is not None: - _dict['started_at'] = datetime_to_string(self.started_at) - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type return _dict def _to_dict(self): @@ -29206,90 +33136,63 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceAction object.""" + """Return a `str` version of this InstanceDiskReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceAction') -> bool: + def __eq__(self, other: 'InstanceDiskReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceAction') -> bool: + def __ne__(self, other: 'InstanceDiskReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class StatusEnum(str, Enum): - """ - The current status of this action. - """ - COMPLETED = 'completed' - FAILED = 'failed' - PENDING = 'pending' - RUNNING = 'running' - - - class TypeEnum(str, Enum): + class ResourceTypeEnum(str, Enum): """ - The type of action. + The resource type. """ - REBOOT = 'reboot' - START = 'start' - STOP = 'stop' + INSTANCE_DISK = 'instance_disk' -class InstanceAvailabilityPolicy(): +class InstanceDiskReferenceDeleted(): """ - InstanceAvailabilityPolicy. + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. - :attr str host_failure: The action to perform if the compute host experiences a - failure. - - `restart`: Automatically restart the virtual server instance after host - failure - - `stop`: Leave the virtual server instance stopped after host failure - The enumerated values for this property are expected to expand in the future. - When processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the instance on which the unexpected - property value was encountered. + :attr str more_info: Link to documentation about deleted resources. """ def __init__(self, - host_failure: str) -> None: + more_info: str) -> None: """ - Initialize a InstanceAvailabilityPolicy object. + Initialize a InstanceDiskReferenceDeleted object. - :param str host_failure: The action to perform if the compute host - experiences a failure. - - `restart`: Automatically restart the virtual server instance after host - failure - - `stop`: Leave the virtual server instance stopped after host failure - The enumerated values for this property are expected to expand in the - future. When processing this property, check for and log unknown values. - Optionally halt processing and surface the error, or bypass the instance on - which the unexpected property value was encountered. + :param str more_info: Link to documentation about deleted resources. """ - self.host_failure = host_failure + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceAvailabilityPolicy': - """Initialize a InstanceAvailabilityPolicy object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceDiskReferenceDeleted': + """Initialize a InstanceDiskReferenceDeleted object from a json dictionary.""" args = {} - if 'host_failure' in _dict: - args['host_failure'] = _dict.get('host_failure') + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'host_failure\' not present in InstanceAvailabilityPolicy JSON') + raise ValueError('Required property \'more_info\' not present in InstanceDiskReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceAvailabilityPolicy object from a json dictionary.""" + """Initialize a InstanceDiskReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'host_failure') and self.host_failure is not None: - _dict['host_failure'] = self.host_failure + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -29297,84 +33200,85 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceAvailabilityPolicy object.""" + """Return a `str` version of this InstanceDiskReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceAvailabilityPolicy') -> bool: + def __eq__(self, other: 'InstanceDiskReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceAvailabilityPolicy') -> bool: + def __ne__(self, other: 'InstanceDiskReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class HostFailureEnum(str, Enum): - """ - The action to perform if the compute host experiences a failure. - - `restart`: Automatically restart the virtual server instance after host failure - - `stop`: Leave the virtual server instance stopped after host failure - The enumerated values for this property are expected to expand in the future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the instance on which the unexpected - property value was encountered. - """ - RESTART = 'restart' - STOP = 'stop' - - -class InstanceAvailabilityPolicyPatch(): +class InstanceGPU(): """ - InstanceAvailabilityPolicyPatch. + The virtual server instance GPU configuration. - :attr str host_failure: (optional) The action to perform if the compute host - experiences a failure. - - `restart`: Automatically restart the virtual server instance after host - failure - - `stop`: Leave the virtual server instance stopped after host failure - The enumerated values for this property are expected to expand in the future. - When processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the instance on which the unexpected - property value was encountered. + :attr int count: The number of GPUs assigned to the instance. + :attr str manufacturer: The GPU manufacturer. + :attr int memory: The overall amount of GPU memory in GiB (gibibytes). + :attr str model: The GPU model. """ def __init__(self, - *, - host_failure: str = None) -> None: + count: int, + manufacturer: str, + memory: int, + model: str) -> None: """ - Initialize a InstanceAvailabilityPolicyPatch object. + Initialize a InstanceGPU object. - :param str host_failure: (optional) The action to perform if the compute - host experiences a failure. - - `restart`: Automatically restart the virtual server instance after host - failure - - `stop`: Leave the virtual server instance stopped after host failure - The enumerated values for this property are expected to expand in the - future. When processing this property, check for and log unknown values. - Optionally halt processing and surface the error, or bypass the instance on - which the unexpected property value was encountered. + :param int count: The number of GPUs assigned to the instance. + :param str manufacturer: The GPU manufacturer. + :param int memory: The overall amount of GPU memory in GiB (gibibytes). + :param str model: The GPU model. """ - self.host_failure = host_failure + self.count = count + self.manufacturer = manufacturer + self.memory = memory + self.model = model @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceAvailabilityPolicyPatch': - """Initialize a InstanceAvailabilityPolicyPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGPU': + """Initialize a InstanceGPU object from a json dictionary.""" args = {} - if 'host_failure' in _dict: - args['host_failure'] = _dict.get('host_failure') + if 'count' in _dict: + args['count'] = _dict.get('count') + else: + raise ValueError('Required property \'count\' not present in InstanceGPU JSON') + if 'manufacturer' in _dict: + args['manufacturer'] = _dict.get('manufacturer') + else: + raise ValueError('Required property \'manufacturer\' not present in InstanceGPU JSON') + if 'memory' in _dict: + args['memory'] = _dict.get('memory') + else: + raise ValueError('Required property \'memory\' not present in InstanceGPU JSON') + if 'model' in _dict: + args['model'] = _dict.get('model') + else: + raise ValueError('Required property \'model\' not present in InstanceGPU JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceAvailabilityPolicyPatch object from a json dictionary.""" + """Initialize a InstanceGPU object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'host_failure') and self.host_failure is not None: - _dict['host_failure'] = self.host_failure + if hasattr(self, 'count') and self.count is not None: + _dict['count'] = self.count + if hasattr(self, 'manufacturer') and self.manufacturer is not None: + _dict['manufacturer'] = self.manufacturer + if hasattr(self, 'memory') and self.memory is not None: + _dict['memory'] = self.memory + if hasattr(self, 'model') and self.model is not None: + _dict['model'] = self.model return _dict def _to_dict(self): @@ -29382,84 +33286,222 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceAvailabilityPolicyPatch object.""" + """Return a `str` version of this InstanceGPU object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceAvailabilityPolicyPatch') -> bool: + def __eq__(self, other: 'InstanceGPU') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceAvailabilityPolicyPatch') -> bool: + def __ne__(self, other: 'InstanceGPU') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class HostFailureEnum(str, Enum): - """ - The action to perform if the compute host experiences a failure. - - `restart`: Automatically restart the virtual server instance after host failure - - `stop`: Leave the virtual server instance stopped after host failure - The enumerated values for this property are expected to expand in the future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the instance on which the unexpected - property value was encountered. - """ - RESTART = 'restart' - STOP = 'stop' - - -class InstanceAvailabilityPrototype(): +class InstanceGroup(): """ - InstanceAvailabilityPrototype. + InstanceGroup. - :attr str host_failure: (optional) The action to perform if the compute host - experiences a failure. - - `restart`: Automatically restart the virtual server instance after host - failure - - `stop`: Leave the virtual server instance stopped after host failure - The enumerated values for this property are expected to expand in the future. - When processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the instance on which the unexpected - property value was encountered. + :attr int application_port: (optional) Required if specifying a load balancer + pool only. Used by the instance group when scaling up instances to supply the + port for the load balancer pool member. + :attr datetime created_at: The date and time that the instance group was + created. + :attr str crn: The CRN for this instance group. + :attr str href: The URL for this instance group. + :attr str id: The unique identifier for this instance group. + :attr InstanceTemplateReference instance_template: The template used to create + new instances for this group. + :attr LoadBalancerPoolReference load_balancer_pool: (optional) The load balancer + pool managed by this group. Instances created + by this group will have a new load balancer pool member in that + pool created. + :attr List[InstanceGroupManagerReference] managers: The managers for the + instance group. + :attr int membership_count: The number of instances in the instance group. + :attr str name: The user-defined name for this instance group. + :attr ResourceGroupReference resource_group: + :attr str status: The status of the instance group + - `deleting`: Group is being deleted + - `healthy`: Group has `membership_count` instances + - `scaling`: Instances in the group are being created or deleted to reach + `membership_count` + - `unhealthy`: Group is unable to reach `membership_count` instances. + :attr List[SubnetReference] subnets: The subnets to use when creating new + instances. + :attr datetime updated_at: The date and time that the instance group was + updated. + :attr VPCReference vpc: The VPC the instance group resides in. """ def __init__(self, + created_at: datetime, + crn: str, + href: str, + id: str, + instance_template: 'InstanceTemplateReference', + managers: List['InstanceGroupManagerReference'], + membership_count: int, + name: str, + resource_group: 'ResourceGroupReference', + status: str, + subnets: List['SubnetReference'], + updated_at: datetime, + vpc: 'VPCReference', *, - host_failure: str = None) -> None: + application_port: int = None, + load_balancer_pool: 'LoadBalancerPoolReference' = None) -> None: """ - Initialize a InstanceAvailabilityPrototype object. + Initialize a InstanceGroup object. - :param str host_failure: (optional) The action to perform if the compute - host experiences a failure. - - `restart`: Automatically restart the virtual server instance after host - failure - - `stop`: Leave the virtual server instance stopped after host failure - The enumerated values for this property are expected to expand in the - future. When processing this property, check for and log unknown values. - Optionally halt processing and surface the error, or bypass the instance on - which the unexpected property value was encountered. + :param datetime created_at: The date and time that the instance group was + created. + :param str crn: The CRN for this instance group. + :param str href: The URL for this instance group. + :param str id: The unique identifier for this instance group. + :param InstanceTemplateReference instance_template: The template used to + create new instances for this group. + :param List[InstanceGroupManagerReference] managers: The managers for the + instance group. + :param int membership_count: The number of instances in the instance group. + :param str name: The user-defined name for this instance group. + :param ResourceGroupReference resource_group: + :param str status: The status of the instance group + - `deleting`: Group is being deleted + - `healthy`: Group has `membership_count` instances + - `scaling`: Instances in the group are being created or deleted to reach + `membership_count` + - `unhealthy`: Group is unable to reach `membership_count` instances. + :param List[SubnetReference] subnets: The subnets to use when creating new + instances. + :param datetime updated_at: The date and time that the instance group was + updated. + :param VPCReference vpc: The VPC the instance group resides in. + :param int application_port: (optional) Required if specifying a load + balancer pool only. Used by the instance group when scaling up instances to + supply the port for the load balancer pool member. + :param LoadBalancerPoolReference load_balancer_pool: (optional) The load + balancer pool managed by this group. Instances created + by this group will have a new load balancer pool member in that + pool created. """ - self.host_failure = host_failure + self.application_port = application_port + self.created_at = created_at + self.crn = crn + self.href = href + self.id = id + self.instance_template = instance_template + self.load_balancer_pool = load_balancer_pool + self.managers = managers + self.membership_count = membership_count + self.name = name + self.resource_group = resource_group + self.status = status + self.subnets = subnets + self.updated_at = updated_at + self.vpc = vpc @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceAvailabilityPrototype': - """Initialize a InstanceAvailabilityPrototype object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroup': + """Initialize a InstanceGroup object from a json dictionary.""" args = {} - if 'host_failure' in _dict: - args['host_failure'] = _dict.get('host_failure') + if 'application_port' in _dict: + args['application_port'] = _dict.get('application_port') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) + else: + raise ValueError('Required property \'created_at\' not present in InstanceGroup JSON') + if 'crn' in _dict: + args['crn'] = _dict.get('crn') + else: + raise ValueError('Required property \'crn\' not present in InstanceGroup JSON') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in InstanceGroup JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in InstanceGroup JSON') + if 'instance_template' in _dict: + args['instance_template'] = InstanceTemplateReference.from_dict(_dict.get('instance_template')) + else: + raise ValueError('Required property \'instance_template\' not present in InstanceGroup JSON') + if 'load_balancer_pool' in _dict: + args['load_balancer_pool'] = LoadBalancerPoolReference.from_dict(_dict.get('load_balancer_pool')) + if 'managers' in _dict: + args['managers'] = [InstanceGroupManagerReference.from_dict(x) for x in _dict.get('managers')] + else: + raise ValueError('Required property \'managers\' not present in InstanceGroup JSON') + if 'membership_count' in _dict: + args['membership_count'] = _dict.get('membership_count') + else: + raise ValueError('Required property \'membership_count\' not present in InstanceGroup JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in InstanceGroup JSON') + if 'resource_group' in _dict: + args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) + else: + raise ValueError('Required property \'resource_group\' not present in InstanceGroup JSON') + if 'status' in _dict: + args['status'] = _dict.get('status') + else: + raise ValueError('Required property \'status\' not present in InstanceGroup JSON') + if 'subnets' in _dict: + args['subnets'] = [SubnetReference.from_dict(x) for x in _dict.get('subnets')] + else: + raise ValueError('Required property \'subnets\' not present in InstanceGroup JSON') + if 'updated_at' in _dict: + args['updated_at'] = string_to_datetime(_dict.get('updated_at')) + else: + raise ValueError('Required property \'updated_at\' not present in InstanceGroup JSON') + if 'vpc' in _dict: + args['vpc'] = VPCReference.from_dict(_dict.get('vpc')) + else: + raise ValueError('Required property \'vpc\' not present in InstanceGroup JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceAvailabilityPrototype object from a json dictionary.""" + """Initialize a InstanceGroup object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'host_failure') and self.host_failure is not None: - _dict['host_failure'] = self.host_failure + if hasattr(self, 'application_port') and self.application_port is not None: + _dict['application_port'] = self.application_port + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'instance_template') and self.instance_template is not None: + _dict['instance_template'] = self.instance_template.to_dict() + if hasattr(self, 'load_balancer_pool') and self.load_balancer_pool is not None: + _dict['load_balancer_pool'] = self.load_balancer_pool.to_dict() + if hasattr(self, 'managers') and self.managers is not None: + _dict['managers'] = [x.to_dict() for x in self.managers] + if hasattr(self, 'membership_count') and self.membership_count is not None: + _dict['membership_count'] = self.membership_count + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'resource_group') and self.resource_group is not None: + _dict['resource_group'] = self.resource_group.to_dict() + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'subnets') and self.subnets is not None: + _dict['subnets'] = [x.to_dict() for x in self.subnets] + if hasattr(self, 'updated_at') and self.updated_at is not None: + _dict['updated_at'] = datetime_to_string(self.updated_at) + if hasattr(self, 'vpc') and self.vpc is not None: + _dict['vpc'] = self.vpc.to_dict() return _dict def _to_dict(self): @@ -29467,100 +33509,101 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceAvailabilityPrototype object.""" + """Return a `str` version of this InstanceGroup object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceAvailabilityPrototype') -> bool: + def __eq__(self, other: 'InstanceGroup') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceAvailabilityPrototype') -> bool: + def __ne__(self, other: 'InstanceGroup') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class HostFailureEnum(str, Enum): + class StatusEnum(str, Enum): """ - The action to perform if the compute host experiences a failure. - - `restart`: Automatically restart the virtual server instance after host failure - - `stop`: Leave the virtual server instance stopped after host failure - The enumerated values for this property are expected to expand in the future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the instance on which the unexpected - property value was encountered. + The status of the instance group + - `deleting`: Group is being deleted + - `healthy`: Group has `membership_count` instances + - `scaling`: Instances in the group are being created or deleted to reach + `membership_count` + - `unhealthy`: Group is unable to reach `membership_count` instances. """ - RESTART = 'restart' - STOP = 'stop' + DELETING = 'deleting' + HEALTHY = 'healthy' + SCALING = 'scaling' + UNHEALTHY = 'unhealthy' -class InstanceCollection(): +class InstanceGroupCollection(): """ - InstanceCollection. + InstanceGroupCollection. - :attr InstanceCollectionFirst first: A link to the first page of resources. - :attr List[Instance] instances: Collection of virtual server instances. + :attr InstanceGroupCollectionFirst first: A link to the first page of resources. + :attr List[InstanceGroup] instance_groups: Collection of instance groups. :attr int limit: The maximum number of resources that can be returned by the request. - :attr InstanceCollectionNext next: (optional) A link to the next page of + :attr InstanceGroupCollectionNext next: (optional) A link to the next page of resources. This property is present for all pages except the last page. :attr int total_count: The total number of resources across all pages. """ def __init__(self, - first: 'InstanceCollectionFirst', - instances: List['Instance'], + first: 'InstanceGroupCollectionFirst', + instance_groups: List['InstanceGroup'], limit: int, total_count: int, *, - next: 'InstanceCollectionNext' = None) -> None: + next: 'InstanceGroupCollectionNext' = None) -> None: """ - Initialize a InstanceCollection object. + Initialize a InstanceGroupCollection object. - :param InstanceCollectionFirst first: A link to the first page of + :param InstanceGroupCollectionFirst first: A link to the first page of resources. - :param List[Instance] instances: Collection of virtual server instances. + :param List[InstanceGroup] instance_groups: Collection of instance groups. :param int limit: The maximum number of resources that can be returned by the request. :param int total_count: The total number of resources across all pages. - :param InstanceCollectionNext next: (optional) A link to the next page of - resources. This property is present for all pages + :param InstanceGroupCollectionNext next: (optional) A link to the next page + of resources. This property is present for all pages except the last page. """ self.first = first - self.instances = instances + self.instance_groups = instance_groups self.limit = limit self.next = next self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceCollection': - """Initialize a InstanceCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupCollection': + """Initialize a InstanceGroupCollection object from a json dictionary.""" args = {} if 'first' in _dict: - args['first'] = InstanceCollectionFirst.from_dict(_dict.get('first')) + args['first'] = InstanceGroupCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'first\' not present in InstanceCollection JSON') - if 'instances' in _dict: - args['instances'] = [Instance.from_dict(x) for x in _dict.get('instances')] + raise ValueError('Required property \'first\' not present in InstanceGroupCollection JSON') + if 'instance_groups' in _dict: + args['instance_groups'] = [InstanceGroup.from_dict(x) for x in _dict.get('instance_groups')] else: - raise ValueError('Required property \'instances\' not present in InstanceCollection JSON') + raise ValueError('Required property \'instance_groups\' not present in InstanceGroupCollection JSON') if 'limit' in _dict: args['limit'] = _dict.get('limit') else: - raise ValueError('Required property \'limit\' not present in InstanceCollection JSON') + raise ValueError('Required property \'limit\' not present in InstanceGroupCollection JSON') if 'next' in _dict: - args['next'] = InstanceCollectionNext.from_dict(_dict.get('next')) + args['next'] = InstanceGroupCollectionNext.from_dict(_dict.get('next')) if 'total_count' in _dict: args['total_count'] = _dict.get('total_count') else: - raise ValueError('Required property \'total_count\' not present in InstanceCollection JSON') + raise ValueError('Required property \'total_count\' not present in InstanceGroupCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceCollection object from a json dictionary.""" + """Initialize a InstanceGroupCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -29568,8 +33611,8 @@ def to_dict(self) -> Dict: _dict = {} if hasattr(self, 'first') and self.first is not None: _dict['first'] = self.first.to_dict() - if hasattr(self, 'instances') and self.instances is not None: - _dict['instances'] = [x.to_dict() for x in self.instances] + if hasattr(self, 'instance_groups') and self.instance_groups is not None: + _dict['instance_groups'] = [x.to_dict() for x in self.instance_groups] if hasattr(self, 'limit') and self.limit is not None: _dict['limit'] = self.limit if hasattr(self, 'next') and self.next is not None: @@ -29583,20 +33626,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceCollection object.""" + """Return a `str` version of this InstanceGroupCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceCollection') -> bool: + def __eq__(self, other: 'InstanceGroupCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceCollection') -> bool: + def __ne__(self, other: 'InstanceGroupCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceCollectionFirst(): +class InstanceGroupCollectionFirst(): """ A link to the first page of resources. @@ -29606,25 +33649,25 @@ class InstanceCollectionFirst(): def __init__(self, href: str) -> None: """ - Initialize a InstanceCollectionFirst object. + Initialize a InstanceGroupCollectionFirst object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceCollectionFirst': - """Initialize a InstanceCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupCollectionFirst': + """Initialize a InstanceGroupCollectionFirst object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in InstanceCollectionFirst JSON') + raise ValueError('Required property \'href\' not present in InstanceGroupCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceCollectionFirst object from a json dictionary.""" + """Initialize a InstanceGroupCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -29639,20 +33682,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceCollectionFirst object.""" + """Return a `str` version of this InstanceGroupCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceCollectionFirst') -> bool: + def __eq__(self, other: 'InstanceGroupCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceCollectionFirst') -> bool: + def __ne__(self, other: 'InstanceGroupCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceCollectionNext(): +class InstanceGroupCollectionNext(): """ A link to the next page of resources. This property is present for all pages except the last page. @@ -29663,25 +33706,25 @@ class InstanceCollectionNext(): def __init__(self, href: str) -> None: """ - Initialize a InstanceCollectionNext object. + Initialize a InstanceGroupCollectionNext object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceCollectionNext': - """Initialize a InstanceCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupCollectionNext': + """Initialize a InstanceGroupCollectionNext object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in InstanceCollectionNext JSON') + raise ValueError('Required property \'href\' not present in InstanceGroupCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceCollectionNext object from a json dictionary.""" + """Initialize a InstanceGroupCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -29696,399 +33739,190 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceCollectionNext object.""" + """Return a `str` version of this InstanceGroupCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceCollectionNext') -> bool: + def __eq__(self, other: 'InstanceGroupCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceCollectionNext') -> bool: + def __ne__(self, other: 'InstanceGroupCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceConsoleAccessToken(): +class InstanceGroupManager(): """ - The instance console access token information. + InstanceGroupManager. - :attr str access_token: A URL safe single-use token used to access the console - WebSocket. - :attr str console_type: The instance console type for which this token may be - used. - :attr datetime created_at: The date and time that the access token was created. - :attr datetime expires_at: The date and time that the access token will expire. - :attr bool force: Indicates whether to disconnect an existing serial console - session as the serial console cannot be shared. This has no effect on VNC - consoles. - :attr str href: The URL to access this instance console. + :attr datetime created_at: The date and time that the instance group manager was + created. + :attr str href: The URL for this instance group manager. + :attr str id: The unique identifier for this instance group manager. + :attr bool management_enabled: Indicates whether this manager will control the + instance group. + :attr str name: The user-defined name for this instance group manager. + :attr datetime updated_at: The date and time that the instance group manager was + updated. """ def __init__(self, - access_token: str, - console_type: str, created_at: datetime, - expires_at: datetime, - force: bool, - href: str) -> None: - """ - Initialize a InstanceConsoleAccessToken object. - - :param str access_token: A URL safe single-use token used to access the - console WebSocket. - :param str console_type: The instance console type for which this token may - be used. - :param datetime created_at: The date and time that the access token was - created. - :param datetime expires_at: The date and time that the access token will - expire. - :param bool force: Indicates whether to disconnect an existing serial - console session as the serial console cannot be shared. This has no effect - on VNC consoles. - :param str href: The URL to access this instance console. - """ - self.access_token = access_token - self.console_type = console_type - self.created_at = created_at - self.expires_at = expires_at - self.force = force - self.href = href - - @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceConsoleAccessToken': - """Initialize a InstanceConsoleAccessToken object from a json dictionary.""" - args = {} - if 'access_token' in _dict: - args['access_token'] = _dict.get('access_token') - else: - raise ValueError('Required property \'access_token\' not present in InstanceConsoleAccessToken JSON') - if 'console_type' in _dict: - args['console_type'] = _dict.get('console_type') - else: - raise ValueError('Required property \'console_type\' not present in InstanceConsoleAccessToken JSON') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - else: - raise ValueError('Required property \'created_at\' not present in InstanceConsoleAccessToken JSON') - if 'expires_at' in _dict: - args['expires_at'] = string_to_datetime(_dict.get('expires_at')) - else: - raise ValueError('Required property \'expires_at\' not present in InstanceConsoleAccessToken JSON') - if 'force' in _dict: - args['force'] = _dict.get('force') - else: - raise ValueError('Required property \'force\' not present in InstanceConsoleAccessToken JSON') - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in InstanceConsoleAccessToken JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a InstanceConsoleAccessToken object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'access_token') and self.access_token is not None: - _dict['access_token'] = self.access_token - if hasattr(self, 'console_type') and self.console_type is not None: - _dict['console_type'] = self.console_type - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'expires_at') and self.expires_at is not None: - _dict['expires_at'] = datetime_to_string(self.expires_at) - if hasattr(self, 'force') and self.force is not None: - _dict['force'] = self.force - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this InstanceConsoleAccessToken object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'InstanceConsoleAccessToken') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'InstanceConsoleAccessToken') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - - class ConsoleTypeEnum(str, Enum): - """ - The instance console type for which this token may be used. - """ - SERIAL = 'serial' - VNC = 'vnc' - - -class InstanceDefaultTrustedProfilePrototype(): - """ - InstanceDefaultTrustedProfilePrototype. - - :attr bool auto_link: (optional) If set to `true`, the system will create a link - to the specified `target` trusted profile during instance creation. Regardless - of whether a link is created by the system or manually using the IAM Identity - service, it will be automatically deleted when the instance is deleted. - :attr TrustedProfileIdentity target: The default IAM trusted profile to use for - this virtual server instance. - """ - - def __init__(self, - target: 'TrustedProfileIdentity', - *, - auto_link: bool = None) -> None: + href: str, + id: str, + management_enabled: bool, + name: str, + updated_at: datetime) -> None: """ - Initialize a InstanceDefaultTrustedProfilePrototype object. + Initialize a InstanceGroupManager object. - :param TrustedProfileIdentity target: The default IAM trusted profile to - use for this virtual server instance. - :param bool auto_link: (optional) If set to `true`, the system will create - a link to the specified `target` trusted profile during instance creation. - Regardless of whether a link is created by the system or manually using the - IAM Identity service, it will be automatically deleted when the instance is - deleted. + :param datetime created_at: The date and time that the instance group + manager was created. + :param str href: The URL for this instance group manager. + :param str id: The unique identifier for this instance group manager. + :param bool management_enabled: Indicates whether this manager will control + the instance group. + :param str name: The user-defined name for this instance group manager. + :param datetime updated_at: The date and time that the instance group + manager was updated. """ - self.auto_link = auto_link - self.target = target - - @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceDefaultTrustedProfilePrototype': - """Initialize a InstanceDefaultTrustedProfilePrototype object from a json dictionary.""" - args = {} - if 'auto_link' in _dict: - args['auto_link'] = _dict.get('auto_link') - if 'target' in _dict: - args['target'] = _dict.get('target') - else: - raise ValueError('Required property \'target\' not present in InstanceDefaultTrustedProfilePrototype JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a InstanceDefaultTrustedProfilePrototype object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'auto_link') and self.auto_link is not None: - _dict['auto_link'] = self.auto_link - if hasattr(self, 'target') and self.target is not None: - if isinstance(self.target, dict): - _dict['target'] = self.target - else: - _dict['target'] = self.target.to_dict() - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this InstanceDefaultTrustedProfilePrototype object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'InstanceDefaultTrustedProfilePrototype') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'InstanceDefaultTrustedProfilePrototype') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['InstanceGroupManagerAutoScale', 'InstanceGroupManagerScheduled'])) + raise Exception(msg) -class InstanceDisk(): +class InstanceGroupManagerAction(): """ - InstanceDisk. + InstanceGroupManagerAction. - :attr datetime created_at: The date and time that the disk was created. - :attr str href: The URL for this instance disk. - :attr str id: The unique identifier for this instance disk. - :attr str interface_type: The disk interface used for attaching the disk. - The enumerated values for this property are expected to expand in the future. - When processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the resource on which the unexpected - property value was encountered. - :attr str name: The user-defined name for this disk. + :attr bool auto_delete: Indicates whether this scheduled action will be + automatically deleted after it has completed and `auto_delete_timeout` hours + have passed. At present, this is always + `true`, but may be modifiable in the future. + :attr int auto_delete_timeout: If `auto_delete` is `true`, and this scheduled + action has finished, the hours after which it will be automatically deleted. If + the value is `0`, the action will be deleted once it has finished. This value + may be modifiable in the future. + :attr datetime created_at: The date and time that the instance group manager + action was created. + :attr str href: The URL for this instance group manager action. + :attr str id: The unique identifier for this instance group manager action. + :attr str name: The user-defined name for this instance group manager action. :attr str resource_type: The resource type. - :attr int size: The size of the disk in GB (gigabytes). + :attr str status: The status of the instance group action + - `active`: Action is ready to be run + - `completed`: Action was completed successfully + - `failed`: Action could not be completed successfully + - `incompatible`: Action parameters are not compatible with the group or manager + - `omitted`: Action was not applied because this action's manager was disabled. + :attr datetime updated_at: The date and time that the instance group manager + action was modified. """ def __init__(self, + auto_delete: bool, + auto_delete_timeout: int, created_at: datetime, href: str, id: str, - interface_type: str, name: str, resource_type: str, - size: int) -> None: + status: str, + updated_at: datetime) -> None: """ - Initialize a InstanceDisk object. + Initialize a InstanceGroupManagerAction object. - :param datetime created_at: The date and time that the disk was created. - :param str href: The URL for this instance disk. - :param str id: The unique identifier for this instance disk. - :param str interface_type: The disk interface used for attaching the disk. - The enumerated values for this property are expected to expand in the - future. When processing this property, check for and log unknown values. - Optionally halt processing and surface the error, or bypass the resource on - which the unexpected property value was encountered. - :param str name: The user-defined name for this disk. + :param bool auto_delete: Indicates whether this scheduled action will be + automatically deleted after it has completed and `auto_delete_timeout` + hours have passed. At present, this is always + `true`, but may be modifiable in the future. + :param int auto_delete_timeout: If `auto_delete` is `true`, and this + scheduled action has finished, the hours after which it will be + automatically deleted. If the value is `0`, the action will be deleted once + it has finished. This value may be modifiable in the future. + :param datetime created_at: The date and time that the instance group + manager action was created. + :param str href: The URL for this instance group manager action. + :param str id: The unique identifier for this instance group manager + action. + :param str name: The user-defined name for this instance group manager + action. :param str resource_type: The resource type. - :param int size: The size of the disk in GB (gigabytes). + :param str status: The status of the instance group action + - `active`: Action is ready to be run + - `completed`: Action was completed successfully + - `failed`: Action could not be completed successfully + - `incompatible`: Action parameters are not compatible with the group or + manager + - `omitted`: Action was not applied because this action's manager was + disabled. + :param datetime updated_at: The date and time that the instance group + manager action was modified. """ - self.created_at = created_at - self.href = href - self.id = id - self.interface_type = interface_type - self.name = name - self.resource_type = resource_type - self.size = size - - @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceDisk': - """Initialize a InstanceDisk object from a json dictionary.""" - args = {} - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - else: - raise ValueError('Required property \'created_at\' not present in InstanceDisk JSON') - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in InstanceDisk JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in InstanceDisk JSON') - if 'interface_type' in _dict: - args['interface_type'] = _dict.get('interface_type') - else: - raise ValueError('Required property \'interface_type\' not present in InstanceDisk JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in InstanceDisk JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in InstanceDisk JSON') - if 'size' in _dict: - args['size'] = _dict.get('size') - else: - raise ValueError('Required property \'size\' not present in InstanceDisk JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a InstanceDisk object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'interface_type') and self.interface_type is not None: - _dict['interface_type'] = self.interface_type - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type - if hasattr(self, 'size') and self.size is not None: - _dict['size'] = self.size - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this InstanceDisk object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'InstanceDisk') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'InstanceDisk') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['InstanceGroupManagerActionScheduledAction'])) + raise Exception(msg) - class InterfaceTypeEnum(str, Enum): + class ResourceTypeEnum(str, Enum): """ - The disk interface used for attaching the disk. - The enumerated values for this property are expected to expand in the future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the resource on which the unexpected - property value was encountered. + The resource type. """ - NVME = 'nvme' - VIRTIO_BLK = 'virtio_blk' + INSTANCE_GROUP_MANAGER_ACTION = 'instance_group_manager_action' - class ResourceTypeEnum(str, Enum): + class StatusEnum(str, Enum): """ - The resource type. + The status of the instance group action + - `active`: Action is ready to be run + - `completed`: Action was completed successfully + - `failed`: Action could not be completed successfully + - `incompatible`: Action parameters are not compatible with the group or manager + - `omitted`: Action was not applied because this action's manager was disabled. """ - INSTANCE_DISK = 'instance_disk' + ACTIVE = 'active' + COMPLETED = 'completed' + FAILED = 'failed' + INCOMPATIBLE = 'incompatible' + OMITTED = 'omitted' -class InstanceDiskCollection(): +class InstanceGroupManagerActionGroupPatch(): """ - InstanceDiskCollection. + InstanceGroupManagerActionGroupPatch. - :attr List[InstanceDisk] disks: Collection of the instance's disks. + :attr int membership_count: (optional) The desired number of instance group + members at the scheduled time. """ def __init__(self, - disks: List['InstanceDisk']) -> None: + *, + membership_count: int = None) -> None: """ - Initialize a InstanceDiskCollection object. + Initialize a InstanceGroupManagerActionGroupPatch object. - :param List[InstanceDisk] disks: Collection of the instance's disks. + :param int membership_count: (optional) The desired number of instance + group members at the scheduled time. """ - self.disks = disks + self.membership_count = membership_count @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceDiskCollection': - """Initialize a InstanceDiskCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerActionGroupPatch': + """Initialize a InstanceGroupManagerActionGroupPatch object from a json dictionary.""" args = {} - if 'disks' in _dict: - args['disks'] = [InstanceDisk.from_dict(x) for x in _dict.get('disks')] - else: - raise ValueError('Required property \'disks\' not present in InstanceDiskCollection JSON') + if 'membership_count' in _dict: + args['membership_count'] = _dict.get('membership_count') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceDiskCollection object from a json dictionary.""" + """Initialize a InstanceGroupManagerActionGroupPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'disks') and self.disks is not None: - _dict['disks'] = [x.to_dict() for x in self.disks] + if hasattr(self, 'membership_count') and self.membership_count is not None: + _dict['membership_count'] = self.membership_count return _dict def _to_dict(self): @@ -30096,54 +33930,66 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceDiskCollection object.""" + """Return a `str` version of this InstanceGroupManagerActionGroupPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceDiskCollection') -> bool: + def __eq__(self, other: 'InstanceGroupManagerActionGroupPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceDiskCollection') -> bool: + def __ne__(self, other: 'InstanceGroupManagerActionGroupPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceDiskPatch(): +class InstanceGroupManagerActionManagerPatch(): """ - InstanceDiskPatch. + InstanceGroupManagerActionManagerPatch. - :attr str name: (optional) The user-defined name for this disk. + :attr int max_membership_count: (optional) The desired maximum number of + instance group members at the scheduled time. + :attr int min_membership_count: (optional) The desired minimum number of + instance group members at the scheduled time. """ def __init__(self, *, - name: str = None) -> None: + max_membership_count: int = None, + min_membership_count: int = None) -> None: """ - Initialize a InstanceDiskPatch object. + Initialize a InstanceGroupManagerActionManagerPatch object. - :param str name: (optional) The user-defined name for this disk. + :param int max_membership_count: (optional) The desired maximum number of + instance group members at the scheduled time. + :param int min_membership_count: (optional) The desired minimum number of + instance group members at the scheduled time. """ - self.name = name + self.max_membership_count = max_membership_count + self.min_membership_count = min_membership_count @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceDiskPatch': - """Initialize a InstanceDiskPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerActionManagerPatch': + """Initialize a InstanceGroupManagerActionManagerPatch object from a json dictionary.""" args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') + if 'max_membership_count' in _dict: + args['max_membership_count'] = _dict.get('max_membership_count') + if 'min_membership_count' in _dict: + args['min_membership_count'] = _dict.get('min_membership_count') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceDiskPatch object from a json dictionary.""" + """Initialize a InstanceGroupManagerActionManagerPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name + if hasattr(self, 'max_membership_count') and self.max_membership_count is not None: + _dict['max_membership_count'] = self.max_membership_count + if hasattr(self, 'min_membership_count') and self.min_membership_count is not None: + _dict['min_membership_count'] = self.min_membership_count return _dict def _to_dict(self): @@ -30151,162 +33997,93 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceDiskPatch object.""" + """Return a `str` version of this InstanceGroupManagerActionManagerPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceDiskPatch') -> bool: + def __eq__(self, other: 'InstanceGroupManagerActionManagerPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceDiskPatch') -> bool: + def __ne__(self, other: 'InstanceGroupManagerActionManagerPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceDiskReference(): +class InstanceGroupManagerActionPatch(): """ - InstanceDiskReference. + InstanceGroupManagerActionPatch. - :attr InstanceDiskReferenceDeleted deleted: (optional) If present, this property - indicates the referenced resource has been deleted and provides - some supplementary information. - :attr str href: The URL for this instance disk. - :attr str id: The unique identifier for this instance disk. - :attr str name: The user-defined name for this disk. - :attr str resource_type: The resource type. + :attr str cron_spec: (optional) The cron specification for a recurring scheduled + action. Actions can be applied a maximum of one time within a 5 min period. + :attr InstanceGroupManagerActionGroupPatch group: (optional) + :attr InstanceGroupManagerActionManagerPatch manager: (optional) + :attr str name: (optional) The user-defined name for this instance group manager + action. + :attr datetime run_at: (optional) The date and time the scheduled action will + run. """ def __init__(self, - href: str, - id: str, - name: str, - resource_type: str, *, - deleted: 'InstanceDiskReferenceDeleted' = None) -> None: + cron_spec: str = None, + group: 'InstanceGroupManagerActionGroupPatch' = None, + manager: 'InstanceGroupManagerActionManagerPatch' = None, + name: str = None, + run_at: datetime = None) -> None: """ - Initialize a InstanceDiskReference object. + Initialize a InstanceGroupManagerActionPatch object. - :param str href: The URL for this instance disk. - :param str id: The unique identifier for this instance disk. - :param str name: The user-defined name for this disk. - :param str resource_type: The resource type. - :param InstanceDiskReferenceDeleted deleted: (optional) If present, this - property indicates the referenced resource has been deleted and provides - some supplementary information. + :param str cron_spec: (optional) The cron specification for a recurring + scheduled action. Actions can be applied a maximum of one time within a 5 + min period. + :param InstanceGroupManagerActionGroupPatch group: (optional) + :param InstanceGroupManagerActionManagerPatch manager: (optional) + :param str name: (optional) The user-defined name for this instance group + manager action. + :param datetime run_at: (optional) The date and time the scheduled action + will run. """ - self.deleted = deleted - self.href = href - self.id = id + self.cron_spec = cron_spec + self.group = group + self.manager = manager self.name = name - self.resource_type = resource_type + self.run_at = run_at @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceDiskReference': - """Initialize a InstanceDiskReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerActionPatch': + """Initialize a InstanceGroupManagerActionPatch object from a json dictionary.""" args = {} - if 'deleted' in _dict: - args['deleted'] = InstanceDiskReferenceDeleted.from_dict(_dict.get('deleted')) - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in InstanceDiskReference JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in InstanceDiskReference JSON') + if 'cron_spec' in _dict: + args['cron_spec'] = _dict.get('cron_spec') + if 'group' in _dict: + args['group'] = InstanceGroupManagerActionGroupPatch.from_dict(_dict.get('group')) + if 'manager' in _dict: + args['manager'] = InstanceGroupManagerActionManagerPatch.from_dict(_dict.get('manager')) if 'name' in _dict: args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in InstanceDiskReference JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in InstanceDiskReference JSON') + if 'run_at' in _dict: + args['run_at'] = string_to_datetime(_dict.get('run_at')) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceDiskReference object from a json dictionary.""" + """Initialize a InstanceGroupManagerActionPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id + if hasattr(self, 'cron_spec') and self.cron_spec is not None: + _dict['cron_spec'] = self.cron_spec + if hasattr(self, 'group') and self.group is not None: + _dict['group'] = self.group.to_dict() + if hasattr(self, 'manager') and self.manager is not None: + _dict['manager'] = self.manager.to_dict() if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this InstanceDiskReference object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'InstanceDiskReference') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'InstanceDiskReference') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - - class ResourceTypeEnum(str, Enum): - """ - The resource type. - """ - INSTANCE_DISK = 'instance_disk' - - -class InstanceDiskReferenceDeleted(): - """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. - - :attr str more_info: Link to documentation about deleted resources. - """ - - def __init__(self, - more_info: str) -> None: - """ - Initialize a InstanceDiskReferenceDeleted object. - - :param str more_info: Link to documentation about deleted resources. - """ - self.more_info = more_info - - @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceDiskReferenceDeleted': - """Initialize a InstanceDiskReferenceDeleted object from a json dictionary.""" - args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') - else: - raise ValueError('Required property \'more_info\' not present in InstanceDiskReferenceDeleted JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a InstanceDiskReferenceDeleted object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'run_at') and self.run_at is not None: + _dict['run_at'] = datetime_to_string(self.run_at) return _dict def _to_dict(self): @@ -30314,308 +34091,124 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceDiskReferenceDeleted object.""" + """Return a `str` version of this InstanceGroupManagerActionPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceDiskReferenceDeleted') -> bool: + def __eq__(self, other: 'InstanceGroupManagerActionPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceDiskReferenceDeleted') -> bool: + def __ne__(self, other: 'InstanceGroupManagerActionPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGPU(): +class InstanceGroupManagerActionPrototype(): """ - The virtual server instance GPU configuration. + InstanceGroupManagerActionPrototype. - :attr int count: The number of GPUs assigned to the instance. - :attr str manufacturer: The GPU manufacturer. - :attr int memory: The overall amount of GPU memory in GiB (gibibytes). - :attr str model: The GPU model. + :attr str name: (optional) The user-defined name for this instance group manager + action. Names must be unique within the instance group manager. If unspecified, + the name will be a hyphenated list of randomly-selected words. """ def __init__(self, - count: int, - manufacturer: str, - memory: int, - model: str) -> None: + *, + name: str = None) -> None: """ - Initialize a InstanceGPU object. + Initialize a InstanceGroupManagerActionPrototype object. - :param int count: The number of GPUs assigned to the instance. - :param str manufacturer: The GPU manufacturer. - :param int memory: The overall amount of GPU memory in GiB (gibibytes). - :param str model: The GPU model. + :param str name: (optional) The user-defined name for this instance group + manager action. Names must be unique within the instance group manager. If + unspecified, the name will be a hyphenated list of randomly-selected words. """ - self.count = count - self.manufacturer = manufacturer - self.memory = memory - self.model = model - - @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGPU': - """Initialize a InstanceGPU object from a json dictionary.""" - args = {} - if 'count' in _dict: - args['count'] = _dict.get('count') - else: - raise ValueError('Required property \'count\' not present in InstanceGPU JSON') - if 'manufacturer' in _dict: - args['manufacturer'] = _dict.get('manufacturer') - else: - raise ValueError('Required property \'manufacturer\' not present in InstanceGPU JSON') - if 'memory' in _dict: - args['memory'] = _dict.get('memory') - else: - raise ValueError('Required property \'memory\' not present in InstanceGPU JSON') - if 'model' in _dict: - args['model'] = _dict.get('model') - else: - raise ValueError('Required property \'model\' not present in InstanceGPU JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a InstanceGPU object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'count') and self.count is not None: - _dict['count'] = self.count - if hasattr(self, 'manufacturer') and self.manufacturer is not None: - _dict['manufacturer'] = self.manufacturer - if hasattr(self, 'memory') and self.memory is not None: - _dict['memory'] = self.memory - if hasattr(self, 'model') and self.model is not None: - _dict['model'] = self.model - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this InstanceGPU object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'InstanceGPU') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'InstanceGPU') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['InstanceGroupManagerActionPrototypeScheduledActionPrototype'])) + raise Exception(msg) -class InstanceGroup(): +class InstanceGroupManagerActionReference(): """ - InstanceGroup. + InstanceGroupManagerActionReference. - :attr int application_port: (optional) Required if specifying a load balancer - pool only. Used by the instance group when scaling up instances to supply the - port for the load balancer pool member. - :attr datetime created_at: The date and time that the instance group was - created. - :attr str crn: The CRN for this instance group. - :attr str href: The URL for this instance group. - :attr str id: The unique identifier for this instance group. - :attr InstanceTemplateReference instance_template: The template used to create - new instances for this group. - :attr LoadBalancerPoolReference load_balancer_pool: (optional) The load balancer - pool managed by this group. Instances created - by this group will have a new load balancer pool member in that - pool created. - :attr List[InstanceGroupManagerReference] managers: The managers for the - instance group. - :attr int membership_count: The number of instances in the instance group. - :attr str name: The user-defined name for this instance group. - :attr ResourceGroupReference resource_group: - :attr str status: The status of the instance group - - `deleting`: Group is being deleted - - `healthy`: Group has `membership_count` instances - - `scaling`: Instances in the group are being created or deleted to reach - `membership_count` - - `unhealthy`: Group is unable to reach `membership_count` instances. - :attr List[SubnetReference] subnets: The subnets to use when creating new - instances. - :attr datetime updated_at: The date and time that the instance group was - updated. - :attr VPCReference vpc: The VPC the instance group resides in. + :attr InstanceGroupManagerActionReferenceDeleted deleted: (optional) If present, + this property indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str href: The URL for this instance group manager action. + :attr str id: The unique identifier for this instance group manager action. + :attr str name: The user-defined name for this instance group manager action. + :attr str resource_type: The resource type. """ def __init__(self, - created_at: datetime, - crn: str, href: str, id: str, - instance_template: 'InstanceTemplateReference', - managers: List['InstanceGroupManagerReference'], - membership_count: int, name: str, - resource_group: 'ResourceGroupReference', - status: str, - subnets: List['SubnetReference'], - updated_at: datetime, - vpc: 'VPCReference', + resource_type: str, *, - application_port: int = None, - load_balancer_pool: 'LoadBalancerPoolReference' = None) -> None: + deleted: 'InstanceGroupManagerActionReferenceDeleted' = None) -> None: """ - Initialize a InstanceGroup object. + Initialize a InstanceGroupManagerActionReference object. - :param datetime created_at: The date and time that the instance group was - created. - :param str crn: The CRN for this instance group. - :param str href: The URL for this instance group. - :param str id: The unique identifier for this instance group. - :param InstanceTemplateReference instance_template: The template used to - create new instances for this group. - :param List[InstanceGroupManagerReference] managers: The managers for the - instance group. - :param int membership_count: The number of instances in the instance group. - :param str name: The user-defined name for this instance group. - :param ResourceGroupReference resource_group: - :param str status: The status of the instance group - - `deleting`: Group is being deleted - - `healthy`: Group has `membership_count` instances - - `scaling`: Instances in the group are being created or deleted to reach - `membership_count` - - `unhealthy`: Group is unable to reach `membership_count` instances. - :param List[SubnetReference] subnets: The subnets to use when creating new - instances. - :param datetime updated_at: The date and time that the instance group was - updated. - :param VPCReference vpc: The VPC the instance group resides in. - :param int application_port: (optional) Required if specifying a load - balancer pool only. Used by the instance group when scaling up instances to - supply the port for the load balancer pool member. - :param LoadBalancerPoolReference load_balancer_pool: (optional) The load - balancer pool managed by this group. Instances created - by this group will have a new load balancer pool member in that - pool created. + :param str href: The URL for this instance group manager action. + :param str id: The unique identifier for this instance group manager + action. + :param str name: The user-defined name for this instance group manager + action. + :param str resource_type: The resource type. + :param InstanceGroupManagerActionReferenceDeleted deleted: (optional) If + present, this property indicates the referenced resource has been deleted + and provides + some supplementary information. """ - self.application_port = application_port - self.created_at = created_at - self.crn = crn + self.deleted = deleted self.href = href self.id = id - self.instance_template = instance_template - self.load_balancer_pool = load_balancer_pool - self.managers = managers - self.membership_count = membership_count self.name = name - self.resource_group = resource_group - self.status = status - self.subnets = subnets - self.updated_at = updated_at - self.vpc = vpc + self.resource_type = resource_type @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroup': - """Initialize a InstanceGroup object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerActionReference': + """Initialize a InstanceGroupManagerActionReference object from a json dictionary.""" args = {} - if 'application_port' in _dict: - args['application_port'] = _dict.get('application_port') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - else: - raise ValueError('Required property \'created_at\' not present in InstanceGroup JSON') - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in InstanceGroup JSON') + if 'deleted' in _dict: + args['deleted'] = InstanceGroupManagerActionReferenceDeleted.from_dict(_dict.get('deleted')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in InstanceGroup JSON') + raise ValueError('Required property \'href\' not present in InstanceGroupManagerActionReference JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in InstanceGroup JSON') - if 'instance_template' in _dict: - args['instance_template'] = InstanceTemplateReference.from_dict(_dict.get('instance_template')) - else: - raise ValueError('Required property \'instance_template\' not present in InstanceGroup JSON') - if 'load_balancer_pool' in _dict: - args['load_balancer_pool'] = LoadBalancerPoolReference.from_dict(_dict.get('load_balancer_pool')) - if 'managers' in _dict: - args['managers'] = [InstanceGroupManagerReference.from_dict(x) for x in _dict.get('managers')] - else: - raise ValueError('Required property \'managers\' not present in InstanceGroup JSON') - if 'membership_count' in _dict: - args['membership_count'] = _dict.get('membership_count') - else: - raise ValueError('Required property \'membership_count\' not present in InstanceGroup JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in InstanceGroup JSON') - if 'resource_group' in _dict: - args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) - else: - raise ValueError('Required property \'resource_group\' not present in InstanceGroup JSON') - if 'status' in _dict: - args['status'] = _dict.get('status') - else: - raise ValueError('Required property \'status\' not present in InstanceGroup JSON') - if 'subnets' in _dict: - args['subnets'] = [SubnetReference.from_dict(x) for x in _dict.get('subnets')] - else: - raise ValueError('Required property \'subnets\' not present in InstanceGroup JSON') - if 'updated_at' in _dict: - args['updated_at'] = string_to_datetime(_dict.get('updated_at')) - else: - raise ValueError('Required property \'updated_at\' not present in InstanceGroup JSON') - if 'vpc' in _dict: - args['vpc'] = VPCReference.from_dict(_dict.get('vpc')) + raise ValueError('Required property \'id\' not present in InstanceGroupManagerActionReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') else: - raise ValueError('Required property \'vpc\' not present in InstanceGroup JSON') + raise ValueError('Required property \'name\' not present in InstanceGroupManagerActionReference JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in InstanceGroupManagerActionReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroup object from a json dictionary.""" + """Initialize a InstanceGroupManagerActionReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'application_port') and self.application_port is not None: - _dict['application_port'] = self.application_port - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id - if hasattr(self, 'instance_template') and self.instance_template is not None: - _dict['instance_template'] = self.instance_template.to_dict() - if hasattr(self, 'load_balancer_pool') and self.load_balancer_pool is not None: - _dict['load_balancer_pool'] = self.load_balancer_pool.to_dict() - if hasattr(self, 'managers') and self.managers is not None: - _dict['managers'] = [x.to_dict() for x in self.managers] - if hasattr(self, 'membership_count') and self.membership_count is not None: - _dict['membership_count'] = self.membership_count if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'resource_group') and self.resource_group is not None: - _dict['resource_group'] = self.resource_group.to_dict() - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status - if hasattr(self, 'subnets') and self.subnets is not None: - _dict['subnets'] = [x.to_dict() for x in self.subnets] - if hasattr(self, 'updated_at') and self.updated_at is not None: - _dict['updated_at'] = datetime_to_string(self.updated_at) - if hasattr(self, 'vpc') and self.vpc is not None: - _dict['vpc'] = self.vpc.to_dict() + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type return _dict def _to_dict(self): @@ -30623,110 +34216,168 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroup object.""" + """Return a `str` version of this InstanceGroupManagerActionReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroup') -> bool: + def __eq__(self, other: 'InstanceGroupManagerActionReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroup') -> bool: + def __ne__(self, other: 'InstanceGroupManagerActionReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class StatusEnum(str, Enum): + class ResourceTypeEnum(str, Enum): """ - The status of the instance group - - `deleting`: Group is being deleted - - `healthy`: Group has `membership_count` instances - - `scaling`: Instances in the group are being created or deleted to reach - `membership_count` - - `unhealthy`: Group is unable to reach `membership_count` instances. + The resource type. """ - DELETING = 'deleting' - HEALTHY = 'healthy' - SCALING = 'scaling' - UNHEALTHY = 'unhealthy' + INSTANCE_GROUP_MANAGER_ACTION = 'instance_group_manager_action' -class InstanceGroupCollection(): +class InstanceGroupManagerActionReferenceDeleted(): """ - InstanceGroupCollection. + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. - :attr InstanceGroupCollectionFirst first: A link to the first page of resources. - :attr List[InstanceGroup] instance_groups: Collection of instance groups. + :attr str more_info: Link to documentation about deleted resources. + """ + + def __init__(self, + more_info: str) -> None: + """ + Initialize a InstanceGroupManagerActionReferenceDeleted object. + + :param str more_info: Link to documentation about deleted resources. + """ + self.more_info = more_info + + @classmethod + def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerActionReferenceDeleted': + """Initialize a InstanceGroupManagerActionReferenceDeleted object from a json dictionary.""" + args = {} + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') + else: + raise ValueError('Required property \'more_info\' not present in InstanceGroupManagerActionReferenceDeleted JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a InstanceGroupManagerActionReferenceDeleted object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this InstanceGroupManagerActionReferenceDeleted object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'InstanceGroupManagerActionReferenceDeleted') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'InstanceGroupManagerActionReferenceDeleted') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class InstanceGroupManagerActionsCollection(): + """ + InstanceGroupManagerActionsCollection. + + :attr List[InstanceGroupManagerAction] actions: Collection of instance group + manager actions. + :attr InstanceGroupManagerActionsCollectionFirst first: A link to the first page + of resources. :attr int limit: The maximum number of resources that can be returned by the request. - :attr InstanceGroupCollectionNext next: (optional) A link to the next page of - resources. This property is present for all pages + :attr InstanceGroupManagerActionsCollectionNext next: (optional) A link to the + next page of resources. This property is present for all pages except the last page. :attr int total_count: The total number of resources across all pages. """ def __init__(self, - first: 'InstanceGroupCollectionFirst', - instance_groups: List['InstanceGroup'], + actions: List['InstanceGroupManagerAction'], + first: 'InstanceGroupManagerActionsCollectionFirst', limit: int, total_count: int, *, - next: 'InstanceGroupCollectionNext' = None) -> None: + next: 'InstanceGroupManagerActionsCollectionNext' = None) -> None: """ - Initialize a InstanceGroupCollection object. + Initialize a InstanceGroupManagerActionsCollection object. - :param InstanceGroupCollectionFirst first: A link to the first page of - resources. - :param List[InstanceGroup] instance_groups: Collection of instance groups. + :param List[InstanceGroupManagerAction] actions: Collection of instance + group manager actions. + :param InstanceGroupManagerActionsCollectionFirst first: A link to the + first page of resources. :param int limit: The maximum number of resources that can be returned by the request. :param int total_count: The total number of resources across all pages. - :param InstanceGroupCollectionNext next: (optional) A link to the next page - of resources. This property is present for all pages + :param InstanceGroupManagerActionsCollectionNext next: (optional) A link to + the next page of resources. This property is present for all pages except the last page. """ + self.actions = actions self.first = first - self.instance_groups = instance_groups self.limit = limit self.next = next self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupCollection': - """Initialize a InstanceGroupCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerActionsCollection': + """Initialize a InstanceGroupManagerActionsCollection object from a json dictionary.""" args = {} - if 'first' in _dict: - args['first'] = InstanceGroupCollectionFirst.from_dict(_dict.get('first')) + if 'actions' in _dict: + args['actions'] = _dict.get('actions') else: - raise ValueError('Required property \'first\' not present in InstanceGroupCollection JSON') - if 'instance_groups' in _dict: - args['instance_groups'] = [InstanceGroup.from_dict(x) for x in _dict.get('instance_groups')] + raise ValueError('Required property \'actions\' not present in InstanceGroupManagerActionsCollection JSON') + if 'first' in _dict: + args['first'] = InstanceGroupManagerActionsCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'instance_groups\' not present in InstanceGroupCollection JSON') + raise ValueError('Required property \'first\' not present in InstanceGroupManagerActionsCollection JSON') if 'limit' in _dict: args['limit'] = _dict.get('limit') else: - raise ValueError('Required property \'limit\' not present in InstanceGroupCollection JSON') + raise ValueError('Required property \'limit\' not present in InstanceGroupManagerActionsCollection JSON') if 'next' in _dict: - args['next'] = InstanceGroupCollectionNext.from_dict(_dict.get('next')) + args['next'] = InstanceGroupManagerActionsCollectionNext.from_dict(_dict.get('next')) if 'total_count' in _dict: args['total_count'] = _dict.get('total_count') else: - raise ValueError('Required property \'total_count\' not present in InstanceGroupCollection JSON') + raise ValueError('Required property \'total_count\' not present in InstanceGroupManagerActionsCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupCollection object from a json dictionary.""" + """Initialize a InstanceGroupManagerActionsCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'actions') and self.actions is not None: + actions_list = [] + for x in self.actions: + if isinstance(x, dict): + actions_list.append(x) + else: + actions_list.append(x.to_dict()) + _dict['actions'] = actions_list if hasattr(self, 'first') and self.first is not None: _dict['first'] = self.first.to_dict() - if hasattr(self, 'instance_groups') and self.instance_groups is not None: - _dict['instance_groups'] = [x.to_dict() for x in self.instance_groups] if hasattr(self, 'limit') and self.limit is not None: _dict['limit'] = self.limit if hasattr(self, 'next') and self.next is not None: @@ -30740,20 +34391,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupCollection object.""" + """Return a `str` version of this InstanceGroupManagerActionsCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupCollection') -> bool: + def __eq__(self, other: 'InstanceGroupManagerActionsCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupCollection') -> bool: + def __ne__(self, other: 'InstanceGroupManagerActionsCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupCollectionFirst(): +class InstanceGroupManagerActionsCollectionFirst(): """ A link to the first page of resources. @@ -30763,25 +34414,25 @@ class InstanceGroupCollectionFirst(): def __init__(self, href: str) -> None: """ - Initialize a InstanceGroupCollectionFirst object. + Initialize a InstanceGroupManagerActionsCollectionFirst object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupCollectionFirst': - """Initialize a InstanceGroupCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerActionsCollectionFirst': + """Initialize a InstanceGroupManagerActionsCollectionFirst object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in InstanceGroupCollectionFirst JSON') + raise ValueError('Required property \'href\' not present in InstanceGroupManagerActionsCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupCollectionFirst object from a json dictionary.""" + """Initialize a InstanceGroupManagerActionsCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -30796,20 +34447,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupCollectionFirst object.""" + """Return a `str` version of this InstanceGroupManagerActionsCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupCollectionFirst') -> bool: + def __eq__(self, other: 'InstanceGroupManagerActionsCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupCollectionFirst') -> bool: + def __ne__(self, other: 'InstanceGroupManagerActionsCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupCollectionNext(): +class InstanceGroupManagerActionsCollectionNext(): """ A link to the next page of resources. This property is present for all pages except the last page. @@ -30820,25 +34471,25 @@ class InstanceGroupCollectionNext(): def __init__(self, href: str) -> None: """ - Initialize a InstanceGroupCollectionNext object. + Initialize a InstanceGroupManagerActionsCollectionNext object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupCollectionNext': - """Initialize a InstanceGroupCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerActionsCollectionNext': + """Initialize a InstanceGroupManagerActionsCollectionNext object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in InstanceGroupCollectionNext JSON') + raise ValueError('Required property \'href\' not present in InstanceGroupManagerActionsCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupCollectionNext object from a json dictionary.""" + """Initialize a InstanceGroupManagerActionsCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -30853,190 +34504,223 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupCollectionNext object.""" + """Return a `str` version of this InstanceGroupManagerActionsCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupCollectionNext') -> bool: + def __eq__(self, other: 'InstanceGroupManagerActionsCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupCollectionNext') -> bool: + def __ne__(self, other: 'InstanceGroupManagerActionsCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupManager(): +class InstanceGroupManagerCollection(): """ - InstanceGroupManager. + InstanceGroupManagerCollection. - :attr datetime created_at: The date and time that the instance group manager was - created. - :attr str href: The URL for this instance group manager. - :attr str id: The unique identifier for this instance group manager. - :attr bool management_enabled: Indicates whether this manager will control the - instance group. - :attr str name: The user-defined name for this instance group manager. - :attr datetime updated_at: The date and time that the instance group manager was - updated. + :attr InstanceGroupManagerCollectionFirst first: A link to the first page of + resources. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr List[InstanceGroupManager] managers: Collection of instance group + managers. + :attr InstanceGroupManagerCollectionNext next: (optional) A link to the next + page of resources. This property is present for all pages + except the last page. + :attr int total_count: The total number of resources across all pages. """ def __init__(self, - created_at: datetime, - href: str, - id: str, - management_enabled: bool, - name: str, - updated_at: datetime) -> None: + first: 'InstanceGroupManagerCollectionFirst', + limit: int, + managers: List['InstanceGroupManager'], + total_count: int, + *, + next: 'InstanceGroupManagerCollectionNext' = None) -> None: """ - Initialize a InstanceGroupManager object. + Initialize a InstanceGroupManagerCollection object. - :param datetime created_at: The date and time that the instance group - manager was created. - :param str href: The URL for this instance group manager. - :param str id: The unique identifier for this instance group manager. - :param bool management_enabled: Indicates whether this manager will control - the instance group. - :param str name: The user-defined name for this instance group manager. - :param datetime updated_at: The date and time that the instance group - manager was updated. + :param InstanceGroupManagerCollectionFirst first: A link to the first page + of resources. + :param int limit: The maximum number of resources that can be returned by + the request. + :param List[InstanceGroupManager] managers: Collection of instance group + managers. + :param int total_count: The total number of resources across all pages. + :param InstanceGroupManagerCollectionNext next: (optional) A link to the + next page of resources. This property is present for all pages + except the last page. """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstanceGroupManagerAutoScale', 'InstanceGroupManagerScheduled'])) - raise Exception(msg) + self.first = first + self.limit = limit + self.managers = managers + self.next = next + self.total_count = total_count -class InstanceGroupManagerAction(): + @classmethod + def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerCollection': + """Initialize a InstanceGroupManagerCollection object from a json dictionary.""" + args = {} + if 'first' in _dict: + args['first'] = InstanceGroupManagerCollectionFirst.from_dict(_dict.get('first')) + else: + raise ValueError('Required property \'first\' not present in InstanceGroupManagerCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') + else: + raise ValueError('Required property \'limit\' not present in InstanceGroupManagerCollection JSON') + if 'managers' in _dict: + args['managers'] = _dict.get('managers') + else: + raise ValueError('Required property \'managers\' not present in InstanceGroupManagerCollection JSON') + if 'next' in _dict: + args['next'] = InstanceGroupManagerCollectionNext.from_dict(_dict.get('next')) + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') + else: + raise ValueError('Required property \'total_count\' not present in InstanceGroupManagerCollection JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a InstanceGroupManagerCollection object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'managers') and self.managers is not None: + managers_list = [] + for x in self.managers: + if isinstance(x, dict): + managers_list.append(x) + else: + managers_list.append(x.to_dict()) + _dict['managers'] = managers_list + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this InstanceGroupManagerCollection object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'InstanceGroupManagerCollection') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'InstanceGroupManagerCollection') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class InstanceGroupManagerCollectionFirst(): """ - InstanceGroupManagerAction. + A link to the first page of resources. - :attr bool auto_delete: Indicates whether this scheduled action will be - automatically deleted after it has completed and `auto_delete_timeout` hours - have passed. At present, this is always - `true`, but may be modifiable in the future. - :attr int auto_delete_timeout: If `auto_delete` is `true`, and this scheduled - action has finished, the hours after which it will be automatically deleted. If - the value is `0`, the action will be deleted once it has finished. This value - may be modifiable in the future. - :attr datetime created_at: The date and time that the instance group manager - action was created. - :attr str href: The URL for this instance group manager action. - :attr str id: The unique identifier for this instance group manager action. - :attr str name: The user-defined name for this instance group manager action. - :attr str resource_type: The resource type. - :attr str status: The status of the instance group action - - `active`: Action is ready to be run - - `completed`: Action was completed successfully - - `failed`: Action could not be completed successfully - - `incompatible`: Action parameters are not compatible with the group or manager - - `omitted`: Action was not applied because this action's manager was disabled. - :attr datetime updated_at: The date and time that the instance group manager - action was modified. + :attr str href: The URL for a page of resources. """ def __init__(self, - auto_delete: bool, - auto_delete_timeout: int, - created_at: datetime, - href: str, - id: str, - name: str, - resource_type: str, - status: str, - updated_at: datetime) -> None: + href: str) -> None: """ - Initialize a InstanceGroupManagerAction object. + Initialize a InstanceGroupManagerCollectionFirst object. - :param bool auto_delete: Indicates whether this scheduled action will be - automatically deleted after it has completed and `auto_delete_timeout` - hours have passed. At present, this is always - `true`, but may be modifiable in the future. - :param int auto_delete_timeout: If `auto_delete` is `true`, and this - scheduled action has finished, the hours after which it will be - automatically deleted. If the value is `0`, the action will be deleted once - it has finished. This value may be modifiable in the future. - :param datetime created_at: The date and time that the instance group - manager action was created. - :param str href: The URL for this instance group manager action. - :param str id: The unique identifier for this instance group manager - action. - :param str name: The user-defined name for this instance group manager - action. - :param str resource_type: The resource type. - :param str status: The status of the instance group action - - `active`: Action is ready to be run - - `completed`: Action was completed successfully - - `failed`: Action could not be completed successfully - - `incompatible`: Action parameters are not compatible with the group or - manager - - `omitted`: Action was not applied because this action's manager was - disabled. - :param datetime updated_at: The date and time that the instance group - manager action was modified. + :param str href: The URL for a page of resources. """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstanceGroupManagerActionScheduledAction'])) - raise Exception(msg) + self.href = href - class ResourceTypeEnum(str, Enum): - """ - The resource type. - """ - INSTANCE_GROUP_MANAGER_ACTION = 'instance_group_manager_action' + @classmethod + def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerCollectionFirst': + """Initialize a InstanceGroupManagerCollectionFirst object from a json dictionary.""" + args = {} + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in InstanceGroupManagerCollectionFirst JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a InstanceGroupManagerCollectionFirst object from a json dictionary.""" + return cls.from_dict(_dict) + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + return _dict - class StatusEnum(str, Enum): - """ - The status of the instance group action - - `active`: Action is ready to be run - - `completed`: Action was completed successfully - - `failed`: Action could not be completed successfully - - `incompatible`: Action parameters are not compatible with the group or manager - - `omitted`: Action was not applied because this action's manager was disabled. - """ - ACTIVE = 'active' - COMPLETED = 'completed' - FAILED = 'failed' - INCOMPATIBLE = 'incompatible' - OMITTED = 'omitted' + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + def __str__(self) -> str: + """Return a `str` version of this InstanceGroupManagerCollectionFirst object.""" + return json.dumps(self.to_dict(), indent=2) -class InstanceGroupManagerActionGroupPatch(): + def __eq__(self, other: 'InstanceGroupManagerCollectionFirst') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'InstanceGroupManagerCollectionFirst') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class InstanceGroupManagerCollectionNext(): """ - InstanceGroupManagerActionGroupPatch. + A link to the next page of resources. This property is present for all pages except + the last page. - :attr int membership_count: (optional) The desired number of instance group - members at the scheduled time. + :attr str href: The URL for a page of resources. """ def __init__(self, - *, - membership_count: int = None) -> None: + href: str) -> None: """ - Initialize a InstanceGroupManagerActionGroupPatch object. + Initialize a InstanceGroupManagerCollectionNext object. - :param int membership_count: (optional) The desired number of instance - group members at the scheduled time. + :param str href: The URL for a page of resources. """ - self.membership_count = membership_count + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerActionGroupPatch': - """Initialize a InstanceGroupManagerActionGroupPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerCollectionNext': + """Initialize a InstanceGroupManagerCollectionNext object from a json dictionary.""" args = {} - if 'membership_count' in _dict: - args['membership_count'] = _dict.get('membership_count') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in InstanceGroupManagerCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupManagerActionGroupPatch object from a json dictionary.""" + """Initialize a InstanceGroupManagerCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'membership_count') and self.membership_count is not None: - _dict['membership_count'] = self.membership_count + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -31044,66 +34728,106 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupManagerActionGroupPatch object.""" + """Return a `str` version of this InstanceGroupManagerCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupManagerActionGroupPatch') -> bool: + def __eq__(self, other: 'InstanceGroupManagerCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupManagerActionGroupPatch') -> bool: + def __ne__(self, other: 'InstanceGroupManagerCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupManagerActionManagerPatch(): +class InstanceGroupManagerPatch(): """ - InstanceGroupManagerActionManagerPatch. + InstanceGroupManagerPatch. - :attr int max_membership_count: (optional) The desired maximum number of - instance group members at the scheduled time. - :attr int min_membership_count: (optional) The desired minimum number of - instance group members at the scheduled time. + :attr int aggregation_window: (optional) The time window in seconds to aggregate + metrics prior to evaluation. + :attr int cooldown: (optional) The duration of time in seconds to pause further + scale actions after scaling has taken place. + :attr bool management_enabled: (optional) Indicates whether this manager will + control the instance group. + :attr int max_membership_count: (optional) The maximum number of members in a + managed instance group. + :attr int min_membership_count: (optional) The minimum number of members in a + managed instance group. + :attr str name: (optional) The user-defined name for this instance group + manager. """ def __init__(self, *, + aggregation_window: int = None, + cooldown: int = None, + management_enabled: bool = None, max_membership_count: int = None, - min_membership_count: int = None) -> None: + min_membership_count: int = None, + name: str = None) -> None: """ - Initialize a InstanceGroupManagerActionManagerPatch object. + Initialize a InstanceGroupManagerPatch object. - :param int max_membership_count: (optional) The desired maximum number of - instance group members at the scheduled time. - :param int min_membership_count: (optional) The desired minimum number of - instance group members at the scheduled time. + :param int aggregation_window: (optional) The time window in seconds to + aggregate metrics prior to evaluation. + :param int cooldown: (optional) The duration of time in seconds to pause + further scale actions after scaling has taken place. + :param bool management_enabled: (optional) Indicates whether this manager + will control the instance group. + :param int max_membership_count: (optional) The maximum number of members + in a managed instance group. + :param int min_membership_count: (optional) The minimum number of members + in a managed instance group. + :param str name: (optional) The user-defined name for this instance group + manager. """ + self.aggregation_window = aggregation_window + self.cooldown = cooldown + self.management_enabled = management_enabled self.max_membership_count = max_membership_count self.min_membership_count = min_membership_count + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerActionManagerPatch': - """Initialize a InstanceGroupManagerActionManagerPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerPatch': + """Initialize a InstanceGroupManagerPatch object from a json dictionary.""" args = {} + if 'aggregation_window' in _dict: + args['aggregation_window'] = _dict.get('aggregation_window') + if 'cooldown' in _dict: + args['cooldown'] = _dict.get('cooldown') + if 'management_enabled' in _dict: + args['management_enabled'] = _dict.get('management_enabled') if 'max_membership_count' in _dict: args['max_membership_count'] = _dict.get('max_membership_count') if 'min_membership_count' in _dict: args['min_membership_count'] = _dict.get('min_membership_count') + if 'name' in _dict: + args['name'] = _dict.get('name') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupManagerActionManagerPatch object from a json dictionary.""" + """Initialize a InstanceGroupManagerPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'aggregation_window') and self.aggregation_window is not None: + _dict['aggregation_window'] = self.aggregation_window + if hasattr(self, 'cooldown') and self.cooldown is not None: + _dict['cooldown'] = self.cooldown + if hasattr(self, 'management_enabled') and self.management_enabled is not None: + _dict['management_enabled'] = self.management_enabled if hasattr(self, 'max_membership_count') and self.max_membership_count is not None: _dict['max_membership_count'] = self.max_membership_count if hasattr(self, 'min_membership_count') and self.min_membership_count is not None: _dict['min_membership_count'] = self.min_membership_count + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -31111,93 +34835,146 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupManagerActionManagerPatch object.""" + """Return a `str` version of this InstanceGroupManagerPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupManagerActionManagerPatch') -> bool: + def __eq__(self, other: 'InstanceGroupManagerPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupManagerActionManagerPatch') -> bool: + def __ne__(self, other: 'InstanceGroupManagerPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupManagerActionPatch(): +class InstanceGroupManagerPolicy(): """ - InstanceGroupManagerActionPatch. + InstanceGroupManagerPolicy. - :attr str cron_spec: (optional) The cron specification for a recurring scheduled - action. Actions can be applied a maximum of one time within a 5 min period. - :attr InstanceGroupManagerActionGroupPatch group: (optional) - :attr InstanceGroupManagerActionManagerPatch manager: (optional) - :attr str name: (optional) The user-defined name for this instance group manager - action. - :attr datetime run_at: (optional) The date and time the scheduled action will - run. + :attr datetime created_at: The date and time that the instance group manager + policy was created. + :attr str href: The URL for this instance group manager policy. + :attr str id: The unique identifier for this instance group manager policy. + :attr str name: The user-defined name for this instance group manager policy. + :attr datetime updated_at: The date and time that the instance group manager + policy was updated. + """ + + def __init__(self, + created_at: datetime, + href: str, + id: str, + name: str, + updated_at: datetime) -> None: + """ + Initialize a InstanceGroupManagerPolicy object. + + :param datetime created_at: The date and time that the instance group + manager policy was created. + :param str href: The URL for this instance group manager policy. + :param str id: The unique identifier for this instance group manager + policy. + :param str name: The user-defined name for this instance group manager + policy. + :param datetime updated_at: The date and time that the instance group + manager policy was updated. + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy'])) + raise Exception(msg) + +class InstanceGroupManagerPolicyCollection(): + """ + InstanceGroupManagerPolicyCollection. + + :attr InstanceGroupManagerPolicyCollectionFirst first: A link to the first page + of resources. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr InstanceGroupManagerPolicyCollectionNext next: (optional) A link to the + next page of resources. This property is present for all pages + except the last page. + :attr List[InstanceGroupManagerPolicy] policies: Collection of instance group + manager policies. + :attr int total_count: The total number of resources across all pages. """ def __init__(self, + first: 'InstanceGroupManagerPolicyCollectionFirst', + limit: int, + policies: List['InstanceGroupManagerPolicy'], + total_count: int, *, - cron_spec: str = None, - group: 'InstanceGroupManagerActionGroupPatch' = None, - manager: 'InstanceGroupManagerActionManagerPatch' = None, - name: str = None, - run_at: datetime = None) -> None: + next: 'InstanceGroupManagerPolicyCollectionNext' = None) -> None: """ - Initialize a InstanceGroupManagerActionPatch object. + Initialize a InstanceGroupManagerPolicyCollection object. - :param str cron_spec: (optional) The cron specification for a recurring - scheduled action. Actions can be applied a maximum of one time within a 5 - min period. - :param InstanceGroupManagerActionGroupPatch group: (optional) - :param InstanceGroupManagerActionManagerPatch manager: (optional) - :param str name: (optional) The user-defined name for this instance group - manager action. - :param datetime run_at: (optional) The date and time the scheduled action - will run. + :param InstanceGroupManagerPolicyCollectionFirst first: A link to the first + page of resources. + :param int limit: The maximum number of resources that can be returned by + the request. + :param List[InstanceGroupManagerPolicy] policies: Collection of instance + group manager policies. + :param int total_count: The total number of resources across all pages. + :param InstanceGroupManagerPolicyCollectionNext next: (optional) A link to + the next page of resources. This property is present for all pages + except the last page. """ - self.cron_spec = cron_spec - self.group = group - self.manager = manager - self.name = name - self.run_at = run_at + self.first = first + self.limit = limit + self.next = next + self.policies = policies + self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerActionPatch': - """Initialize a InstanceGroupManagerActionPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerPolicyCollection': + """Initialize a InstanceGroupManagerPolicyCollection object from a json dictionary.""" args = {} - if 'cron_spec' in _dict: - args['cron_spec'] = _dict.get('cron_spec') - if 'group' in _dict: - args['group'] = InstanceGroupManagerActionGroupPatch.from_dict(_dict.get('group')) - if 'manager' in _dict: - args['manager'] = InstanceGroupManagerActionManagerPatch.from_dict(_dict.get('manager')) - if 'name' in _dict: - args['name'] = _dict.get('name') - if 'run_at' in _dict: - args['run_at'] = string_to_datetime(_dict.get('run_at')) + if 'first' in _dict: + args['first'] = InstanceGroupManagerPolicyCollectionFirst.from_dict(_dict.get('first')) + else: + raise ValueError('Required property \'first\' not present in InstanceGroupManagerPolicyCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') + else: + raise ValueError('Required property \'limit\' not present in InstanceGroupManagerPolicyCollection JSON') + if 'next' in _dict: + args['next'] = InstanceGroupManagerPolicyCollectionNext.from_dict(_dict.get('next')) + if 'policies' in _dict: + args['policies'] = _dict.get('policies') + else: + raise ValueError('Required property \'policies\' not present in InstanceGroupManagerPolicyCollection JSON') + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') + else: + raise ValueError('Required property \'total_count\' not present in InstanceGroupManagerPolicyCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupManagerActionPatch object from a json dictionary.""" + """Initialize a InstanceGroupManagerPolicyCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'cron_spec') and self.cron_spec is not None: - _dict['cron_spec'] = self.cron_spec - if hasattr(self, 'group') and self.group is not None: - _dict['group'] = self.group.to_dict() - if hasattr(self, 'manager') and self.manager is not None: - _dict['manager'] = self.manager.to_dict() - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'run_at') and self.run_at is not None: - _dict['run_at'] = datetime_to_string(self.run_at) + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'policies') and self.policies is not None: + policies_list = [] + for x in self.policies: + if isinstance(x, dict): + policies_list.append(x) + else: + policies_list.append(x.to_dict()) + _dict['policies'] = policies_list + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count return _dict def _to_dict(self): @@ -31205,124 +34982,112 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupManagerActionPatch object.""" + """Return a `str` version of this InstanceGroupManagerPolicyCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupManagerActionPatch') -> bool: + def __eq__(self, other: 'InstanceGroupManagerPolicyCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupManagerActionPatch') -> bool: + def __ne__(self, other: 'InstanceGroupManagerPolicyCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupManagerActionPrototype(): +class InstanceGroupManagerPolicyCollectionFirst(): """ - InstanceGroupManagerActionPrototype. + A link to the first page of resources. - :attr str name: (optional) The user-defined name for this instance group manager - action. Names must be unique within the instance group manager. If unspecified, - the name will be a hyphenated list of randomly-selected words. + :attr str href: The URL for a page of resources. """ def __init__(self, - *, - name: str = None) -> None: + href: str) -> None: """ - Initialize a InstanceGroupManagerActionPrototype object. + Initialize a InstanceGroupManagerPolicyCollectionFirst object. - :param str name: (optional) The user-defined name for this instance group - manager action. Names must be unique within the instance group manager. If - unspecified, the name will be a hyphenated list of randomly-selected words. + :param str href: The URL for a page of resources. """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstanceGroupManagerActionPrototypeScheduledActionPrototype'])) - raise Exception(msg) + self.href = href -class InstanceGroupManagerActionReference(): + @classmethod + def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerPolicyCollectionFirst': + """Initialize a InstanceGroupManagerPolicyCollectionFirst object from a json dictionary.""" + args = {} + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in InstanceGroupManagerPolicyCollectionFirst JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a InstanceGroupManagerPolicyCollectionFirst object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this InstanceGroupManagerPolicyCollectionFirst object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'InstanceGroupManagerPolicyCollectionFirst') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'InstanceGroupManagerPolicyCollectionFirst') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class InstanceGroupManagerPolicyCollectionNext(): """ - InstanceGroupManagerActionReference. + A link to the next page of resources. This property is present for all pages except + the last page. - :attr InstanceGroupManagerActionReferenceDeleted deleted: (optional) If present, - this property indicates the referenced resource has been deleted and provides - some supplementary information. - :attr str href: The URL for this instance group manager action. - :attr str id: The unique identifier for this instance group manager action. - :attr str name: The user-defined name for this instance group manager action. - :attr str resource_type: The resource type. + :attr str href: The URL for a page of resources. """ def __init__(self, - href: str, - id: str, - name: str, - resource_type: str, - *, - deleted: 'InstanceGroupManagerActionReferenceDeleted' = None) -> None: + href: str) -> None: """ - Initialize a InstanceGroupManagerActionReference object. + Initialize a InstanceGroupManagerPolicyCollectionNext object. - :param str href: The URL for this instance group manager action. - :param str id: The unique identifier for this instance group manager - action. - :param str name: The user-defined name for this instance group manager - action. - :param str resource_type: The resource type. - :param InstanceGroupManagerActionReferenceDeleted deleted: (optional) If - present, this property indicates the referenced resource has been deleted - and provides - some supplementary information. + :param str href: The URL for a page of resources. """ - self.deleted = deleted self.href = href - self.id = id - self.name = name - self.resource_type = resource_type @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerActionReference': - """Initialize a InstanceGroupManagerActionReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerPolicyCollectionNext': + """Initialize a InstanceGroupManagerPolicyCollectionNext object from a json dictionary.""" args = {} - if 'deleted' in _dict: - args['deleted'] = InstanceGroupManagerActionReferenceDeleted.from_dict(_dict.get('deleted')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in InstanceGroupManagerActionReference JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in InstanceGroupManagerActionReference JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in InstanceGroupManagerActionReference JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in InstanceGroupManagerActionReference JSON') + raise ValueError('Required property \'href\' not present in InstanceGroupManagerPolicyCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupManagerActionReference object from a json dictionary.""" + """Initialize a InstanceGroupManagerPolicyCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type return _dict def _to_dict(self): @@ -31330,63 +35095,72 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupManagerActionReference object.""" + """Return a `str` version of this InstanceGroupManagerPolicyCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupManagerActionReference') -> bool: + def __eq__(self, other: 'InstanceGroupManagerPolicyCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupManagerActionReference') -> bool: + def __ne__(self, other: 'InstanceGroupManagerPolicyCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ResourceTypeEnum(str, Enum): - """ - The resource type. - """ - INSTANCE_GROUP_MANAGER_ACTION = 'instance_group_manager_action' - - -class InstanceGroupManagerActionReferenceDeleted(): +class InstanceGroupManagerPolicyPatch(): """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. + InstanceGroupManagerPolicyPatch. - :attr str more_info: Link to documentation about deleted resources. + :attr str metric_type: (optional) The type of metric to be evaluated. + :attr int metric_value: (optional) The metric value to be evaluated. + :attr str name: (optional) The user-defined name for this instance group manager + policy. """ def __init__(self, - more_info: str) -> None: + *, + metric_type: str = None, + metric_value: int = None, + name: str = None) -> None: """ - Initialize a InstanceGroupManagerActionReferenceDeleted object. + Initialize a InstanceGroupManagerPolicyPatch object. - :param str more_info: Link to documentation about deleted resources. + :param str metric_type: (optional) The type of metric to be evaluated. + :param int metric_value: (optional) The metric value to be evaluated. + :param str name: (optional) The user-defined name for this instance group + manager policy. """ - self.more_info = more_info + self.metric_type = metric_type + self.metric_value = metric_value + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerActionReferenceDeleted': - """Initialize a InstanceGroupManagerActionReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerPolicyPatch': + """Initialize a InstanceGroupManagerPolicyPatch object from a json dictionary.""" args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') - else: - raise ValueError('Required property \'more_info\' not present in InstanceGroupManagerActionReferenceDeleted JSON') + if 'metric_type' in _dict: + args['metric_type'] = _dict.get('metric_type') + if 'metric_value' in _dict: + args['metric_value'] = _dict.get('metric_value') + if 'name' in _dict: + args['name'] = _dict.get('name') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupManagerActionReferenceDeleted object from a json dictionary.""" + """Initialize a InstanceGroupManagerPolicyPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'metric_type') and self.metric_type is not None: + _dict['metric_type'] = self.metric_type + if hasattr(self, 'metric_value') and self.metric_value is not None: + _dict['metric_value'] = self.metric_value + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -31394,110 +35168,124 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupManagerActionReferenceDeleted object.""" + """Return a `str` version of this InstanceGroupManagerPolicyPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupManagerActionReferenceDeleted') -> bool: + def __eq__(self, other: 'InstanceGroupManagerPolicyPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupManagerActionReferenceDeleted') -> bool: + def __ne__(self, other: 'InstanceGroupManagerPolicyPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupManagerActionsCollection(): + class MetricTypeEnum(str, Enum): + """ + The type of metric to be evaluated. + """ + CPU = 'cpu' + MEMORY = 'memory' + NETWORK_IN = 'network_in' + NETWORK_OUT = 'network_out' + + +class InstanceGroupManagerPolicyPrototype(): """ - InstanceGroupManagerActionsCollection. + InstanceGroupManagerPolicyPrototype. - :attr List[InstanceGroupManagerAction] actions: Collection of instance group - manager actions. - :attr InstanceGroupManagerActionsCollectionFirst first: A link to the first page - of resources. - :attr int limit: The maximum number of resources that can be returned by the - request. - :attr InstanceGroupManagerActionsCollectionNext next: (optional) A link to the - next page of resources. This property is present for all pages - except the last page. - :attr int total_count: The total number of resources across all pages. + :attr str name: (optional) The user-defined name for this instance group manager + policy. Names must be unique within the instance group manager. If unspecified, + the name will be a hyphenated list of randomly-selected words. """ def __init__(self, - actions: List['InstanceGroupManagerAction'], - first: 'InstanceGroupManagerActionsCollectionFirst', - limit: int, - total_count: int, *, - next: 'InstanceGroupManagerActionsCollectionNext' = None) -> None: + name: str = None) -> None: + """ + Initialize a InstanceGroupManagerPolicyPrototype object. + + :param str name: (optional) The user-defined name for this instance group + manager policy. Names must be unique within the instance group manager. If + unspecified, the name will be a hyphenated list of randomly-selected words. + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype'])) + raise Exception(msg) + +class InstanceGroupManagerPolicyReference(): + """ + InstanceGroupManagerPolicyReference. + + :attr InstanceGroupManagerPolicyReferenceDeleted deleted: (optional) If present, + this property indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str href: The URL for this instance group manager policy. + :attr str id: The unique identifier for this instance group manager policy. + :attr str name: The user-defined name for this instance group manager policy. + """ + + def __init__(self, + href: str, + id: str, + name: str, + *, + deleted: 'InstanceGroupManagerPolicyReferenceDeleted' = None) -> None: """ - Initialize a InstanceGroupManagerActionsCollection object. + Initialize a InstanceGroupManagerPolicyReference object. - :param List[InstanceGroupManagerAction] actions: Collection of instance - group manager actions. - :param InstanceGroupManagerActionsCollectionFirst first: A link to the - first page of resources. - :param int limit: The maximum number of resources that can be returned by - the request. - :param int total_count: The total number of resources across all pages. - :param InstanceGroupManagerActionsCollectionNext next: (optional) A link to - the next page of resources. This property is present for all pages - except the last page. + :param str href: The URL for this instance group manager policy. + :param str id: The unique identifier for this instance group manager + policy. + :param str name: The user-defined name for this instance group manager + policy. + :param InstanceGroupManagerPolicyReferenceDeleted deleted: (optional) If + present, this property indicates the referenced resource has been deleted + and provides + some supplementary information. """ - self.actions = actions - self.first = first - self.limit = limit - self.next = next - self.total_count = total_count + self.deleted = deleted + self.href = href + self.id = id + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerActionsCollection': - """Initialize a InstanceGroupManagerActionsCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerPolicyReference': + """Initialize a InstanceGroupManagerPolicyReference object from a json dictionary.""" args = {} - if 'actions' in _dict: - args['actions'] = _dict.get('actions') - else: - raise ValueError('Required property \'actions\' not present in InstanceGroupManagerActionsCollection JSON') - if 'first' in _dict: - args['first'] = InstanceGroupManagerActionsCollectionFirst.from_dict(_dict.get('first')) + if 'deleted' in _dict: + args['deleted'] = InstanceGroupManagerPolicyReferenceDeleted.from_dict(_dict.get('deleted')) + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'first\' not present in InstanceGroupManagerActionsCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') + raise ValueError('Required property \'href\' not present in InstanceGroupManagerPolicyReference JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') else: - raise ValueError('Required property \'limit\' not present in InstanceGroupManagerActionsCollection JSON') - if 'next' in _dict: - args['next'] = InstanceGroupManagerActionsCollectionNext.from_dict(_dict.get('next')) - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') + raise ValueError('Required property \'id\' not present in InstanceGroupManagerPolicyReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') else: - raise ValueError('Required property \'total_count\' not present in InstanceGroupManagerActionsCollection JSON') + raise ValueError('Required property \'name\' not present in InstanceGroupManagerPolicyReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupManagerActionsCollection object from a json dictionary.""" + """Initialize a InstanceGroupManagerPolicyReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'actions') and self.actions is not None: - actions_list = [] - for x in self.actions: - if isinstance(x, dict): - actions_list.append(x) - else: - actions_list.append(x.to_dict()) - _dict['actions'] = actions_list - if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -31505,55 +35293,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupManagerActionsCollection object.""" + """Return a `str` version of this InstanceGroupManagerPolicyReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupManagerActionsCollection') -> bool: + def __eq__(self, other: 'InstanceGroupManagerPolicyReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupManagerActionsCollection') -> bool: + def __ne__(self, other: 'InstanceGroupManagerPolicyReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupManagerActionsCollectionFirst(): +class InstanceGroupManagerPolicyReferenceDeleted(): """ - A link to the first page of resources. + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. - :attr str href: The URL for a page of resources. + :attr str more_info: Link to documentation about deleted resources. """ def __init__(self, - href: str) -> None: + more_info: str) -> None: """ - Initialize a InstanceGroupManagerActionsCollectionFirst object. + Initialize a InstanceGroupManagerPolicyReferenceDeleted object. - :param str href: The URL for a page of resources. + :param str more_info: Link to documentation about deleted resources. """ - self.href = href + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerActionsCollectionFirst': - """Initialize a InstanceGroupManagerActionsCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerPolicyReferenceDeleted': + """Initialize a InstanceGroupManagerPolicyReferenceDeleted object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'href\' not present in InstanceGroupManagerActionsCollectionFirst JSON') + raise ValueError('Required property \'more_info\' not present in InstanceGroupManagerPolicyReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupManagerActionsCollectionFirst object from a json dictionary.""" + """Initialize a InstanceGroupManagerPolicyReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -31561,56 +35350,117 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupManagerActionsCollectionFirst object.""" + """Return a `str` version of this InstanceGroupManagerPolicyReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupManagerActionsCollectionFirst') -> bool: + def __eq__(self, other: 'InstanceGroupManagerPolicyReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupManagerActionsCollectionFirst') -> bool: + def __ne__(self, other: 'InstanceGroupManagerPolicyReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupManagerActionsCollectionNext(): +class InstanceGroupManagerPrototype(): """ - A link to the next page of resources. This property is present for all pages except - the last page. + InstanceGroupManagerPrototype. - :attr str href: The URL for a page of resources. + :attr bool management_enabled: (optional) Indicates whether this manager will + control the instance group. + :attr str name: (optional) The user-defined name for this instance group + manager. Names must be unique within the instance group. If unspecified, the + name will be a hyphenated list of randomly-selected words. """ def __init__(self, - href: str) -> None: + *, + management_enabled: bool = None, + name: str = None) -> None: """ - Initialize a InstanceGroupManagerActionsCollectionNext object. + Initialize a InstanceGroupManagerPrototype object. - :param str href: The URL for a page of resources. + :param bool management_enabled: (optional) Indicates whether this manager + will control the instance group. + :param str name: (optional) The user-defined name for this instance group + manager. Names must be unique within the instance group. If unspecified, + the name will be a hyphenated list of randomly-selected words. + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype', 'InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype'])) + raise Exception(msg) + +class InstanceGroupManagerReference(): + """ + InstanceGroupManagerReference. + + :attr InstanceGroupManagerReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str href: The URL for this instance group manager. + :attr str id: The unique identifier for this instance group manager. + :attr str name: The user-defined name for this instance group manager. + """ + + def __init__(self, + href: str, + id: str, + name: str, + *, + deleted: 'InstanceGroupManagerReferenceDeleted' = None) -> None: + """ + Initialize a InstanceGroupManagerReference object. + + :param str href: The URL for this instance group manager. + :param str id: The unique identifier for this instance group manager. + :param str name: The user-defined name for this instance group manager. + :param InstanceGroupManagerReferenceDeleted deleted: (optional) If present, + this property indicates the referenced resource has been deleted and + provides + some supplementary information. """ + self.deleted = deleted self.href = href + self.id = id + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerActionsCollectionNext': - """Initialize a InstanceGroupManagerActionsCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerReference': + """Initialize a InstanceGroupManagerReference object from a json dictionary.""" args = {} + if 'deleted' in _dict: + args['deleted'] = InstanceGroupManagerReferenceDeleted.from_dict(_dict.get('deleted')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in InstanceGroupManagerActionsCollectionNext JSON') + raise ValueError('Required property \'href\' not present in InstanceGroupManagerReference JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in InstanceGroupManagerReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in InstanceGroupManagerReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupManagerActionsCollectionNext object from a json dictionary.""" + """Initialize a InstanceGroupManagerReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -31618,110 +35468,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupManagerActionsCollectionNext object.""" + """Return a `str` version of this InstanceGroupManagerReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupManagerActionsCollectionNext') -> bool: + def __eq__(self, other: 'InstanceGroupManagerReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupManagerActionsCollectionNext') -> bool: + def __ne__(self, other: 'InstanceGroupManagerReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupManagerCollection(): +class InstanceGroupManagerReferenceDeleted(): """ - InstanceGroupManagerCollection. + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. - :attr InstanceGroupManagerCollectionFirst first: A link to the first page of - resources. - :attr int limit: The maximum number of resources that can be returned by the - request. - :attr List[InstanceGroupManager] managers: Collection of instance group - managers. - :attr InstanceGroupManagerCollectionNext next: (optional) A link to the next - page of resources. This property is present for all pages - except the last page. - :attr int total_count: The total number of resources across all pages. + :attr str more_info: Link to documentation about deleted resources. """ def __init__(self, - first: 'InstanceGroupManagerCollectionFirst', - limit: int, - managers: List['InstanceGroupManager'], - total_count: int, - *, - next: 'InstanceGroupManagerCollectionNext' = None) -> None: + more_info: str) -> None: """ - Initialize a InstanceGroupManagerCollection object. + Initialize a InstanceGroupManagerReferenceDeleted object. - :param InstanceGroupManagerCollectionFirst first: A link to the first page - of resources. - :param int limit: The maximum number of resources that can be returned by - the request. - :param List[InstanceGroupManager] managers: Collection of instance group - managers. - :param int total_count: The total number of resources across all pages. - :param InstanceGroupManagerCollectionNext next: (optional) A link to the - next page of resources. This property is present for all pages - except the last page. + :param str more_info: Link to documentation about deleted resources. """ - self.first = first - self.limit = limit - self.managers = managers - self.next = next - self.total_count = total_count + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerCollection': - """Initialize a InstanceGroupManagerCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerReferenceDeleted': + """Initialize a InstanceGroupManagerReferenceDeleted object from a json dictionary.""" args = {} - if 'first' in _dict: - args['first'] = InstanceGroupManagerCollectionFirst.from_dict(_dict.get('first')) - else: - raise ValueError('Required property \'first\' not present in InstanceGroupManagerCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') - else: - raise ValueError('Required property \'limit\' not present in InstanceGroupManagerCollection JSON') - if 'managers' in _dict: - args['managers'] = _dict.get('managers') - else: - raise ValueError('Required property \'managers\' not present in InstanceGroupManagerCollection JSON') - if 'next' in _dict: - args['next'] = InstanceGroupManagerCollectionNext.from_dict(_dict.get('next')) - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'total_count\' not present in InstanceGroupManagerCollection JSON') + raise ValueError('Required property \'more_info\' not present in InstanceGroupManagerReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupManagerCollection object from a json dictionary.""" + """Initialize a InstanceGroupManagerReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'managers') and self.managers is not None: - managers_list = [] - for x in self.managers: - if isinstance(x, dict): - managers_list.append(x) - else: - managers_list.append(x.to_dict()) - _dict['managers'] = managers_list - if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -31729,55 +35525,57 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupManagerCollection object.""" + """Return a `str` version of this InstanceGroupManagerReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupManagerCollection') -> bool: + def __eq__(self, other: 'InstanceGroupManagerReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupManagerCollection') -> bool: + def __ne__(self, other: 'InstanceGroupManagerReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupManagerCollectionFirst(): +class InstanceGroupManagerScheduledActionGroup(): """ - A link to the first page of resources. + InstanceGroupManagerScheduledActionGroup. - :attr str href: The URL for a page of resources. + :attr int membership_count: The desired number of instance group members at the + scheduled time. """ def __init__(self, - href: str) -> None: + membership_count: int) -> None: """ - Initialize a InstanceGroupManagerCollectionFirst object. + Initialize a InstanceGroupManagerScheduledActionGroup object. - :param str href: The URL for a page of resources. + :param int membership_count: The desired number of instance group members + at the scheduled time. """ - self.href = href + self.membership_count = membership_count @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerCollectionFirst': - """Initialize a InstanceGroupManagerCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerScheduledActionGroup': + """Initialize a InstanceGroupManagerScheduledActionGroup object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') + if 'membership_count' in _dict: + args['membership_count'] = _dict.get('membership_count') else: - raise ValueError('Required property \'href\' not present in InstanceGroupManagerCollectionFirst JSON') + raise ValueError('Required property \'membership_count\' not present in InstanceGroupManagerScheduledActionGroup JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupManagerCollectionFirst object from a json dictionary.""" + """Initialize a InstanceGroupManagerScheduledActionGroup object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'membership_count') and self.membership_count is not None: + _dict['membership_count'] = self.membership_count return _dict def _to_dict(self): @@ -31785,56 +35583,57 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupManagerCollectionFirst object.""" + """Return a `str` version of this InstanceGroupManagerScheduledActionGroup object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupManagerCollectionFirst') -> bool: + def __eq__(self, other: 'InstanceGroupManagerScheduledActionGroup') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupManagerCollectionFirst') -> bool: + def __ne__(self, other: 'InstanceGroupManagerScheduledActionGroup') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupManagerCollectionNext(): +class InstanceGroupManagerScheduledActionGroupPrototype(): """ - A link to the next page of resources. This property is present for all pages except - the last page. + InstanceGroupManagerScheduledActionGroupPrototype. - :attr str href: The URL for a page of resources. + :attr int membership_count: The desired number of instance group members at the + scheduled time. """ def __init__(self, - href: str) -> None: + membership_count: int) -> None: """ - Initialize a InstanceGroupManagerCollectionNext object. + Initialize a InstanceGroupManagerScheduledActionGroupPrototype object. - :param str href: The URL for a page of resources. + :param int membership_count: The desired number of instance group members + at the scheduled time. """ - self.href = href + self.membership_count = membership_count @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerCollectionNext': - """Initialize a InstanceGroupManagerCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerScheduledActionGroupPrototype': + """Initialize a InstanceGroupManagerScheduledActionGroupPrototype object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') + if 'membership_count' in _dict: + args['membership_count'] = _dict.get('membership_count') else: - raise ValueError('Required property \'href\' not present in InstanceGroupManagerCollectionNext JSON') + raise ValueError('Required property \'membership_count\' not present in InstanceGroupManagerScheduledActionGroupPrototype JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupManagerCollectionNext object from a json dictionary.""" + """Initialize a InstanceGroupManagerScheduledActionGroupPrototype object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'membership_count') and self.membership_count is not None: + _dict['membership_count'] = self.membership_count return _dict def _to_dict(self): @@ -31842,106 +35641,192 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupManagerCollectionNext object.""" + """Return a `str` version of this InstanceGroupManagerScheduledActionGroupPrototype object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupManagerCollectionNext') -> bool: + def __eq__(self, other: 'InstanceGroupManagerScheduledActionGroupPrototype') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupManagerCollectionNext') -> bool: + def __ne__(self, other: 'InstanceGroupManagerScheduledActionGroupPrototype') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupManagerPatch(): +class InstanceGroupManagerScheduledActionManager(): """ - InstanceGroupManagerPatch. + InstanceGroupManagerScheduledActionManager. - :attr int aggregation_window: (optional) The time window in seconds to aggregate - metrics prior to evaluation. - :attr int cooldown: (optional) The duration of time in seconds to pause further - scale actions after scaling has taken place. - :attr bool management_enabled: (optional) Indicates whether this manager will - control the instance group. - :attr int max_membership_count: (optional) The maximum number of members in a - managed instance group. - :attr int min_membership_count: (optional) The minimum number of members in a - managed instance group. - :attr str name: (optional) The user-defined name for this instance group - manager. + """ + + def __init__(self) -> None: + """ + Initialize a InstanceGroupManagerScheduledActionManager object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['InstanceGroupManagerScheduledActionManagerAutoScale'])) + raise Exception(msg) + +class InstanceGroupManagerScheduledActionManagerPrototype(): + """ + InstanceGroupManagerScheduledActionManagerPrototype. + + """ + + def __init__(self) -> None: + """ + Initialize a InstanceGroupManagerScheduledActionManagerPrototype object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype'])) + raise Exception(msg) + +class InstanceGroupMembership(): + """ + InstanceGroupMembership. + + :attr datetime created_at: The date and time that the instance group manager + policy was created. + :attr bool delete_instance_on_membership_delete: If set to true, when deleting + the membership the instance will also be deleted. + :attr str href: The URL for this instance group membership. + :attr str id: The unique identifier for this instance group membership. + :attr InstanceReference instance: + :attr InstanceTemplateReference instance_template: + :attr str name: The user-defined name for this instance group membership. Names + must be unique within the instance group. + :attr LoadBalancerPoolMemberReference pool_member: (optional) + :attr str status: The status of the instance group membership + - `deleting`: Membership is deleting dependent resources + - `failed`: Membership was unable to maintain dependent resources + - `healthy`: Membership is active and serving in the group + - `pending`: Membership is waiting for dependent resources + - `unhealthy`: Membership has unhealthy dependent resources. + :attr datetime updated_at: The date and time that the instance group membership + was updated. """ def __init__(self, + created_at: datetime, + delete_instance_on_membership_delete: bool, + href: str, + id: str, + instance: 'InstanceReference', + instance_template: 'InstanceTemplateReference', + name: str, + status: str, + updated_at: datetime, *, - aggregation_window: int = None, - cooldown: int = None, - management_enabled: bool = None, - max_membership_count: int = None, - min_membership_count: int = None, - name: str = None) -> None: + pool_member: 'LoadBalancerPoolMemberReference' = None) -> None: """ - Initialize a InstanceGroupManagerPatch object. + Initialize a InstanceGroupMembership object. - :param int aggregation_window: (optional) The time window in seconds to - aggregate metrics prior to evaluation. - :param int cooldown: (optional) The duration of time in seconds to pause - further scale actions after scaling has taken place. - :param bool management_enabled: (optional) Indicates whether this manager - will control the instance group. - :param int max_membership_count: (optional) The maximum number of members - in a managed instance group. - :param int min_membership_count: (optional) The minimum number of members - in a managed instance group. - :param str name: (optional) The user-defined name for this instance group - manager. + :param datetime created_at: The date and time that the instance group + manager policy was created. + :param bool delete_instance_on_membership_delete: If set to true, when + deleting the membership the instance will also be deleted. + :param str href: The URL for this instance group membership. + :param str id: The unique identifier for this instance group membership. + :param InstanceReference instance: + :param InstanceTemplateReference instance_template: + :param str name: The user-defined name for this instance group membership. + Names must be unique within the instance group. + :param str status: The status of the instance group membership + - `deleting`: Membership is deleting dependent resources + - `failed`: Membership was unable to maintain dependent resources + - `healthy`: Membership is active and serving in the group + - `pending`: Membership is waiting for dependent resources + - `unhealthy`: Membership has unhealthy dependent resources. + :param datetime updated_at: The date and time that the instance group + membership was updated. + :param LoadBalancerPoolMemberReference pool_member: (optional) """ - self.aggregation_window = aggregation_window - self.cooldown = cooldown - self.management_enabled = management_enabled - self.max_membership_count = max_membership_count - self.min_membership_count = min_membership_count + self.created_at = created_at + self.delete_instance_on_membership_delete = delete_instance_on_membership_delete + self.href = href + self.id = id + self.instance = instance + self.instance_template = instance_template self.name = name + self.pool_member = pool_member + self.status = status + self.updated_at = updated_at @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerPatch': - """Initialize a InstanceGroupManagerPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupMembership': + """Initialize a InstanceGroupMembership object from a json dictionary.""" args = {} - if 'aggregation_window' in _dict: - args['aggregation_window'] = _dict.get('aggregation_window') - if 'cooldown' in _dict: - args['cooldown'] = _dict.get('cooldown') - if 'management_enabled' in _dict: - args['management_enabled'] = _dict.get('management_enabled') - if 'max_membership_count' in _dict: - args['max_membership_count'] = _dict.get('max_membership_count') - if 'min_membership_count' in _dict: - args['min_membership_count'] = _dict.get('min_membership_count') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) + else: + raise ValueError('Required property \'created_at\' not present in InstanceGroupMembership JSON') + if 'delete_instance_on_membership_delete' in _dict: + args['delete_instance_on_membership_delete'] = _dict.get('delete_instance_on_membership_delete') + else: + raise ValueError('Required property \'delete_instance_on_membership_delete\' not present in InstanceGroupMembership JSON') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in InstanceGroupMembership JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in InstanceGroupMembership JSON') + if 'instance' in _dict: + args['instance'] = InstanceReference.from_dict(_dict.get('instance')) + else: + raise ValueError('Required property \'instance\' not present in InstanceGroupMembership JSON') + if 'instance_template' in _dict: + args['instance_template'] = InstanceTemplateReference.from_dict(_dict.get('instance_template')) + else: + raise ValueError('Required property \'instance_template\' not present in InstanceGroupMembership JSON') if 'name' in _dict: args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in InstanceGroupMembership JSON') + if 'pool_member' in _dict: + args['pool_member'] = LoadBalancerPoolMemberReference.from_dict(_dict.get('pool_member')) + if 'status' in _dict: + args['status'] = _dict.get('status') + else: + raise ValueError('Required property \'status\' not present in InstanceGroupMembership JSON') + if 'updated_at' in _dict: + args['updated_at'] = string_to_datetime(_dict.get('updated_at')) + else: + raise ValueError('Required property \'updated_at\' not present in InstanceGroupMembership JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupManagerPatch object from a json dictionary.""" + """Initialize a InstanceGroupMembership object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'aggregation_window') and self.aggregation_window is not None: - _dict['aggregation_window'] = self.aggregation_window - if hasattr(self, 'cooldown') and self.cooldown is not None: - _dict['cooldown'] = self.cooldown - if hasattr(self, 'management_enabled') and self.management_enabled is not None: - _dict['management_enabled'] = self.management_enabled - if hasattr(self, 'max_membership_count') and self.max_membership_count is not None: - _dict['max_membership_count'] = self.max_membership_count - if hasattr(self, 'min_membership_count') and self.min_membership_count is not None: - _dict['min_membership_count'] = self.min_membership_count + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'delete_instance_on_membership_delete') and self.delete_instance_on_membership_delete is not None: + _dict['delete_instance_on_membership_delete'] = self.delete_instance_on_membership_delete + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'instance') and self.instance is not None: + _dict['instance'] = self.instance.to_dict() + if hasattr(self, 'instance_template') and self.instance_template is not None: + _dict['instance_template'] = self.instance_template.to_dict() if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name + if hasattr(self, 'pool_member') and self.pool_member is not None: + _dict['pool_member'] = self.pool_member.to_dict() + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'updated_at') and self.updated_at is not None: + _dict['updated_at'] = datetime_to_string(self.updated_at) return _dict def _to_dict(self): @@ -31949,125 +35834,105 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupManagerPatch object.""" + """Return a `str` version of this InstanceGroupMembership object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupManagerPatch') -> bool: + def __eq__(self, other: 'InstanceGroupMembership') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupManagerPatch') -> bool: + def __ne__(self, other: 'InstanceGroupMembership') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupManagerPolicy(): - """ - InstanceGroupManagerPolicy. - - :attr datetime created_at: The date and time that the instance group manager - policy was created. - :attr str href: The URL for this instance group manager policy. - :attr str id: The unique identifier for this instance group manager policy. - :attr str name: The user-defined name for this instance group manager policy. - :attr datetime updated_at: The date and time that the instance group manager - policy was updated. - """ - - def __init__(self, - created_at: datetime, - href: str, - id: str, - name: str, - updated_at: datetime) -> None: + class StatusEnum(str, Enum): """ - Initialize a InstanceGroupManagerPolicy object. - - :param datetime created_at: The date and time that the instance group - manager policy was created. - :param str href: The URL for this instance group manager policy. - :param str id: The unique identifier for this instance group manager - policy. - :param str name: The user-defined name for this instance group manager - policy. - :param datetime updated_at: The date and time that the instance group - manager policy was updated. + The status of the instance group membership + - `deleting`: Membership is deleting dependent resources + - `failed`: Membership was unable to maintain dependent resources + - `healthy`: Membership is active and serving in the group + - `pending`: Membership is waiting for dependent resources + - `unhealthy`: Membership has unhealthy dependent resources. """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy'])) - raise Exception(msg) + DELETING = 'deleting' + FAILED = 'failed' + HEALTHY = 'healthy' + PENDING = 'pending' + UNHEALTHY = 'unhealthy' -class InstanceGroupManagerPolicyCollection(): + +class InstanceGroupMembershipCollection(): """ - InstanceGroupManagerPolicyCollection. + InstanceGroupMembershipCollection. - :attr InstanceGroupManagerPolicyCollectionFirst first: A link to the first page - of resources. + :attr InstanceGroupMembershipCollectionFirst first: A link to the first page of + resources. :attr int limit: The maximum number of resources that can be returned by the request. - :attr InstanceGroupManagerPolicyCollectionNext next: (optional) A link to the - next page of resources. This property is present for all pages + :attr List[InstanceGroupMembership] memberships: Collection of instance group + memberships. + :attr InstanceGroupMembershipCollectionNext next: (optional) A link to the next + page of resources. This property is present for all pages except the last page. - :attr List[InstanceGroupManagerPolicy] policies: Collection of instance group - manager policies. :attr int total_count: The total number of resources across all pages. """ def __init__(self, - first: 'InstanceGroupManagerPolicyCollectionFirst', + first: 'InstanceGroupMembershipCollectionFirst', limit: int, - policies: List['InstanceGroupManagerPolicy'], + memberships: List['InstanceGroupMembership'], total_count: int, *, - next: 'InstanceGroupManagerPolicyCollectionNext' = None) -> None: + next: 'InstanceGroupMembershipCollectionNext' = None) -> None: """ - Initialize a InstanceGroupManagerPolicyCollection object. + Initialize a InstanceGroupMembershipCollection object. - :param InstanceGroupManagerPolicyCollectionFirst first: A link to the first + :param InstanceGroupMembershipCollectionFirst first: A link to the first page of resources. :param int limit: The maximum number of resources that can be returned by the request. - :param List[InstanceGroupManagerPolicy] policies: Collection of instance - group manager policies. + :param List[InstanceGroupMembership] memberships: Collection of instance + group memberships. :param int total_count: The total number of resources across all pages. - :param InstanceGroupManagerPolicyCollectionNext next: (optional) A link to - the next page of resources. This property is present for all pages + :param InstanceGroupMembershipCollectionNext next: (optional) A link to the + next page of resources. This property is present for all pages except the last page. """ self.first = first self.limit = limit + self.memberships = memberships self.next = next - self.policies = policies self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerPolicyCollection': - """Initialize a InstanceGroupManagerPolicyCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupMembershipCollection': + """Initialize a InstanceGroupMembershipCollection object from a json dictionary.""" args = {} if 'first' in _dict: - args['first'] = InstanceGroupManagerPolicyCollectionFirst.from_dict(_dict.get('first')) + args['first'] = InstanceGroupMembershipCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'first\' not present in InstanceGroupManagerPolicyCollection JSON') + raise ValueError('Required property \'first\' not present in InstanceGroupMembershipCollection JSON') if 'limit' in _dict: args['limit'] = _dict.get('limit') else: - raise ValueError('Required property \'limit\' not present in InstanceGroupManagerPolicyCollection JSON') - if 'next' in _dict: - args['next'] = InstanceGroupManagerPolicyCollectionNext.from_dict(_dict.get('next')) - if 'policies' in _dict: - args['policies'] = _dict.get('policies') + raise ValueError('Required property \'limit\' not present in InstanceGroupMembershipCollection JSON') + if 'memberships' in _dict: + args['memberships'] = [InstanceGroupMembership.from_dict(x) for x in _dict.get('memberships')] else: - raise ValueError('Required property \'policies\' not present in InstanceGroupManagerPolicyCollection JSON') + raise ValueError('Required property \'memberships\' not present in InstanceGroupMembershipCollection JSON') + if 'next' in _dict: + args['next'] = InstanceGroupMembershipCollectionNext.from_dict(_dict.get('next')) if 'total_count' in _dict: args['total_count'] = _dict.get('total_count') else: - raise ValueError('Required property \'total_count\' not present in InstanceGroupManagerPolicyCollection JSON') + raise ValueError('Required property \'total_count\' not present in InstanceGroupMembershipCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupManagerPolicyCollection object from a json dictionary.""" + """Initialize a InstanceGroupMembershipCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -32077,16 +35942,10 @@ def to_dict(self) -> Dict: _dict['first'] = self.first.to_dict() if hasattr(self, 'limit') and self.limit is not None: _dict['limit'] = self.limit + if hasattr(self, 'memberships') and self.memberships is not None: + _dict['memberships'] = [x.to_dict() for x in self.memberships] if hasattr(self, 'next') and self.next is not None: _dict['next'] = self.next.to_dict() - if hasattr(self, 'policies') and self.policies is not None: - policies_list = [] - for x in self.policies: - if isinstance(x, dict): - policies_list.append(x) - else: - policies_list.append(x.to_dict()) - _dict['policies'] = policies_list if hasattr(self, 'total_count') and self.total_count is not None: _dict['total_count'] = self.total_count return _dict @@ -32096,20 +35955,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupManagerPolicyCollection object.""" + """Return a `str` version of this InstanceGroupMembershipCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupManagerPolicyCollection') -> bool: + def __eq__(self, other: 'InstanceGroupMembershipCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupManagerPolicyCollection') -> bool: + def __ne__(self, other: 'InstanceGroupMembershipCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupManagerPolicyCollectionFirst(): +class InstanceGroupMembershipCollectionFirst(): """ A link to the first page of resources. @@ -32119,25 +35978,25 @@ class InstanceGroupManagerPolicyCollectionFirst(): def __init__(self, href: str) -> None: """ - Initialize a InstanceGroupManagerPolicyCollectionFirst object. + Initialize a InstanceGroupMembershipCollectionFirst object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerPolicyCollectionFirst': - """Initialize a InstanceGroupManagerPolicyCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupMembershipCollectionFirst': + """Initialize a InstanceGroupMembershipCollectionFirst object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in InstanceGroupManagerPolicyCollectionFirst JSON') + raise ValueError('Required property \'href\' not present in InstanceGroupMembershipCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupManagerPolicyCollectionFirst object from a json dictionary.""" + """Initialize a InstanceGroupMembershipCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -32152,20 +36011,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupManagerPolicyCollectionFirst object.""" + """Return a `str` version of this InstanceGroupMembershipCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupManagerPolicyCollectionFirst') -> bool: + def __eq__(self, other: 'InstanceGroupMembershipCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupManagerPolicyCollectionFirst') -> bool: + def __ne__(self, other: 'InstanceGroupMembershipCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupManagerPolicyCollectionNext(): +class InstanceGroupMembershipCollectionNext(): """ A link to the next page of resources. This property is present for all pages except the last page. @@ -32176,25 +36035,25 @@ class InstanceGroupManagerPolicyCollectionNext(): def __init__(self, href: str) -> None: """ - Initialize a InstanceGroupManagerPolicyCollectionNext object. + Initialize a InstanceGroupMembershipCollectionNext object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerPolicyCollectionNext': - """Initialize a InstanceGroupManagerPolicyCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupMembershipCollectionNext': + """Initialize a InstanceGroupMembershipCollectionNext object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in InstanceGroupManagerPolicyCollectionNext JSON') + raise ValueError('Required property \'href\' not present in InstanceGroupMembershipCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupManagerPolicyCollectionNext object from a json dictionary.""" + """Initialize a InstanceGroupMembershipCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -32209,70 +36068,54 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupManagerPolicyCollectionNext object.""" + """Return a `str` version of this InstanceGroupMembershipCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupManagerPolicyCollectionNext') -> bool: + def __eq__(self, other: 'InstanceGroupMembershipCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupManagerPolicyCollectionNext') -> bool: + def __ne__(self, other: 'InstanceGroupMembershipCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupManagerPolicyPatch(): +class InstanceGroupMembershipPatch(): """ - InstanceGroupManagerPolicyPatch. + InstanceGroupMembershipPatch. - :attr str metric_type: (optional) The type of metric to be evaluated. - :attr int metric_value: (optional) The metric value to be evaluated. - :attr str name: (optional) The user-defined name for this instance group manager - policy. + :attr str name: (optional) The user-defined name for this instance group + membership. Names must be unique within the instance group. """ def __init__(self, *, - metric_type: str = None, - metric_value: int = None, name: str = None) -> None: """ - Initialize a InstanceGroupManagerPolicyPatch object. + Initialize a InstanceGroupMembershipPatch object. - :param str metric_type: (optional) The type of metric to be evaluated. - :param int metric_value: (optional) The metric value to be evaluated. :param str name: (optional) The user-defined name for this instance group - manager policy. + membership. Names must be unique within the instance group. """ - self.metric_type = metric_type - self.metric_value = metric_value self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerPolicyPatch': - """Initialize a InstanceGroupManagerPolicyPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupMembershipPatch': + """Initialize a InstanceGroupMembershipPatch object from a json dictionary.""" args = {} - if 'metric_type' in _dict: - args['metric_type'] = _dict.get('metric_type') - if 'metric_value' in _dict: - args['metric_value'] = _dict.get('metric_value') if 'name' in _dict: args['name'] = _dict.get('name') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupManagerPolicyPatch object from a json dictionary.""" + """Initialize a InstanceGroupMembershipPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'metric_type') and self.metric_type is not None: - _dict['metric_type'] = self.metric_type - if hasattr(self, 'metric_value') and self.metric_value is not None: - _dict['metric_value'] = self.metric_value if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name return _dict @@ -32282,181 +36125,148 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupManagerPolicyPatch object.""" + """Return a `str` version of this InstanceGroupMembershipPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupManagerPolicyPatch') -> bool: + def __eq__(self, other: 'InstanceGroupMembershipPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupManagerPolicyPatch') -> bool: + def __ne__(self, other: 'InstanceGroupMembershipPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class MetricTypeEnum(str, Enum): - """ - The type of metric to be evaluated. - """ - CPU = 'cpu' - MEMORY = 'memory' - NETWORK_IN = 'network_in' - NETWORK_OUT = 'network_out' - - -class InstanceGroupManagerPolicyPrototype(): - """ - InstanceGroupManagerPolicyPrototype. - - :attr str name: (optional) The user-defined name for this instance group manager - policy. Names must be unique within the instance group manager. If unspecified, - the name will be a hyphenated list of randomly-selected words. - """ - - def __init__(self, - *, - name: str = None) -> None: - """ - Initialize a InstanceGroupManagerPolicyPrototype object. - - :param str name: (optional) The user-defined name for this instance group - manager policy. Names must be unique within the instance group manager. If - unspecified, the name will be a hyphenated list of randomly-selected words. - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype'])) - raise Exception(msg) - -class InstanceGroupManagerPolicyReference(): +class InstanceGroupPatch(): """ - InstanceGroupManagerPolicyReference. + To add or update load balancer specification for an instance group the + `membership_count` must first be set to 0. - :attr InstanceGroupManagerPolicyReferenceDeleted deleted: (optional) If present, - this property indicates the referenced resource has been deleted and provides - some supplementary information. - :attr str href: The URL for this instance group manager policy. - :attr str id: The unique identifier for this instance group manager policy. - :attr str name: The user-defined name for this instance group manager policy. + :attr int application_port: (optional) Required if specifying a load balancer + pool only. Used by the instance group when scaling up instances to supply the + port for the load balancer pool member. + :attr InstanceTemplateIdentity instance_template: (optional) Instance template + to use when creating new instances. + Instance groups are not compatible with instance templates that specify `true` + for + `default_trusted_profile.auto_link`. + :attr LoadBalancerIdentity load_balancer: (optional) The load balancer + associated with the specified load balancer pool. + Required if `load_balancer_pool` is specified. + At present, only load balancers in the `application` family are supported. + :attr LoadBalancerPoolIdentity load_balancer_pool: (optional) If specified, the + load balancer pool will be managed by this + group. Instances created by this group will have a new load + balancer pool member in that pool created. Must be used with + `application_port`. + :attr int membership_count: (optional) The number of instances in the instance + group. + :attr str name: (optional) The user-defined name for this instance group. + :attr List[SubnetIdentity] subnets: (optional) The subnets to use when creating + new instances. """ def __init__(self, - href: str, - id: str, - name: str, *, - deleted: 'InstanceGroupManagerPolicyReferenceDeleted' = None) -> None: + application_port: int = None, + instance_template: 'InstanceTemplateIdentity' = None, + load_balancer: 'LoadBalancerIdentity' = None, + load_balancer_pool: 'LoadBalancerPoolIdentity' = None, + membership_count: int = None, + name: str = None, + subnets: List['SubnetIdentity'] = None) -> None: """ - Initialize a InstanceGroupManagerPolicyReference object. + Initialize a InstanceGroupPatch object. - :param str href: The URL for this instance group manager policy. - :param str id: The unique identifier for this instance group manager - policy. - :param str name: The user-defined name for this instance group manager - policy. - :param InstanceGroupManagerPolicyReferenceDeleted deleted: (optional) If - present, this property indicates the referenced resource has been deleted - and provides - some supplementary information. + :param int application_port: (optional) Required if specifying a load + balancer pool only. Used by the instance group when scaling up instances to + supply the port for the load balancer pool member. + :param InstanceTemplateIdentity instance_template: (optional) Instance + template to use when creating new instances. + Instance groups are not compatible with instance templates that specify + `true` for + `default_trusted_profile.auto_link`. + :param LoadBalancerIdentity load_balancer: (optional) The load balancer + associated with the specified load balancer pool. + Required if `load_balancer_pool` is specified. + At present, only load balancers in the `application` family are supported. + :param LoadBalancerPoolIdentity load_balancer_pool: (optional) If + specified, the load balancer pool will be managed by this + group. Instances created by this group will have a new load + balancer pool member in that pool created. Must be used with + `application_port`. + :param int membership_count: (optional) The number of instances in the + instance group. + :param str name: (optional) The user-defined name for this instance group. + :param List[SubnetIdentity] subnets: (optional) The subnets to use when + creating new instances. """ - self.deleted = deleted - self.href = href - self.id = id + self.application_port = application_port + self.instance_template = instance_template + self.load_balancer = load_balancer + self.load_balancer_pool = load_balancer_pool + self.membership_count = membership_count self.name = name + self.subnets = subnets @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerPolicyReference': - """Initialize a InstanceGroupManagerPolicyReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupPatch': + """Initialize a InstanceGroupPatch object from a json dictionary.""" args = {} - if 'deleted' in _dict: - args['deleted'] = InstanceGroupManagerPolicyReferenceDeleted.from_dict(_dict.get('deleted')) - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in InstanceGroupManagerPolicyReference JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in InstanceGroupManagerPolicyReference JSON') + if 'application_port' in _dict: + args['application_port'] = _dict.get('application_port') + if 'instance_template' in _dict: + args['instance_template'] = _dict.get('instance_template') + if 'load_balancer' in _dict: + args['load_balancer'] = _dict.get('load_balancer') + if 'load_balancer_pool' in _dict: + args['load_balancer_pool'] = _dict.get('load_balancer_pool') + if 'membership_count' in _dict: + args['membership_count'] = _dict.get('membership_count') if 'name' in _dict: args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in InstanceGroupManagerPolicyReference JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a InstanceGroupManagerPolicyReference object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this InstanceGroupManagerPolicyReference object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'InstanceGroupManagerPolicyReference') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'InstanceGroupManagerPolicyReference') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - -class InstanceGroupManagerPolicyReferenceDeleted(): - """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. - - :attr str more_info: Link to documentation about deleted resources. - """ - - def __init__(self, - more_info: str) -> None: - """ - Initialize a InstanceGroupManagerPolicyReferenceDeleted object. - - :param str more_info: Link to documentation about deleted resources. - """ - self.more_info = more_info - - @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerPolicyReferenceDeleted': - """Initialize a InstanceGroupManagerPolicyReferenceDeleted object from a json dictionary.""" - args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') - else: - raise ValueError('Required property \'more_info\' not present in InstanceGroupManagerPolicyReferenceDeleted JSON') + if 'subnets' in _dict: + args['subnets'] = _dict.get('subnets') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupManagerPolicyReferenceDeleted object from a json dictionary.""" + """Initialize a InstanceGroupPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'application_port') and self.application_port is not None: + _dict['application_port'] = self.application_port + if hasattr(self, 'instance_template') and self.instance_template is not None: + if isinstance(self.instance_template, dict): + _dict['instance_template'] = self.instance_template + else: + _dict['instance_template'] = self.instance_template.to_dict() + if hasattr(self, 'load_balancer') and self.load_balancer is not None: + if isinstance(self.load_balancer, dict): + _dict['load_balancer'] = self.load_balancer + else: + _dict['load_balancer'] = self.load_balancer.to_dict() + if hasattr(self, 'load_balancer_pool') and self.load_balancer_pool is not None: + if isinstance(self.load_balancer_pool, dict): + _dict['load_balancer_pool'] = self.load_balancer_pool + else: + _dict['load_balancer_pool'] = self.load_balancer_pool.to_dict() + if hasattr(self, 'membership_count') and self.membership_count is not None: + _dict['membership_count'] = self.membership_count + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'subnets') and self.subnets is not None: + subnets_list = [] + for x in self.subnets: + if isinstance(x, dict): + subnets_list.append(x) + else: + subnets_list.append(x.to_dict()) + _dict['subnets'] = subnets_list return _dict def _to_dict(self): @@ -32464,109 +36274,90 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupManagerPolicyReferenceDeleted object.""" + """Return a `str` version of this InstanceGroupPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupManagerPolicyReferenceDeleted') -> bool: + def __eq__(self, other: 'InstanceGroupPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupManagerPolicyReferenceDeleted') -> bool: + def __ne__(self, other: 'InstanceGroupPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupManagerPrototype(): - """ - InstanceGroupManagerPrototype. - - :attr bool management_enabled: (optional) Indicates whether this manager will - control the instance group. - :attr str name: (optional) The user-defined name for this instance group - manager. Names must be unique within the instance group. If unspecified, the - name will be a hyphenated list of randomly-selected words. - """ - - def __init__(self, - *, - management_enabled: bool = None, - name: str = None) -> None: - """ - Initialize a InstanceGroupManagerPrototype object. - - :param bool management_enabled: (optional) Indicates whether this manager - will control the instance group. - :param str name: (optional) The user-defined name for this instance group - manager. Names must be unique within the instance group. If unspecified, - the name will be a hyphenated list of randomly-selected words. - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype', 'InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype'])) - raise Exception(msg) - -class InstanceGroupManagerReference(): +class InstanceGroupReference(): """ - InstanceGroupManagerReference. + InstanceGroupReference. - :attr InstanceGroupManagerReferenceDeleted deleted: (optional) If present, this + :attr str crn: The CRN for this instance group. + :attr InstanceGroupReferenceDeleted deleted: (optional) If present, this property indicates the referenced resource has been deleted and provides some supplementary information. - :attr str href: The URL for this instance group manager. - :attr str id: The unique identifier for this instance group manager. - :attr str name: The user-defined name for this instance group manager. + :attr str href: The URL for this instance group. + :attr str id: The unique identifier for this instance group. + :attr str name: The user-defined name for this instance group. """ def __init__(self, + crn: str, href: str, id: str, name: str, *, - deleted: 'InstanceGroupManagerReferenceDeleted' = None) -> None: + deleted: 'InstanceGroupReferenceDeleted' = None) -> None: """ - Initialize a InstanceGroupManagerReference object. + Initialize a InstanceGroupReference object. - :param str href: The URL for this instance group manager. - :param str id: The unique identifier for this instance group manager. - :param str name: The user-defined name for this instance group manager. - :param InstanceGroupManagerReferenceDeleted deleted: (optional) If present, - this property indicates the referenced resource has been deleted and - provides + :param str crn: The CRN for this instance group. + :param str href: The URL for this instance group. + :param str id: The unique identifier for this instance group. + :param str name: The user-defined name for this instance group. + :param InstanceGroupReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides some supplementary information. """ + self.crn = crn self.deleted = deleted self.href = href self.id = id self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerReference': - """Initialize a InstanceGroupManagerReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupReference': + """Initialize a InstanceGroupReference object from a json dictionary.""" args = {} + if 'crn' in _dict: + args['crn'] = _dict.get('crn') + else: + raise ValueError('Required property \'crn\' not present in InstanceGroupReference JSON') if 'deleted' in _dict: - args['deleted'] = InstanceGroupManagerReferenceDeleted.from_dict(_dict.get('deleted')) + args['deleted'] = InstanceGroupReferenceDeleted.from_dict(_dict.get('deleted')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in InstanceGroupManagerReference JSON') + raise ValueError('Required property \'href\' not present in InstanceGroupReference JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in InstanceGroupManagerReference JSON') + raise ValueError('Required property \'id\' not present in InstanceGroupReference JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in InstanceGroupManagerReference JSON') + raise ValueError('Required property \'name\' not present in InstanceGroupReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupManagerReference object from a json dictionary.""" + """Initialize a InstanceGroupReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn if hasattr(self, 'deleted') and self.deleted is not None: _dict['deleted'] = self.deleted.to_dict() if hasattr(self, 'href') and self.href is not None: @@ -32582,20 +36373,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupManagerReference object.""" + """Return a `str` version of this InstanceGroupReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupManagerReference') -> bool: + def __eq__(self, other: 'InstanceGroupReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupManagerReference') -> bool: + def __ne__(self, other: 'InstanceGroupReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupManagerReferenceDeleted(): +class InstanceGroupReferenceDeleted(): """ If present, this property indicates the referenced resource has been deleted and provides some supplementary information. @@ -32606,25 +36397,25 @@ class InstanceGroupManagerReferenceDeleted(): def __init__(self, more_info: str) -> None: """ - Initialize a InstanceGroupManagerReferenceDeleted object. + Initialize a InstanceGroupReferenceDeleted object. :param str more_info: Link to documentation about deleted resources. """ self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerReferenceDeleted': - """Initialize a InstanceGroupManagerReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceGroupReferenceDeleted': + """Initialize a InstanceGroupReferenceDeleted object from a json dictionary.""" args = {} if 'more_info' in _dict: args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'more_info\' not present in InstanceGroupManagerReferenceDeleted JSON') + raise ValueError('Required property \'more_info\' not present in InstanceGroupReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupManagerReferenceDeleted object from a json dictionary.""" + """Initialize a InstanceGroupReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -32639,115 +36430,80 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupManagerReferenceDeleted object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'InstanceGroupManagerReferenceDeleted') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'InstanceGroupManagerReferenceDeleted') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - -class InstanceGroupManagerScheduledActionGroup(): - """ - InstanceGroupManagerScheduledActionGroup. - - :attr int membership_count: The desired number of instance group members at the - scheduled time. - """ - - def __init__(self, - membership_count: int) -> None: - """ - Initialize a InstanceGroupManagerScheduledActionGroup object. - - :param int membership_count: The desired number of instance group members - at the scheduled time. - """ - self.membership_count = membership_count - - @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerScheduledActionGroup': - """Initialize a InstanceGroupManagerScheduledActionGroup object from a json dictionary.""" - args = {} - if 'membership_count' in _dict: - args['membership_count'] = _dict.get('membership_count') - else: - raise ValueError('Required property \'membership_count\' not present in InstanceGroupManagerScheduledActionGroup JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a InstanceGroupManagerScheduledActionGroup object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'membership_count') and self.membership_count is not None: - _dict['membership_count'] = self.membership_count - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this InstanceGroupManagerScheduledActionGroup object.""" + """Return a `str` version of this InstanceGroupReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupManagerScheduledActionGroup') -> bool: + def __eq__(self, other: 'InstanceGroupReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupManagerScheduledActionGroup') -> bool: + def __ne__(self, other: 'InstanceGroupReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupManagerScheduledActionGroupPrototype(): +class InstanceInitialization(): """ - InstanceGroupManagerScheduledActionGroupPrototype. + InstanceInitialization. - :attr int membership_count: The desired number of instance group members at the - scheduled time. + :attr InstanceInitializationDefaultTrustedProfile default_trusted_profile: + (optional) The default trusted profile configuration specified at virtual server + instance + creation. If absent, no default trusted profile was specified. + :attr List[KeyReference] keys: The public SSH keys used at instance + initialization. + :attr InstanceInitializationPassword password: (optional) """ def __init__(self, - membership_count: int) -> None: + keys: List['KeyReference'], + *, + default_trusted_profile: 'InstanceInitializationDefaultTrustedProfile' = None, + password: 'InstanceInitializationPassword' = None) -> None: """ - Initialize a InstanceGroupManagerScheduledActionGroupPrototype object. + Initialize a InstanceInitialization object. - :param int membership_count: The desired number of instance group members - at the scheduled time. + :param List[KeyReference] keys: The public SSH keys used at instance + initialization. + :param InstanceInitializationDefaultTrustedProfile default_trusted_profile: + (optional) The default trusted profile configuration specified at virtual + server instance + creation. If absent, no default trusted profile was specified. + :param InstanceInitializationPassword password: (optional) """ - self.membership_count = membership_count + self.default_trusted_profile = default_trusted_profile + self.keys = keys + self.password = password @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupManagerScheduledActionGroupPrototype': - """Initialize a InstanceGroupManagerScheduledActionGroupPrototype object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceInitialization': + """Initialize a InstanceInitialization object from a json dictionary.""" args = {} - if 'membership_count' in _dict: - args['membership_count'] = _dict.get('membership_count') + if 'default_trusted_profile' in _dict: + args['default_trusted_profile'] = InstanceInitializationDefaultTrustedProfile.from_dict(_dict.get('default_trusted_profile')) + if 'keys' in _dict: + args['keys'] = [KeyReference.from_dict(x) for x in _dict.get('keys')] else: - raise ValueError('Required property \'membership_count\' not present in InstanceGroupManagerScheduledActionGroupPrototype JSON') + raise ValueError('Required property \'keys\' not present in InstanceInitialization JSON') + if 'password' in _dict: + args['password'] = InstanceInitializationPassword.from_dict(_dict.get('password')) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupManagerScheduledActionGroupPrototype object from a json dictionary.""" + """Initialize a InstanceInitialization object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'membership_count') and self.membership_count is not None: - _dict['membership_count'] = self.membership_count + if hasattr(self, 'default_trusted_profile') and self.default_trusted_profile is not None: + _dict['default_trusted_profile'] = self.default_trusted_profile.to_dict() + if hasattr(self, 'keys') and self.keys is not None: + _dict['keys'] = [x.to_dict() for x in self.keys] + if hasattr(self, 'password') and self.password is not None: + _dict['password'] = self.password.to_dict() return _dict def _to_dict(self): @@ -32755,192 +36511,73 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupManagerScheduledActionGroupPrototype object.""" + """Return a `str` version of this InstanceInitialization object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupManagerScheduledActionGroupPrototype') -> bool: + def __eq__(self, other: 'InstanceInitialization') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupManagerScheduledActionGroupPrototype') -> bool: + def __ne__(self, other: 'InstanceInitialization') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupManagerScheduledActionManager(): - """ - InstanceGroupManagerScheduledActionManager. - - """ - - def __init__(self) -> None: - """ - Initialize a InstanceGroupManagerScheduledActionManager object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstanceGroupManagerScheduledActionManagerAutoScale'])) - raise Exception(msg) - -class InstanceGroupManagerScheduledActionManagerPrototype(): - """ - InstanceGroupManagerScheduledActionManagerPrototype. - - """ - - def __init__(self) -> None: - """ - Initialize a InstanceGroupManagerScheduledActionManagerPrototype object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype'])) - raise Exception(msg) - -class InstanceGroupMembership(): +class InstanceInitializationDefaultTrustedProfile(): """ - InstanceGroupMembership. + InstanceInitializationDefaultTrustedProfile. - :attr datetime created_at: The date and time that the instance group manager - policy was created. - :attr bool delete_instance_on_membership_delete: If set to true, when deleting - the membership the instance will also be deleted. - :attr str href: The URL for this instance group membership. - :attr str id: The unique identifier for this instance group membership. - :attr InstanceReference instance: - :attr InstanceTemplateReference instance_template: - :attr str name: The user-defined name for this instance group membership. Names - must be unique within the instance group. - :attr LoadBalancerPoolMemberReference pool_member: (optional) - :attr str status: The status of the instance group membership - - `deleting`: Membership is deleting dependent resources - - `failed`: Membership was unable to maintain dependent resources - - `healthy`: Membership is active and serving in the group - - `pending`: Membership is waiting for dependent resources - - `unhealthy`: Membership has unhealthy dependent resources. - :attr datetime updated_at: The date and time that the instance group membership - was updated. + :attr bool auto_link: If set to `true`, the system created a link to the + specified `target` trusted profile during instance creation. Regardless of + whether a link was created by the system or manually using the IAM Identity + service, it will be automatically deleted when the instance is deleted. + :attr TrustedProfileReference target: The default IAM trusted profile to use for + this virtual server instance. """ def __init__(self, - created_at: datetime, - delete_instance_on_membership_delete: bool, - href: str, - id: str, - instance: 'InstanceReference', - instance_template: 'InstanceTemplateReference', - name: str, - status: str, - updated_at: datetime, - *, - pool_member: 'LoadBalancerPoolMemberReference' = None) -> None: + auto_link: bool, + target: 'TrustedProfileReference') -> None: """ - Initialize a InstanceGroupMembership object. + Initialize a InstanceInitializationDefaultTrustedProfile object. - :param datetime created_at: The date and time that the instance group - manager policy was created. - :param bool delete_instance_on_membership_delete: If set to true, when - deleting the membership the instance will also be deleted. - :param str href: The URL for this instance group membership. - :param str id: The unique identifier for this instance group membership. - :param InstanceReference instance: - :param InstanceTemplateReference instance_template: - :param str name: The user-defined name for this instance group membership. - Names must be unique within the instance group. - :param str status: The status of the instance group membership - - `deleting`: Membership is deleting dependent resources - - `failed`: Membership was unable to maintain dependent resources - - `healthy`: Membership is active and serving in the group - - `pending`: Membership is waiting for dependent resources - - `unhealthy`: Membership has unhealthy dependent resources. - :param datetime updated_at: The date and time that the instance group - membership was updated. - :param LoadBalancerPoolMemberReference pool_member: (optional) + :param bool auto_link: If set to `true`, the system created a link to the + specified `target` trusted profile during instance creation. Regardless of + whether a link was created by the system or manually using the IAM Identity + service, it will be automatically deleted when the instance is deleted. + :param TrustedProfileReference target: The default IAM trusted profile to + use for this virtual server instance. """ - self.created_at = created_at - self.delete_instance_on_membership_delete = delete_instance_on_membership_delete - self.href = href - self.id = id - self.instance = instance - self.instance_template = instance_template - self.name = name - self.pool_member = pool_member - self.status = status - self.updated_at = updated_at + self.auto_link = auto_link + self.target = target @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupMembership': - """Initialize a InstanceGroupMembership object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceInitializationDefaultTrustedProfile': + """Initialize a InstanceInitializationDefaultTrustedProfile object from a json dictionary.""" args = {} - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - else: - raise ValueError('Required property \'created_at\' not present in InstanceGroupMembership JSON') - if 'delete_instance_on_membership_delete' in _dict: - args['delete_instance_on_membership_delete'] = _dict.get('delete_instance_on_membership_delete') - else: - raise ValueError('Required property \'delete_instance_on_membership_delete\' not present in InstanceGroupMembership JSON') - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in InstanceGroupMembership JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in InstanceGroupMembership JSON') - if 'instance' in _dict: - args['instance'] = InstanceReference.from_dict(_dict.get('instance')) - else: - raise ValueError('Required property \'instance\' not present in InstanceGroupMembership JSON') - if 'instance_template' in _dict: - args['instance_template'] = InstanceTemplateReference.from_dict(_dict.get('instance_template')) - else: - raise ValueError('Required property \'instance_template\' not present in InstanceGroupMembership JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in InstanceGroupMembership JSON') - if 'pool_member' in _dict: - args['pool_member'] = LoadBalancerPoolMemberReference.from_dict(_dict.get('pool_member')) - if 'status' in _dict: - args['status'] = _dict.get('status') + if 'auto_link' in _dict: + args['auto_link'] = _dict.get('auto_link') else: - raise ValueError('Required property \'status\' not present in InstanceGroupMembership JSON') - if 'updated_at' in _dict: - args['updated_at'] = string_to_datetime(_dict.get('updated_at')) + raise ValueError('Required property \'auto_link\' not present in InstanceInitializationDefaultTrustedProfile JSON') + if 'target' in _dict: + args['target'] = TrustedProfileReference.from_dict(_dict.get('target')) else: - raise ValueError('Required property \'updated_at\' not present in InstanceGroupMembership JSON') + raise ValueError('Required property \'target\' not present in InstanceInitializationDefaultTrustedProfile JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupMembership object from a json dictionary.""" + """Initialize a InstanceInitializationDefaultTrustedProfile object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'delete_instance_on_membership_delete') and self.delete_instance_on_membership_delete is not None: - _dict['delete_instance_on_membership_delete'] = self.delete_instance_on_membership_delete - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'instance') and self.instance is not None: - _dict['instance'] = self.instance.to_dict() - if hasattr(self, 'instance_template') and self.instance_template is not None: - _dict['instance_template'] = self.instance_template.to_dict() - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'pool_member') and self.pool_member is not None: - _dict['pool_member'] = self.pool_member.to_dict() - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status - if hasattr(self, 'updated_at') and self.updated_at is not None: - _dict['updated_at'] = datetime_to_string(self.updated_at) + if hasattr(self, 'auto_link') and self.auto_link is not None: + _dict['auto_link'] = self.auto_link + if hasattr(self, 'target') and self.target is not None: + _dict['target'] = self.target.to_dict() return _dict def _to_dict(self): @@ -32948,120 +36585,70 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupMembership object.""" + """Return a `str` version of this InstanceInitializationDefaultTrustedProfile object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupMembership') -> bool: + def __eq__(self, other: 'InstanceInitializationDefaultTrustedProfile') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupMembership') -> bool: + def __ne__(self, other: 'InstanceInitializationDefaultTrustedProfile') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class StatusEnum(str, Enum): - """ - The status of the instance group membership - - `deleting`: Membership is deleting dependent resources - - `failed`: Membership was unable to maintain dependent resources - - `healthy`: Membership is active and serving in the group - - `pending`: Membership is waiting for dependent resources - - `unhealthy`: Membership has unhealthy dependent resources. - """ - DELETING = 'deleting' - FAILED = 'failed' - HEALTHY = 'healthy' - PENDING = 'pending' - UNHEALTHY = 'unhealthy' - - -class InstanceGroupMembershipCollection(): +class InstanceInitializationPassword(): """ - InstanceGroupMembershipCollection. + InstanceInitializationPassword. - :attr InstanceGroupMembershipCollectionFirst first: A link to the first page of - resources. - :attr int limit: The maximum number of resources that can be returned by the - request. - :attr List[InstanceGroupMembership] memberships: Collection of instance group - memberships. - :attr InstanceGroupMembershipCollectionNext next: (optional) A link to the next - page of resources. This property is present for all pages - except the last page. - :attr int total_count: The total number of resources across all pages. + :attr bytes encrypted_password: The administrator password at initialization, + encrypted using `encryption_key`, and returned base64-encoded. + :attr KeyIdentityByFingerprint encryption_key: The public SSH key used to + encrypt the administrator password. """ def __init__(self, - first: 'InstanceGroupMembershipCollectionFirst', - limit: int, - memberships: List['InstanceGroupMembership'], - total_count: int, - *, - next: 'InstanceGroupMembershipCollectionNext' = None) -> None: + encrypted_password: bytes, + encryption_key: 'KeyIdentityByFingerprint') -> None: """ - Initialize a InstanceGroupMembershipCollection object. + Initialize a InstanceInitializationPassword object. - :param InstanceGroupMembershipCollectionFirst first: A link to the first - page of resources. - :param int limit: The maximum number of resources that can be returned by - the request. - :param List[InstanceGroupMembership] memberships: Collection of instance - group memberships. - :param int total_count: The total number of resources across all pages. - :param InstanceGroupMembershipCollectionNext next: (optional) A link to the - next page of resources. This property is present for all pages - except the last page. + :param bytes encrypted_password: The administrator password at + initialization, encrypted using `encryption_key`, and returned + base64-encoded. + :param KeyIdentityByFingerprint encryption_key: The public SSH key used to + encrypt the administrator password. """ - self.first = first - self.limit = limit - self.memberships = memberships - self.next = next - self.total_count = total_count + self.encrypted_password = encrypted_password + self.encryption_key = encryption_key @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupMembershipCollection': - """Initialize a InstanceGroupMembershipCollection object from a json dictionary.""" - args = {} - if 'first' in _dict: - args['first'] = InstanceGroupMembershipCollectionFirst.from_dict(_dict.get('first')) - else: - raise ValueError('Required property \'first\' not present in InstanceGroupMembershipCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') - else: - raise ValueError('Required property \'limit\' not present in InstanceGroupMembershipCollection JSON') - if 'memberships' in _dict: - args['memberships'] = [InstanceGroupMembership.from_dict(x) for x in _dict.get('memberships')] + def from_dict(cls, _dict: Dict) -> 'InstanceInitializationPassword': + """Initialize a InstanceInitializationPassword object from a json dictionary.""" + args = {} + if 'encrypted_password' in _dict: + args['encrypted_password'] = base64.b64decode(_dict.get('encrypted_password')) else: - raise ValueError('Required property \'memberships\' not present in InstanceGroupMembershipCollection JSON') - if 'next' in _dict: - args['next'] = InstanceGroupMembershipCollectionNext.from_dict(_dict.get('next')) - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') + raise ValueError('Required property \'encrypted_password\' not present in InstanceInitializationPassword JSON') + if 'encryption_key' in _dict: + args['encryption_key'] = KeyIdentityByFingerprint.from_dict(_dict.get('encryption_key')) else: - raise ValueError('Required property \'total_count\' not present in InstanceGroupMembershipCollection JSON') + raise ValueError('Required property \'encryption_key\' not present in InstanceInitializationPassword JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupMembershipCollection object from a json dictionary.""" + """Initialize a InstanceInitializationPassword object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'memberships') and self.memberships is not None: - _dict['memberships'] = [x.to_dict() for x in self.memberships] - if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count + if hasattr(self, 'encrypted_password') and self.encrypted_password is not None: + _dict['encrypted_password'] = str(base64.b64encode(self.encrypted_password), 'utf-8') + if hasattr(self, 'encryption_key') and self.encryption_key is not None: + _dict['encryption_key'] = self.encryption_key.to_dict() return _dict def _to_dict(self): @@ -33069,55 +36656,57 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupMembershipCollection object.""" + """Return a `str` version of this InstanceInitializationPassword object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupMembershipCollection') -> bool: + def __eq__(self, other: 'InstanceInitializationPassword') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupMembershipCollection') -> bool: + def __ne__(self, other: 'InstanceInitializationPassword') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupMembershipCollectionFirst(): +class InstanceMetadataService(): """ - A link to the first page of resources. + The metadata service configuration. - :attr str href: The URL for a page of resources. + :attr bool enabled: Indicates whether the metadata service endpoint is available + to the virtual server instance. """ def __init__(self, - href: str) -> None: + enabled: bool) -> None: """ - Initialize a InstanceGroupMembershipCollectionFirst object. + Initialize a InstanceMetadataService object. - :param str href: The URL for a page of resources. + :param bool enabled: Indicates whether the metadata service endpoint is + available to the virtual server instance. """ - self.href = href + self.enabled = enabled @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupMembershipCollectionFirst': - """Initialize a InstanceGroupMembershipCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceMetadataService': + """Initialize a InstanceMetadataService object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') + if 'enabled' in _dict: + args['enabled'] = _dict.get('enabled') else: - raise ValueError('Required property \'href\' not present in InstanceGroupMembershipCollectionFirst JSON') + raise ValueError('Required property \'enabled\' not present in InstanceMetadataService JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupMembershipCollectionFirst object from a json dictionary.""" + """Initialize a InstanceMetadataService object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'enabled') and self.enabled is not None: + _dict['enabled'] = self.enabled return _dict def _to_dict(self): @@ -33125,56 +36714,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupMembershipCollectionFirst object.""" + """Return a `str` version of this InstanceMetadataService object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupMembershipCollectionFirst') -> bool: + def __eq__(self, other: 'InstanceMetadataService') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupMembershipCollectionFirst') -> bool: + def __ne__(self, other: 'InstanceMetadataService') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupMembershipCollectionNext(): +class InstanceMetadataServicePatch(): """ - A link to the next page of resources. This property is present for all pages except - the last page. + The metadata service configuration. - :attr str href: The URL for a page of resources. + :attr bool enabled: (optional) Indicates whether the metadata service endpoint + will be available to the virtual server instance. """ def __init__(self, - href: str) -> None: + *, + enabled: bool = None) -> None: """ - Initialize a InstanceGroupMembershipCollectionNext object. + Initialize a InstanceMetadataServicePatch object. - :param str href: The URL for a page of resources. + :param bool enabled: (optional) Indicates whether the metadata service + endpoint will be available to the virtual server instance. """ - self.href = href + self.enabled = enabled @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupMembershipCollectionNext': - """Initialize a InstanceGroupMembershipCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceMetadataServicePatch': + """Initialize a InstanceMetadataServicePatch object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in InstanceGroupMembershipCollectionNext JSON') + if 'enabled' in _dict: + args['enabled'] = _dict.get('enabled') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupMembershipCollectionNext object from a json dictionary.""" + """Initialize a InstanceMetadataServicePatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'enabled') and self.enabled is not None: + _dict['enabled'] = self.enabled return _dict def _to_dict(self): @@ -33182,56 +36771,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupMembershipCollectionNext object.""" + """Return a `str` version of this InstanceMetadataServicePatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupMembershipCollectionNext') -> bool: + def __eq__(self, other: 'InstanceMetadataServicePatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupMembershipCollectionNext') -> bool: + def __ne__(self, other: 'InstanceMetadataServicePatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupMembershipPatch(): +class InstanceMetadataServicePrototype(): """ - InstanceGroupMembershipPatch. + The metadata service configuration. - :attr str name: (optional) The user-defined name for this instance group - membership. Names must be unique within the instance group. + :attr bool enabled: (optional) Indicates whether the metadata service endpoint + will be available to the virtual server instance. """ def __init__(self, *, - name: str = None) -> None: + enabled: bool = None) -> None: """ - Initialize a InstanceGroupMembershipPatch object. + Initialize a InstanceMetadataServicePrototype object. - :param str name: (optional) The user-defined name for this instance group - membership. Names must be unique within the instance group. + :param bool enabled: (optional) Indicates whether the metadata service + endpoint will be available to the virtual server instance. """ - self.name = name + self.enabled = enabled @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupMembershipPatch': - """Initialize a InstanceGroupMembershipPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceMetadataServicePrototype': + """Initialize a InstanceMetadataServicePrototype object from a json dictionary.""" args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') + if 'enabled' in _dict: + args['enabled'] = _dict.get('enabled') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupMembershipPatch object from a json dictionary.""" + """Initialize a InstanceMetadataServicePrototype object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name + if hasattr(self, 'enabled') and self.enabled is not None: + _dict['enabled'] = self.enabled return _dict def _to_dict(self): @@ -33239,146 +36828,144 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupMembershipPatch object.""" + """Return a `str` version of this InstanceMetadataServicePrototype object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupMembershipPatch') -> bool: + def __eq__(self, other: 'InstanceMetadataServicePrototype') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupMembershipPatch') -> bool: + def __ne__(self, other: 'InstanceMetadataServicePrototype') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupPatch(): +class InstancePatch(): """ - To add or update load balancer specification for an instance group the - `membership_count` must first be set to 0. + InstancePatch. - :attr int application_port: (optional) Required if specifying a load balancer - pool only. Used by the instance group when scaling up instances to supply the - port for the load balancer pool member. - :attr InstanceTemplateIdentity instance_template: (optional) Instance template - to use when creating new instances. - Instance groups are not compatible with instance templates that specify `true` - for - `default_trusted_profile.auto_link`. - :attr LoadBalancerIdentity load_balancer: (optional) The load balancer that the - load balancer pool used by this group - is in. Required when using a load balancer pool. - :attr LoadBalancerPoolIdentity load_balancer_pool: (optional) If specified, the - load balancer pool will be managed by this - group. Instances created by this group will have a new load - balancer pool member in that pool created. Must be used with - `application_port`. - :attr int membership_count: (optional) The number of instances in the instance - group. - :attr str name: (optional) The user-defined name for this instance group. - :attr List[SubnetIdentity] subnets: (optional) The subnets to use when creating - new instances. + :attr InstanceAvailabilityPolicyPatch availability_policy: (optional) The + availability policy for this virtual server instance. + :attr InstanceMetadataServicePatch metadata_service: (optional) The metadata + service configuration. + :attr str name: (optional) The user-defined name for this virtual server + instance (and default system hostname). + :attr InstancePlacementTargetPatch placement_target: (optional) The placement + restrictions to use for the virtual server instance. For the placement + restrictions to be changed, the instance `status` must be `stopping` or + `stopped`. + :attr InstancePatchProfile profile: (optional) The profile to use for this + virtual server instance. For the profile to be changed, + the instance `status` must be `stopping` or `stopped`. In addition, the + requested + profile must: + - Have matching instance disk support. Any disks associated with the current + profile + will be deleted, and any disks associated with the requested profile will be + created. + - Be compatible with any `placement_target` constraints. For example, if the + instance is placed on a dedicated host, the requested profile `family` must be + the same as the dedicated host `family`. + :attr int total_volume_bandwidth: (optional) The amount of bandwidth (in + megabits per second) allocated exclusively to instance storage volumes. An + increase in this value will result in a corresponding decrease to + `total_network_bandwidth`. """ def __init__(self, *, - application_port: int = None, - instance_template: 'InstanceTemplateIdentity' = None, - load_balancer: 'LoadBalancerIdentity' = None, - load_balancer_pool: 'LoadBalancerPoolIdentity' = None, - membership_count: int = None, + availability_policy: 'InstanceAvailabilityPolicyPatch' = None, + metadata_service: 'InstanceMetadataServicePatch' = None, name: str = None, - subnets: List['SubnetIdentity'] = None) -> None: + placement_target: 'InstancePlacementTargetPatch' = None, + profile: 'InstancePatchProfile' = None, + total_volume_bandwidth: int = None) -> None: """ - Initialize a InstanceGroupPatch object. + Initialize a InstancePatch object. - :param int application_port: (optional) Required if specifying a load - balancer pool only. Used by the instance group when scaling up instances to - supply the port for the load balancer pool member. - :param InstanceTemplateIdentity instance_template: (optional) Instance - template to use when creating new instances. - Instance groups are not compatible with instance templates that specify - `true` for - `default_trusted_profile.auto_link`. - :param LoadBalancerIdentity load_balancer: (optional) The load balancer - that the load balancer pool used by this group - is in. Required when using a load balancer pool. - :param LoadBalancerPoolIdentity load_balancer_pool: (optional) If - specified, the load balancer pool will be managed by this - group. Instances created by this group will have a new load - balancer pool member in that pool created. Must be used with - `application_port`. - :param int membership_count: (optional) The number of instances in the - instance group. - :param str name: (optional) The user-defined name for this instance group. - :param List[SubnetIdentity] subnets: (optional) The subnets to use when - creating new instances. + :param InstanceAvailabilityPolicyPatch availability_policy: (optional) The + availability policy for this virtual server instance. + :param InstanceMetadataServicePatch metadata_service: (optional) The + metadata service configuration. + :param str name: (optional) The user-defined name for this virtual server + instance (and default system hostname). + :param InstancePlacementTargetPatch placement_target: (optional) The + placement restrictions to use for the virtual server instance. For the + placement + restrictions to be changed, the instance `status` must be `stopping` or + `stopped`. + :param InstancePatchProfile profile: (optional) The profile to use for this + virtual server instance. For the profile to be changed, + the instance `status` must be `stopping` or `stopped`. In addition, the + requested + profile must: + - Have matching instance disk support. Any disks associated with the + current profile + will be deleted, and any disks associated with the requested profile will + be + created. + - Be compatible with any `placement_target` constraints. For example, if + the + instance is placed on a dedicated host, the requested profile `family` + must be + the same as the dedicated host `family`. + :param int total_volume_bandwidth: (optional) The amount of bandwidth (in + megabits per second) allocated exclusively to instance storage volumes. An + increase in this value will result in a corresponding decrease to + `total_network_bandwidth`. """ - self.application_port = application_port - self.instance_template = instance_template - self.load_balancer = load_balancer - self.load_balancer_pool = load_balancer_pool - self.membership_count = membership_count + self.availability_policy = availability_policy + self.metadata_service = metadata_service self.name = name - self.subnets = subnets + self.placement_target = placement_target + self.profile = profile + self.total_volume_bandwidth = total_volume_bandwidth @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupPatch': - """Initialize a InstanceGroupPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstancePatch': + """Initialize a InstancePatch object from a json dictionary.""" args = {} - if 'application_port' in _dict: - args['application_port'] = _dict.get('application_port') - if 'instance_template' in _dict: - args['instance_template'] = _dict.get('instance_template') - if 'load_balancer' in _dict: - args['load_balancer'] = _dict.get('load_balancer') - if 'load_balancer_pool' in _dict: - args['load_balancer_pool'] = _dict.get('load_balancer_pool') - if 'membership_count' in _dict: - args['membership_count'] = _dict.get('membership_count') + if 'availability_policy' in _dict: + args['availability_policy'] = InstanceAvailabilityPolicyPatch.from_dict(_dict.get('availability_policy')) + if 'metadata_service' in _dict: + args['metadata_service'] = InstanceMetadataServicePatch.from_dict(_dict.get('metadata_service')) if 'name' in _dict: args['name'] = _dict.get('name') - if 'subnets' in _dict: - args['subnets'] = _dict.get('subnets') + if 'placement_target' in _dict: + args['placement_target'] = _dict.get('placement_target') + if 'profile' in _dict: + args['profile'] = _dict.get('profile') + if 'total_volume_bandwidth' in _dict: + args['total_volume_bandwidth'] = _dict.get('total_volume_bandwidth') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupPatch object from a json dictionary.""" + """Initialize a InstancePatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'application_port') and self.application_port is not None: - _dict['application_port'] = self.application_port - if hasattr(self, 'instance_template') and self.instance_template is not None: - if isinstance(self.instance_template, dict): - _dict['instance_template'] = self.instance_template - else: - _dict['instance_template'] = self.instance_template.to_dict() - if hasattr(self, 'load_balancer') and self.load_balancer is not None: - if isinstance(self.load_balancer, dict): - _dict['load_balancer'] = self.load_balancer - else: - _dict['load_balancer'] = self.load_balancer.to_dict() - if hasattr(self, 'load_balancer_pool') and self.load_balancer_pool is not None: - if isinstance(self.load_balancer_pool, dict): - _dict['load_balancer_pool'] = self.load_balancer_pool - else: - _dict['load_balancer_pool'] = self.load_balancer_pool.to_dict() - if hasattr(self, 'membership_count') and self.membership_count is not None: - _dict['membership_count'] = self.membership_count + if hasattr(self, 'availability_policy') and self.availability_policy is not None: + _dict['availability_policy'] = self.availability_policy.to_dict() + if hasattr(self, 'metadata_service') and self.metadata_service is not None: + _dict['metadata_service'] = self.metadata_service.to_dict() if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'subnets') and self.subnets is not None: - subnets_list = [] - for x in self.subnets: - if isinstance(x, dict): - subnets_list.append(x) - else: - subnets_list.append(x.to_dict()) - _dict['subnets'] = subnets_list + if hasattr(self, 'placement_target') and self.placement_target is not None: + if isinstance(self.placement_target, dict): + _dict['placement_target'] = self.placement_target + else: + _dict['placement_target'] = self.placement_target.to_dict() + if hasattr(self, 'profile') and self.profile is not None: + if isinstance(self.profile, dict): + _dict['profile'] = self.profile + else: + _dict['profile'] = self.profile.to_dict() + if hasattr(self, 'total_volume_bandwidth') and self.total_volume_bandwidth is not None: + _dict['total_volume_bandwidth'] = self.total_volume_bandwidth return _dict def _to_dict(self): @@ -33386,98 +36973,281 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupPatch object.""" + """Return a `str` version of this InstancePatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupPatch') -> bool: + def __eq__(self, other: 'InstancePatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupPatch') -> bool: + def __ne__(self, other: 'InstancePatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupReference(): +class InstancePatchProfile(): """ - InstanceGroupReference. + The profile to use for this virtual server instance. For the profile to be changed, + the instance `status` must be `stopping` or `stopped`. In addition, the requested + profile must: + - Have matching instance disk support. Any disks associated with the current profile + will be deleted, and any disks associated with the requested profile will be + created. + - Be compatible with any `placement_target` constraints. For example, if the + instance is placed on a dedicated host, the requested profile `family` must be + the same as the dedicated host `family`. - :attr str crn: The CRN for this instance group. - :attr InstanceGroupReferenceDeleted deleted: (optional) If present, this - property indicates the referenced resource has been deleted and provides - some supplementary information. - :attr str href: The URL for this instance group. - :attr str id: The unique identifier for this instance group. - :attr str name: The user-defined name for this instance group. + """ + + def __init__(self) -> None: + """ + Initialize a InstancePatchProfile object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['InstancePatchProfileInstanceProfileIdentityByName', 'InstancePatchProfileInstanceProfileIdentityByHref'])) + raise Exception(msg) + +class InstancePlacementTarget(): + """ + InstancePlacementTarget. + + """ + + def __init__(self) -> None: + """ + Initialize a InstancePlacementTarget object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['InstancePlacementTargetDedicatedHostGroupReference', 'InstancePlacementTargetDedicatedHostReference', 'InstancePlacementTargetPlacementGroupReference'])) + raise Exception(msg) + +class InstancePlacementTargetPatch(): + """ + InstancePlacementTargetPatch. + + """ + + def __init__(self) -> None: + """ + Initialize a InstancePlacementTargetPatch object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['InstancePlacementTargetPatchDedicatedHostIdentity', 'InstancePlacementTargetPatchDedicatedHostGroupIdentity'])) + raise Exception(msg) + +class InstancePlacementTargetPrototype(): + """ + InstancePlacementTargetPrototype. + + """ + + def __init__(self) -> None: + """ + Initialize a InstancePlacementTargetPrototype object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['InstancePlacementTargetPrototypeDedicatedHostIdentity', 'InstancePlacementTargetPrototypeDedicatedHostGroupIdentity', 'InstancePlacementTargetPrototypePlacementGroupIdentity'])) + raise Exception(msg) + +class InstanceProfile(): + """ + InstanceProfile. + + :attr InstanceProfileBandwidth bandwidth: + :attr List[InstanceProfileDisk] disks: Collection of the instance profile's + disks. + :attr str family: (optional) The product family this virtual server instance + profile belongs to. + :attr InstanceProfileGPU gpu_count: (optional) + :attr InstanceProfileGPUManufacturer gpu_manufacturer: (optional) + :attr InstanceProfileGPUMemory gpu_memory: (optional) + :attr InstanceProfileGPUModel gpu_model: (optional) + :attr str href: The URL for this virtual server instance profile. + :attr InstanceProfileMemory memory: + :attr str name: The globally unique name for this virtual server instance + profile. + :attr InstanceProfileOSArchitecture os_architecture: + :attr InstanceProfilePortSpeed port_speed: + :attr InstanceProfileVolumeBandwidth total_volume_bandwidth: + :attr InstanceProfileVCPUArchitecture vcpu_architecture: + :attr InstanceProfileVCPU vcpu_count: """ def __init__(self, - crn: str, + bandwidth: 'InstanceProfileBandwidth', + disks: List['InstanceProfileDisk'], href: str, - id: str, + memory: 'InstanceProfileMemory', name: str, + os_architecture: 'InstanceProfileOSArchitecture', + port_speed: 'InstanceProfilePortSpeed', + total_volume_bandwidth: 'InstanceProfileVolumeBandwidth', + vcpu_architecture: 'InstanceProfileVCPUArchitecture', + vcpu_count: 'InstanceProfileVCPU', *, - deleted: 'InstanceGroupReferenceDeleted' = None) -> None: + family: str = None, + gpu_count: 'InstanceProfileGPU' = None, + gpu_manufacturer: 'InstanceProfileGPUManufacturer' = None, + gpu_memory: 'InstanceProfileGPUMemory' = None, + gpu_model: 'InstanceProfileGPUModel' = None) -> None: """ - Initialize a InstanceGroupReference object. + Initialize a InstanceProfile object. - :param str crn: The CRN for this instance group. - :param str href: The URL for this instance group. - :param str id: The unique identifier for this instance group. - :param str name: The user-defined name for this instance group. - :param InstanceGroupReferenceDeleted deleted: (optional) If present, this - property indicates the referenced resource has been deleted and provides - some supplementary information. + :param InstanceProfileBandwidth bandwidth: + :param List[InstanceProfileDisk] disks: Collection of the instance + profile's disks. + :param str href: The URL for this virtual server instance profile. + :param InstanceProfileMemory memory: + :param str name: The globally unique name for this virtual server instance + profile. + :param InstanceProfileOSArchitecture os_architecture: + :param InstanceProfilePortSpeed port_speed: + :param InstanceProfileVolumeBandwidth total_volume_bandwidth: + :param InstanceProfileVCPUArchitecture vcpu_architecture: + :param InstanceProfileVCPU vcpu_count: + :param str family: (optional) The product family this virtual server + instance profile belongs to. + :param InstanceProfileGPU gpu_count: (optional) + :param InstanceProfileGPUManufacturer gpu_manufacturer: (optional) + :param InstanceProfileGPUMemory gpu_memory: (optional) + :param InstanceProfileGPUModel gpu_model: (optional) """ - self.crn = crn - self.deleted = deleted + self.bandwidth = bandwidth + self.disks = disks + self.family = family + self.gpu_count = gpu_count + self.gpu_manufacturer = gpu_manufacturer + self.gpu_memory = gpu_memory + self.gpu_model = gpu_model self.href = href - self.id = id + self.memory = memory self.name = name + self.os_architecture = os_architecture + self.port_speed = port_speed + self.total_volume_bandwidth = total_volume_bandwidth + self.vcpu_architecture = vcpu_architecture + self.vcpu_count = vcpu_count @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupReference': - """Initialize a InstanceGroupReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceProfile': + """Initialize a InstanceProfile object from a json dictionary.""" args = {} - if 'crn' in _dict: - args['crn'] = _dict.get('crn') + if 'bandwidth' in _dict: + args['bandwidth'] = _dict.get('bandwidth') else: - raise ValueError('Required property \'crn\' not present in InstanceGroupReference JSON') - if 'deleted' in _dict: - args['deleted'] = InstanceGroupReferenceDeleted.from_dict(_dict.get('deleted')) + raise ValueError('Required property \'bandwidth\' not present in InstanceProfile JSON') + if 'disks' in _dict: + args['disks'] = [InstanceProfileDisk.from_dict(x) for x in _dict.get('disks')] + else: + raise ValueError('Required property \'disks\' not present in InstanceProfile JSON') + if 'family' in _dict: + args['family'] = _dict.get('family') + if 'gpu_count' in _dict: + args['gpu_count'] = _dict.get('gpu_count') + if 'gpu_manufacturer' in _dict: + args['gpu_manufacturer'] = InstanceProfileGPUManufacturer.from_dict(_dict.get('gpu_manufacturer')) + if 'gpu_memory' in _dict: + args['gpu_memory'] = _dict.get('gpu_memory') + if 'gpu_model' in _dict: + args['gpu_model'] = InstanceProfileGPUModel.from_dict(_dict.get('gpu_model')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in InstanceGroupReference JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') + raise ValueError('Required property \'href\' not present in InstanceProfile JSON') + if 'memory' in _dict: + args['memory'] = _dict.get('memory') else: - raise ValueError('Required property \'id\' not present in InstanceGroupReference JSON') + raise ValueError('Required property \'memory\' not present in InstanceProfile JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in InstanceGroupReference JSON') + raise ValueError('Required property \'name\' not present in InstanceProfile JSON') + if 'os_architecture' in _dict: + args['os_architecture'] = InstanceProfileOSArchitecture.from_dict(_dict.get('os_architecture')) + else: + raise ValueError('Required property \'os_architecture\' not present in InstanceProfile JSON') + if 'port_speed' in _dict: + args['port_speed'] = _dict.get('port_speed') + else: + raise ValueError('Required property \'port_speed\' not present in InstanceProfile JSON') + if 'total_volume_bandwidth' in _dict: + args['total_volume_bandwidth'] = _dict.get('total_volume_bandwidth') + else: + raise ValueError('Required property \'total_volume_bandwidth\' not present in InstanceProfile JSON') + if 'vcpu_architecture' in _dict: + args['vcpu_architecture'] = InstanceProfileVCPUArchitecture.from_dict(_dict.get('vcpu_architecture')) + else: + raise ValueError('Required property \'vcpu_architecture\' not present in InstanceProfile JSON') + if 'vcpu_count' in _dict: + args['vcpu_count'] = _dict.get('vcpu_count') + else: + raise ValueError('Required property \'vcpu_count\' not present in InstanceProfile JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceGroupReference object from a json dictionary.""" + """Initialize a InstanceProfile object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() + if hasattr(self, 'bandwidth') and self.bandwidth is not None: + if isinstance(self.bandwidth, dict): + _dict['bandwidth'] = self.bandwidth + else: + _dict['bandwidth'] = self.bandwidth.to_dict() + if hasattr(self, 'disks') and self.disks is not None: + _dict['disks'] = [x.to_dict() for x in self.disks] + if hasattr(self, 'family') and self.family is not None: + _dict['family'] = self.family + if hasattr(self, 'gpu_count') and self.gpu_count is not None: + if isinstance(self.gpu_count, dict): + _dict['gpu_count'] = self.gpu_count + else: + _dict['gpu_count'] = self.gpu_count.to_dict() + if hasattr(self, 'gpu_manufacturer') and self.gpu_manufacturer is not None: + _dict['gpu_manufacturer'] = self.gpu_manufacturer.to_dict() + if hasattr(self, 'gpu_memory') and self.gpu_memory is not None: + if isinstance(self.gpu_memory, dict): + _dict['gpu_memory'] = self.gpu_memory + else: + _dict['gpu_memory'] = self.gpu_memory.to_dict() + if hasattr(self, 'gpu_model') and self.gpu_model is not None: + _dict['gpu_model'] = self.gpu_model.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id + if hasattr(self, 'memory') and self.memory is not None: + if isinstance(self.memory, dict): + _dict['memory'] = self.memory + else: + _dict['memory'] = self.memory.to_dict() if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name + if hasattr(self, 'os_architecture') and self.os_architecture is not None: + _dict['os_architecture'] = self.os_architecture.to_dict() + if hasattr(self, 'port_speed') and self.port_speed is not None: + if isinstance(self.port_speed, dict): + _dict['port_speed'] = self.port_speed + else: + _dict['port_speed'] = self.port_speed.to_dict() + if hasattr(self, 'total_volume_bandwidth') and self.total_volume_bandwidth is not None: + if isinstance(self.total_volume_bandwidth, dict): + _dict['total_volume_bandwidth'] = self.total_volume_bandwidth + else: + _dict['total_volume_bandwidth'] = self.total_volume_bandwidth.to_dict() + if hasattr(self, 'vcpu_architecture') and self.vcpu_architecture is not None: + _dict['vcpu_architecture'] = self.vcpu_architecture.to_dict() + if hasattr(self, 'vcpu_count') and self.vcpu_count is not None: + if isinstance(self.vcpu_count, dict): + _dict['vcpu_count'] = self.vcpu_count + else: + _dict['vcpu_count'] = self.vcpu_count.to_dict() return _dict def _to_dict(self): @@ -33485,137 +37255,72 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceGroupReference object.""" + """Return a `str` version of this InstanceProfile object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceGroupReference') -> bool: + def __eq__(self, other: 'InstanceProfile') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceGroupReference') -> bool: + def __ne__(self, other: 'InstanceProfile') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceGroupReferenceDeleted(): +class InstanceProfileBandwidth(): """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. + InstanceProfileBandwidth. - :attr str more_info: Link to documentation about deleted resources. """ - def __init__(self, - more_info: str) -> None: + def __init__(self) -> None: """ - Initialize a InstanceGroupReferenceDeleted object. + Initialize a InstanceProfileBandwidth object. - :param str more_info: Link to documentation about deleted resources. """ - self.more_info = more_info - - @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceGroupReferenceDeleted': - """Initialize a InstanceGroupReferenceDeleted object from a json dictionary.""" - args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') - else: - raise ValueError('Required property \'more_info\' not present in InstanceGroupReferenceDeleted JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a InstanceGroupReferenceDeleted object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this InstanceGroupReferenceDeleted object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'InstanceGroupReferenceDeleted') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'InstanceGroupReferenceDeleted') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['InstanceProfileBandwidthFixed', 'InstanceProfileBandwidthRange', 'InstanceProfileBandwidthEnum', 'InstanceProfileBandwidthDependent'])) + raise Exception(msg) -class InstanceInitialization(): +class InstanceProfileCollection(): """ - InstanceInitialization. + InstanceProfileCollection. - :attr InstanceInitializationDefaultTrustedProfile default_trusted_profile: - (optional) The default trusted profile configuration specified at virtual server - instance - creation. If absent, no default trusted profile was specified. - :attr List[KeyReference] keys: The public SSH keys used at instance - initialization. - :attr InstanceInitializationPassword password: (optional) + :attr List[InstanceProfile] profiles: Collection of virtual server instance + profiles. """ def __init__(self, - keys: List['KeyReference'], - *, - default_trusted_profile: 'InstanceInitializationDefaultTrustedProfile' = None, - password: 'InstanceInitializationPassword' = None) -> None: + profiles: List['InstanceProfile']) -> None: """ - Initialize a InstanceInitialization object. + Initialize a InstanceProfileCollection object. - :param List[KeyReference] keys: The public SSH keys used at instance - initialization. - :param InstanceInitializationDefaultTrustedProfile default_trusted_profile: - (optional) The default trusted profile configuration specified at virtual - server instance - creation. If absent, no default trusted profile was specified. - :param InstanceInitializationPassword password: (optional) + :param List[InstanceProfile] profiles: Collection of virtual server + instance profiles. """ - self.default_trusted_profile = default_trusted_profile - self.keys = keys - self.password = password + self.profiles = profiles @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceInitialization': - """Initialize a InstanceInitialization object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceProfileCollection': + """Initialize a InstanceProfileCollection object from a json dictionary.""" args = {} - if 'default_trusted_profile' in _dict: - args['default_trusted_profile'] = InstanceInitializationDefaultTrustedProfile.from_dict(_dict.get('default_trusted_profile')) - if 'keys' in _dict: - args['keys'] = [KeyReference.from_dict(x) for x in _dict.get('keys')] + if 'profiles' in _dict: + args['profiles'] = [InstanceProfile.from_dict(x) for x in _dict.get('profiles')] else: - raise ValueError('Required property \'keys\' not present in InstanceInitialization JSON') - if 'password' in _dict: - args['password'] = InstanceInitializationPassword.from_dict(_dict.get('password')) + raise ValueError('Required property \'profiles\' not present in InstanceProfileCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceInitialization object from a json dictionary.""" + """Initialize a InstanceProfileCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'default_trusted_profile') and self.default_trusted_profile is not None: - _dict['default_trusted_profile'] = self.default_trusted_profile.to_dict() - if hasattr(self, 'keys') and self.keys is not None: - _dict['keys'] = [x.to_dict() for x in self.keys] - if hasattr(self, 'password') and self.password is not None: - _dict['password'] = self.password.to_dict() + if hasattr(self, 'profiles') and self.profiles is not None: + _dict['profiles'] = [x.to_dict() for x in self.profiles] return _dict def _to_dict(self): @@ -33623,73 +37328,81 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceInitialization object.""" + """Return a `str` version of this InstanceProfileCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceInitialization') -> bool: + def __eq__(self, other: 'InstanceProfileCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceInitialization') -> bool: + def __ne__(self, other: 'InstanceProfileCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceInitializationDefaultTrustedProfile(): +class InstanceProfileDisk(): """ - InstanceInitializationDefaultTrustedProfile. + Disks provided by this profile. - :attr bool auto_link: If set to `true`, the system created a link to the - specified `target` trusted profile during instance creation. Regardless of - whether a link was created by the system or manually using the IAM Identity - service, it will be automatically deleted when the instance is deleted. - :attr TrustedProfileReference target: The default IAM trusted profile to use for - this virtual server instance. + :attr InstanceProfileDiskQuantity quantity: + :attr InstanceProfileDiskSize size: + :attr InstanceProfileDiskSupportedInterfaces supported_interface_types: """ def __init__(self, - auto_link: bool, - target: 'TrustedProfileReference') -> None: + quantity: 'InstanceProfileDiskQuantity', + size: 'InstanceProfileDiskSize', + supported_interface_types: 'InstanceProfileDiskSupportedInterfaces') -> None: """ - Initialize a InstanceInitializationDefaultTrustedProfile object. + Initialize a InstanceProfileDisk object. - :param bool auto_link: If set to `true`, the system created a link to the - specified `target` trusted profile during instance creation. Regardless of - whether a link was created by the system or manually using the IAM Identity - service, it will be automatically deleted when the instance is deleted. - :param TrustedProfileReference target: The default IAM trusted profile to - use for this virtual server instance. + :param InstanceProfileDiskQuantity quantity: + :param InstanceProfileDiskSize size: + :param InstanceProfileDiskSupportedInterfaces supported_interface_types: """ - self.auto_link = auto_link - self.target = target + self.quantity = quantity + self.size = size + self.supported_interface_types = supported_interface_types @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceInitializationDefaultTrustedProfile': - """Initialize a InstanceInitializationDefaultTrustedProfile object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceProfileDisk': + """Initialize a InstanceProfileDisk object from a json dictionary.""" args = {} - if 'auto_link' in _dict: - args['auto_link'] = _dict.get('auto_link') + if 'quantity' in _dict: + args['quantity'] = _dict.get('quantity') else: - raise ValueError('Required property \'auto_link\' not present in InstanceInitializationDefaultTrustedProfile JSON') - if 'target' in _dict: - args['target'] = TrustedProfileReference.from_dict(_dict.get('target')) + raise ValueError('Required property \'quantity\' not present in InstanceProfileDisk JSON') + if 'size' in _dict: + args['size'] = _dict.get('size') else: - raise ValueError('Required property \'target\' not present in InstanceInitializationDefaultTrustedProfile JSON') + raise ValueError('Required property \'size\' not present in InstanceProfileDisk JSON') + if 'supported_interface_types' in _dict: + args['supported_interface_types'] = InstanceProfileDiskSupportedInterfaces.from_dict(_dict.get('supported_interface_types')) + else: + raise ValueError('Required property \'supported_interface_types\' not present in InstanceProfileDisk JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceInitializationDefaultTrustedProfile object from a json dictionary.""" + """Initialize a InstanceProfileDisk object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'auto_link') and self.auto_link is not None: - _dict['auto_link'] = self.auto_link - if hasattr(self, 'target') and self.target is not None: - _dict['target'] = self.target.to_dict() + if hasattr(self, 'quantity') and self.quantity is not None: + if isinstance(self.quantity, dict): + _dict['quantity'] = self.quantity + else: + _dict['quantity'] = self.quantity.to_dict() + if hasattr(self, 'size') and self.size is not None: + if isinstance(self.size, dict): + _dict['size'] = self.size + else: + _dict['size'] = self.size.to_dict() + if hasattr(self, 'supported_interface_types') and self.supported_interface_types is not None: + _dict['supported_interface_types'] = self.supported_interface_types.to_dict() return _dict def _to_dict(self): @@ -33697,128 +37410,115 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceInitializationDefaultTrustedProfile object.""" + """Return a `str` version of this InstanceProfileDisk object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceInitializationDefaultTrustedProfile') -> bool: + def __eq__(self, other: 'InstanceProfileDisk') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceInitializationDefaultTrustedProfile') -> bool: + def __ne__(self, other: 'InstanceProfileDisk') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceInitializationPassword(): +class InstanceProfileDiskQuantity(): """ - InstanceInitializationPassword. + InstanceProfileDiskQuantity. - :attr bytes encrypted_password: The administrator password at initialization, - encrypted using `encryption_key`, and returned base64-encoded. - :attr KeyIdentityByFingerprint encryption_key: The public SSH key used to - encrypt the administrator password. """ - def __init__(self, - encrypted_password: bytes, - encryption_key: 'KeyIdentityByFingerprint') -> None: + def __init__(self) -> None: """ - Initialize a InstanceInitializationPassword object. + Initialize a InstanceProfileDiskQuantity object. - :param bytes encrypted_password: The administrator password at - initialization, encrypted using `encryption_key`, and returned - base64-encoded. - :param KeyIdentityByFingerprint encryption_key: The public SSH key used to - encrypt the administrator password. """ - self.encrypted_password = encrypted_password - self.encryption_key = encryption_key - - @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceInitializationPassword': - """Initialize a InstanceInitializationPassword object from a json dictionary.""" - args = {} - if 'encrypted_password' in _dict: - args['encrypted_password'] = base64.b64decode(_dict.get('encrypted_password')) - else: - raise ValueError('Required property \'encrypted_password\' not present in InstanceInitializationPassword JSON') - if 'encryption_key' in _dict: - args['encryption_key'] = KeyIdentityByFingerprint.from_dict(_dict.get('encryption_key')) - else: - raise ValueError('Required property \'encryption_key\' not present in InstanceInitializationPassword JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a InstanceInitializationPassword object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'encrypted_password') and self.encrypted_password is not None: - _dict['encrypted_password'] = str(base64.b64encode(self.encrypted_password), 'utf-8') - if hasattr(self, 'encryption_key') and self.encryption_key is not None: - _dict['encryption_key'] = self.encryption_key.to_dict() - return _dict + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['InstanceProfileDiskQuantityFixed', 'InstanceProfileDiskQuantityRange', 'InstanceProfileDiskQuantityEnum', 'InstanceProfileDiskQuantityDependent'])) + raise Exception(msg) - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() +class InstanceProfileDiskSize(): + """ + InstanceProfileDiskSize. - def __str__(self) -> str: - """Return a `str` version of this InstanceInitializationPassword object.""" - return json.dumps(self.to_dict(), indent=2) + """ - def __eq__(self, other: 'InstanceInitializationPassword') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ + def __init__(self) -> None: + """ + Initialize a InstanceProfileDiskSize object. - def __ne__(self, other: 'InstanceInitializationPassword') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['InstanceProfileDiskSizeFixed', 'InstanceProfileDiskSizeRange', 'InstanceProfileDiskSizeEnum', 'InstanceProfileDiskSizeDependent'])) + raise Exception(msg) -class InstanceMetadataService(): +class InstanceProfileDiskSupportedInterfaces(): """ - The metadata service configuration. + InstanceProfileDiskSupportedInterfaces. - :attr bool enabled: Indicates whether the metadata service endpoint is available - to the virtual server instance. + :attr str default: The disk interface used for attaching the disk. + The enumerated values for this property are expected to expand in the future. + When processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the resource on which the unexpected + property value was encountered. + :attr str type: The type for this profile field. + :attr List[str] values: The supported disk interfaces used for attaching the + disk. """ def __init__(self, - enabled: bool) -> None: + default: str, + type: str, + values: List[str]) -> None: """ - Initialize a InstanceMetadataService object. + Initialize a InstanceProfileDiskSupportedInterfaces object. - :param bool enabled: Indicates whether the metadata service endpoint is - available to the virtual server instance. + :param str default: The disk interface used for attaching the disk. + The enumerated values for this property are expected to expand in the + future. When processing this property, check for and log unknown values. + Optionally halt processing and surface the error, or bypass the resource on + which the unexpected property value was encountered. + :param str type: The type for this profile field. + :param List[str] values: The supported disk interfaces used for attaching + the disk. """ - self.enabled = enabled + self.default = default + self.type = type + self.values = values @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceMetadataService': - """Initialize a InstanceMetadataService object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceProfileDiskSupportedInterfaces': + """Initialize a InstanceProfileDiskSupportedInterfaces object from a json dictionary.""" args = {} - if 'enabled' in _dict: - args['enabled'] = _dict.get('enabled') + if 'default' in _dict: + args['default'] = _dict.get('default') else: - raise ValueError('Required property \'enabled\' not present in InstanceMetadataService JSON') + raise ValueError('Required property \'default\' not present in InstanceProfileDiskSupportedInterfaces JSON') + if 'type' in _dict: + args['type'] = _dict.get('type') + else: + raise ValueError('Required property \'type\' not present in InstanceProfileDiskSupportedInterfaces JSON') + if 'values' in _dict: + args['values'] = _dict.get('values') + else: + raise ValueError('Required property \'values\' not present in InstanceProfileDiskSupportedInterfaces JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceMetadataService object from a json dictionary.""" + """Initialize a InstanceProfileDiskSupportedInterfaces object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'enabled') and self.enabled is not None: - _dict['enabled'] = self.enabled + if hasattr(self, 'default') and self.default is not None: + _dict['default'] = self.default + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'values') and self.values is not None: + _dict['values'] = self.values return _dict def _to_dict(self): @@ -33826,113 +37526,113 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceMetadataService object.""" + """Return a `str` version of this InstanceProfileDiskSupportedInterfaces object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceMetadataService') -> bool: + def __eq__(self, other: 'InstanceProfileDiskSupportedInterfaces') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceMetadataService') -> bool: + def __ne__(self, other: 'InstanceProfileDiskSupportedInterfaces') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceMetadataServicePatch(): - """ - The metadata service configuration. + class DefaultEnum(str, Enum): + """ + The disk interface used for attaching the disk. + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the resource on which the unexpected + property value was encountered. + """ + NVME = 'nvme' + VIRTIO_BLK = 'virtio_blk' - :attr bool enabled: (optional) Indicates whether the metadata service endpoint - will be available to the virtual server instance. - """ - def __init__(self, - *, - enabled: bool = None) -> None: + class TypeEnum(str, Enum): """ - Initialize a InstanceMetadataServicePatch object. - - :param bool enabled: (optional) Indicates whether the metadata service - endpoint will be available to the virtual server instance. + The type for this profile field. """ - self.enabled = enabled + ENUM = 'enum' - @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceMetadataServicePatch': - """Initialize a InstanceMetadataServicePatch object from a json dictionary.""" - args = {} - if 'enabled' in _dict: - args['enabled'] = _dict.get('enabled') - return cls(**args) - @classmethod - def _from_dict(cls, _dict): - """Initialize a InstanceMetadataServicePatch object from a json dictionary.""" - return cls.from_dict(_dict) + class ValuesEnum(str, Enum): + """ + The disk interface used for attaching the disk. + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the resource on which the unexpected + property value was encountered. + """ + NVME = 'nvme' + VIRTIO_BLK = 'virtio_blk' - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'enabled') and self.enabled is not None: - _dict['enabled'] = self.enabled - return _dict - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() +class InstanceProfileGPU(): + """ + InstanceProfileGPU. - def __str__(self) -> str: - """Return a `str` version of this InstanceMetadataServicePatch object.""" - return json.dumps(self.to_dict(), indent=2) + """ - def __eq__(self, other: 'InstanceMetadataServicePatch') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ + def __init__(self) -> None: + """ + Initialize a InstanceProfileGPU object. - def __ne__(self, other: 'InstanceMetadataServicePatch') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['InstanceProfileGPUFixed', 'InstanceProfileGPURange', 'InstanceProfileGPUEnum', 'InstanceProfileGPUDependent'])) + raise Exception(msg) -class InstanceMetadataServicePrototype(): +class InstanceProfileGPUManufacturer(): """ - The metadata service configuration. + InstanceProfileGPUManufacturer. - :attr bool enabled: (optional) Indicates whether the metadata service endpoint - will be available to the virtual server instance. + :attr str type: The type for this profile field. + :attr List[str] values: The possible GPU manufacturer(s) for an instance with + this profile. """ def __init__(self, - *, - enabled: bool = None) -> None: + type: str, + values: List[str]) -> None: """ - Initialize a InstanceMetadataServicePrototype object. + Initialize a InstanceProfileGPUManufacturer object. - :param bool enabled: (optional) Indicates whether the metadata service - endpoint will be available to the virtual server instance. + :param str type: The type for this profile field. + :param List[str] values: The possible GPU manufacturer(s) for an instance + with this profile. """ - self.enabled = enabled + self.type = type + self.values = values @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceMetadataServicePrototype': - """Initialize a InstanceMetadataServicePrototype object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceProfileGPUManufacturer': + """Initialize a InstanceProfileGPUManufacturer object from a json dictionary.""" args = {} - if 'enabled' in _dict: - args['enabled'] = _dict.get('enabled') + if 'type' in _dict: + args['type'] = _dict.get('type') + else: + raise ValueError('Required property \'type\' not present in InstanceProfileGPUManufacturer JSON') + if 'values' in _dict: + args['values'] = _dict.get('values') + else: + raise ValueError('Required property \'values\' not present in InstanceProfileGPUManufacturer JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceMetadataServicePrototype object from a json dictionary.""" + """Initialize a InstanceProfileGPUManufacturer object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'enabled') and self.enabled is not None: - _dict['enabled'] = self.enabled + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'values') and self.values is not None: + _dict['values'] = self.values return _dict def _to_dict(self): @@ -33940,144 +37640,89 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceMetadataServicePrototype object.""" + """Return a `str` version of this InstanceProfileGPUManufacturer object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceMetadataServicePrototype') -> bool: + def __eq__(self, other: 'InstanceProfileGPUManufacturer') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceMetadataServicePrototype') -> bool: + def __ne__(self, other: 'InstanceProfileGPUManufacturer') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstancePatch(): + class TypeEnum(str, Enum): + """ + The type for this profile field. + """ + ENUM = 'enum' + + +class InstanceProfileGPUMemory(): """ - InstancePatch. + InstanceProfileGPUMemory. - :attr InstanceAvailabilityPolicyPatch availability_policy: (optional) The - availability policy for this virtual server instance. - :attr InstanceMetadataServicePatch metadata_service: (optional) The metadata - service configuration. - :attr str name: (optional) The user-defined name for this virtual server - instance (and default system hostname). - :attr InstancePlacementTargetPatch placement_target: (optional) The placement - restrictions to use for the virtual server instance. For the placement - restrictions to be changed, the instance `status` must be `stopping` or - `stopped`. - :attr InstancePatchProfile profile: (optional) The profile to use for this - virtual server instance. For the profile to be changed, - the instance `status` must be `stopping` or `stopped`. In addition, the - requested - profile must: - - Have matching instance disk support. Any disks associated with the current - profile - will be deleted, and any disks associated with the requested profile will be - created. - - Be compatible with any `placement_target` constraints. For example, if the - instance is placed on a dedicated host, the requested profile `family` must be - the same as the dedicated host `family`. - :attr int total_volume_bandwidth: (optional) The amount of bandwidth (in - megabits per second) allocated exclusively to instance storage volumes. An - increase in this value will result in a corresponding decrease to - `total_network_bandwidth`. + """ + + def __init__(self) -> None: + """ + Initialize a InstanceProfileGPUMemory object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['InstanceProfileGPUMemoryFixed', 'InstanceProfileGPUMemoryRange', 'InstanceProfileGPUMemoryEnum', 'InstanceProfileGPUMemoryDependent'])) + raise Exception(msg) + +class InstanceProfileGPUModel(): + """ + InstanceProfileGPUModel. + + :attr str type: The type for this profile field. + :attr List[str] values: The possible GPU model(s) for an instance with this + profile. """ def __init__(self, - *, - availability_policy: 'InstanceAvailabilityPolicyPatch' = None, - metadata_service: 'InstanceMetadataServicePatch' = None, - name: str = None, - placement_target: 'InstancePlacementTargetPatch' = None, - profile: 'InstancePatchProfile' = None, - total_volume_bandwidth: int = None) -> None: + type: str, + values: List[str]) -> None: """ - Initialize a InstancePatch object. + Initialize a InstanceProfileGPUModel object. - :param InstanceAvailabilityPolicyPatch availability_policy: (optional) The - availability policy for this virtual server instance. - :param InstanceMetadataServicePatch metadata_service: (optional) The - metadata service configuration. - :param str name: (optional) The user-defined name for this virtual server - instance (and default system hostname). - :param InstancePlacementTargetPatch placement_target: (optional) The - placement restrictions to use for the virtual server instance. For the - placement - restrictions to be changed, the instance `status` must be `stopping` or - `stopped`. - :param InstancePatchProfile profile: (optional) The profile to use for this - virtual server instance. For the profile to be changed, - the instance `status` must be `stopping` or `stopped`. In addition, the - requested - profile must: - - Have matching instance disk support. Any disks associated with the - current profile - will be deleted, and any disks associated with the requested profile will - be - created. - - Be compatible with any `placement_target` constraints. For example, if - the - instance is placed on a dedicated host, the requested profile `family` - must be - the same as the dedicated host `family`. - :param int total_volume_bandwidth: (optional) The amount of bandwidth (in - megabits per second) allocated exclusively to instance storage volumes. An - increase in this value will result in a corresponding decrease to - `total_network_bandwidth`. + :param str type: The type for this profile field. + :param List[str] values: The possible GPU model(s) for an instance with + this profile. """ - self.availability_policy = availability_policy - self.metadata_service = metadata_service - self.name = name - self.placement_target = placement_target - self.profile = profile - self.total_volume_bandwidth = total_volume_bandwidth + self.type = type + self.values = values @classmethod - def from_dict(cls, _dict: Dict) -> 'InstancePatch': - """Initialize a InstancePatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceProfileGPUModel': + """Initialize a InstanceProfileGPUModel object from a json dictionary.""" args = {} - if 'availability_policy' in _dict: - args['availability_policy'] = InstanceAvailabilityPolicyPatch.from_dict(_dict.get('availability_policy')) - if 'metadata_service' in _dict: - args['metadata_service'] = InstanceMetadataServicePatch.from_dict(_dict.get('metadata_service')) - if 'name' in _dict: - args['name'] = _dict.get('name') - if 'placement_target' in _dict: - args['placement_target'] = _dict.get('placement_target') - if 'profile' in _dict: - args['profile'] = _dict.get('profile') - if 'total_volume_bandwidth' in _dict: - args['total_volume_bandwidth'] = _dict.get('total_volume_bandwidth') + if 'type' in _dict: + args['type'] = _dict.get('type') + else: + raise ValueError('Required property \'type\' not present in InstanceProfileGPUModel JSON') + if 'values' in _dict: + args['values'] = _dict.get('values') + else: + raise ValueError('Required property \'values\' not present in InstanceProfileGPUModel JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstancePatch object from a json dictionary.""" + """Initialize a InstanceProfileGPUModel object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'availability_policy') and self.availability_policy is not None: - _dict['availability_policy'] = self.availability_policy.to_dict() - if hasattr(self, 'metadata_service') and self.metadata_service is not None: - _dict['metadata_service'] = self.metadata_service.to_dict() - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'placement_target') and self.placement_target is not None: - if isinstance(self.placement_target, dict): - _dict['placement_target'] = self.placement_target - else: - _dict['placement_target'] = self.placement_target.to_dict() - if hasattr(self, 'profile') and self.profile is not None: - if isinstance(self.profile, dict): - _dict['profile'] = self.profile - else: - _dict['profile'] = self.profile.to_dict() - if hasattr(self, 'total_volume_bandwidth') and self.total_volume_bandwidth is not None: - _dict['total_volume_bandwidth'] = self.total_volume_bandwidth + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'values') and self.values is not None: + _dict['values'] = self.values return _dict def _to_dict(self): @@ -34085,281 +37730,116 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstancePatch object.""" + """Return a `str` version of this InstanceProfileGPUModel object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstancePatch') -> bool: + def __eq__(self, other: 'InstanceProfileGPUModel') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstancePatch') -> bool: + def __ne__(self, other: 'InstanceProfileGPUModel') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstancePatchProfile(): - """ - The profile to use for this virtual server instance. For the profile to be changed, - the instance `status` must be `stopping` or `stopped`. In addition, the requested - profile must: - - Have matching instance disk support. Any disks associated with the current profile - will be deleted, and any disks associated with the requested profile will be - created. - - Be compatible with any `placement_target` constraints. For example, if the - instance is placed on a dedicated host, the requested profile `family` must be - the same as the dedicated host `family`. - - """ - - def __init__(self) -> None: - """ - Initialize a InstancePatchProfile object. - + class TypeEnum(str, Enum): """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstancePatchProfileInstanceProfileIdentityByName', 'InstancePatchProfileInstanceProfileIdentityByHref'])) - raise Exception(msg) - -class InstancePlacementTarget(): - """ - InstancePlacementTarget. - - """ - - def __init__(self) -> None: + The type for this profile field. """ - Initialize a InstancePlacementTarget object. + ENUM = 'enum' - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstancePlacementTargetDedicatedHostGroupReference', 'InstancePlacementTargetDedicatedHostReference', 'InstancePlacementTargetPlacementGroupReference'])) - raise Exception(msg) -class InstancePlacementTargetPatch(): +class InstanceProfileIdentity(): """ - InstancePlacementTargetPatch. + Identifies an instance profile by a unique property. """ def __init__(self) -> None: """ - Initialize a InstancePlacementTargetPatch object. + Initialize a InstanceProfileIdentity object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstancePlacementTargetPatchDedicatedHostIdentity', 'InstancePlacementTargetPatchDedicatedHostGroupIdentity'])) + ", ".join(['InstanceProfileIdentityByName', 'InstanceProfileIdentityByHref'])) raise Exception(msg) -class InstancePlacementTargetPrototype(): +class InstanceProfileMemory(): """ - InstancePlacementTargetPrototype. + InstanceProfileMemory. """ def __init__(self) -> None: """ - Initialize a InstancePlacementTargetPrototype object. + Initialize a InstanceProfileMemory object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstancePlacementTargetPrototypeDedicatedHostIdentity', 'InstancePlacementTargetPrototypeDedicatedHostGroupIdentity', 'InstancePlacementTargetPrototypePlacementGroupIdentity'])) + ", ".join(['InstanceProfileMemoryFixed', 'InstanceProfileMemoryRange', 'InstanceProfileMemoryEnum', 'InstanceProfileMemoryDependent'])) raise Exception(msg) -class InstanceProfile(): +class InstanceProfileOSArchitecture(): """ - InstanceProfile. + InstanceProfileOSArchitecture. - :attr InstanceProfileBandwidth bandwidth: - :attr List[InstanceProfileDisk] disks: Collection of the instance profile's - disks. - :attr str family: (optional) The product family this virtual server instance - profile belongs to. - :attr InstanceProfileGPU gpu_count: (optional) - :attr InstanceProfileGPUManufacturer gpu_manufacturer: (optional) - :attr InstanceProfileGPUMemory gpu_memory: (optional) - :attr InstanceProfileGPUModel gpu_model: (optional) - :attr str href: The URL for this virtual server instance profile. - :attr InstanceProfileMemory memory: - :attr str name: The globally unique name for this virtual server instance + :attr str default: The default OS architecture for an instance with this profile. - :attr InstanceProfileOSArchitecture os_architecture: - :attr InstanceProfilePortSpeed port_speed: - :attr InstanceProfileVolumeBandwidth total_volume_bandwidth: - :attr InstanceProfileVCPUArchitecture vcpu_architecture: - :attr InstanceProfileVCPU vcpu_count: + :attr str type: The type for this profile field. + :attr List[str] values: The supported OS architecture(s) for an instance with + this profile. """ def __init__(self, - bandwidth: 'InstanceProfileBandwidth', - disks: List['InstanceProfileDisk'], - href: str, - memory: 'InstanceProfileMemory', - name: str, - os_architecture: 'InstanceProfileOSArchitecture', - port_speed: 'InstanceProfilePortSpeed', - total_volume_bandwidth: 'InstanceProfileVolumeBandwidth', - vcpu_architecture: 'InstanceProfileVCPUArchitecture', - vcpu_count: 'InstanceProfileVCPU', - *, - family: str = None, - gpu_count: 'InstanceProfileGPU' = None, - gpu_manufacturer: 'InstanceProfileGPUManufacturer' = None, - gpu_memory: 'InstanceProfileGPUMemory' = None, - gpu_model: 'InstanceProfileGPUModel' = None) -> None: + default: str, + type: str, + values: List[str]) -> None: """ - Initialize a InstanceProfile object. + Initialize a InstanceProfileOSArchitecture object. - :param InstanceProfileBandwidth bandwidth: - :param List[InstanceProfileDisk] disks: Collection of the instance - profile's disks. - :param str href: The URL for this virtual server instance profile. - :param InstanceProfileMemory memory: - :param str name: The globally unique name for this virtual server instance + :param str default: The default OS architecture for an instance with this profile. - :param InstanceProfileOSArchitecture os_architecture: - :param InstanceProfilePortSpeed port_speed: - :param InstanceProfileVolumeBandwidth total_volume_bandwidth: - :param InstanceProfileVCPUArchitecture vcpu_architecture: - :param InstanceProfileVCPU vcpu_count: - :param str family: (optional) The product family this virtual server - instance profile belongs to. - :param InstanceProfileGPU gpu_count: (optional) - :param InstanceProfileGPUManufacturer gpu_manufacturer: (optional) - :param InstanceProfileGPUMemory gpu_memory: (optional) - :param InstanceProfileGPUModel gpu_model: (optional) + :param str type: The type for this profile field. + :param List[str] values: The supported OS architecture(s) for an instance + with this profile. """ - self.bandwidth = bandwidth - self.disks = disks - self.family = family - self.gpu_count = gpu_count - self.gpu_manufacturer = gpu_manufacturer - self.gpu_memory = gpu_memory - self.gpu_model = gpu_model - self.href = href - self.memory = memory - self.name = name - self.os_architecture = os_architecture - self.port_speed = port_speed - self.total_volume_bandwidth = total_volume_bandwidth - self.vcpu_architecture = vcpu_architecture - self.vcpu_count = vcpu_count + self.default = default + self.type = type + self.values = values @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceProfile': - """Initialize a InstanceProfile object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceProfileOSArchitecture': + """Initialize a InstanceProfileOSArchitecture object from a json dictionary.""" args = {} - if 'bandwidth' in _dict: - args['bandwidth'] = _dict.get('bandwidth') - else: - raise ValueError('Required property \'bandwidth\' not present in InstanceProfile JSON') - if 'disks' in _dict: - args['disks'] = [InstanceProfileDisk.from_dict(x) for x in _dict.get('disks')] - else: - raise ValueError('Required property \'disks\' not present in InstanceProfile JSON') - if 'family' in _dict: - args['family'] = _dict.get('family') - if 'gpu_count' in _dict: - args['gpu_count'] = _dict.get('gpu_count') - if 'gpu_manufacturer' in _dict: - args['gpu_manufacturer'] = InstanceProfileGPUManufacturer.from_dict(_dict.get('gpu_manufacturer')) - if 'gpu_memory' in _dict: - args['gpu_memory'] = _dict.get('gpu_memory') - if 'gpu_model' in _dict: - args['gpu_model'] = InstanceProfileGPUModel.from_dict(_dict.get('gpu_model')) - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in InstanceProfile JSON') - if 'memory' in _dict: - args['memory'] = _dict.get('memory') - else: - raise ValueError('Required property \'memory\' not present in InstanceProfile JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in InstanceProfile JSON') - if 'os_architecture' in _dict: - args['os_architecture'] = InstanceProfileOSArchitecture.from_dict(_dict.get('os_architecture')) - else: - raise ValueError('Required property \'os_architecture\' not present in InstanceProfile JSON') - if 'port_speed' in _dict: - args['port_speed'] = _dict.get('port_speed') - else: - raise ValueError('Required property \'port_speed\' not present in InstanceProfile JSON') - if 'total_volume_bandwidth' in _dict: - args['total_volume_bandwidth'] = _dict.get('total_volume_bandwidth') + if 'default' in _dict: + args['default'] = _dict.get('default') else: - raise ValueError('Required property \'total_volume_bandwidth\' not present in InstanceProfile JSON') - if 'vcpu_architecture' in _dict: - args['vcpu_architecture'] = InstanceProfileVCPUArchitecture.from_dict(_dict.get('vcpu_architecture')) + raise ValueError('Required property \'default\' not present in InstanceProfileOSArchitecture JSON') + if 'type' in _dict: + args['type'] = _dict.get('type') else: - raise ValueError('Required property \'vcpu_architecture\' not present in InstanceProfile JSON') - if 'vcpu_count' in _dict: - args['vcpu_count'] = _dict.get('vcpu_count') + raise ValueError('Required property \'type\' not present in InstanceProfileOSArchitecture JSON') + if 'values' in _dict: + args['values'] = _dict.get('values') else: - raise ValueError('Required property \'vcpu_count\' not present in InstanceProfile JSON') + raise ValueError('Required property \'values\' not present in InstanceProfileOSArchitecture JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceProfile object from a json dictionary.""" + """Initialize a InstanceProfileOSArchitecture object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'bandwidth') and self.bandwidth is not None: - if isinstance(self.bandwidth, dict): - _dict['bandwidth'] = self.bandwidth - else: - _dict['bandwidth'] = self.bandwidth.to_dict() - if hasattr(self, 'disks') and self.disks is not None: - _dict['disks'] = [x.to_dict() for x in self.disks] - if hasattr(self, 'family') and self.family is not None: - _dict['family'] = self.family - if hasattr(self, 'gpu_count') and self.gpu_count is not None: - if isinstance(self.gpu_count, dict): - _dict['gpu_count'] = self.gpu_count - else: - _dict['gpu_count'] = self.gpu_count.to_dict() - if hasattr(self, 'gpu_manufacturer') and self.gpu_manufacturer is not None: - _dict['gpu_manufacturer'] = self.gpu_manufacturer.to_dict() - if hasattr(self, 'gpu_memory') and self.gpu_memory is not None: - if isinstance(self.gpu_memory, dict): - _dict['gpu_memory'] = self.gpu_memory - else: - _dict['gpu_memory'] = self.gpu_memory.to_dict() - if hasattr(self, 'gpu_model') and self.gpu_model is not None: - _dict['gpu_model'] = self.gpu_model.to_dict() - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'memory') and self.memory is not None: - if isinstance(self.memory, dict): - _dict['memory'] = self.memory - else: - _dict['memory'] = self.memory.to_dict() - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'os_architecture') and self.os_architecture is not None: - _dict['os_architecture'] = self.os_architecture.to_dict() - if hasattr(self, 'port_speed') and self.port_speed is not None: - if isinstance(self.port_speed, dict): - _dict['port_speed'] = self.port_speed - else: - _dict['port_speed'] = self.port_speed.to_dict() - if hasattr(self, 'total_volume_bandwidth') and self.total_volume_bandwidth is not None: - if isinstance(self.total_volume_bandwidth, dict): - _dict['total_volume_bandwidth'] = self.total_volume_bandwidth - else: - _dict['total_volume_bandwidth'] = self.total_volume_bandwidth.to_dict() - if hasattr(self, 'vcpu_architecture') and self.vcpu_architecture is not None: - _dict['vcpu_architecture'] = self.vcpu_architecture.to_dict() - if hasattr(self, 'vcpu_count') and self.vcpu_count is not None: - if isinstance(self.vcpu_count, dict): - _dict['vcpu_count'] = self.vcpu_count - else: - _dict['vcpu_count'] = self.vcpu_count.to_dict() + if hasattr(self, 'default') and self.default is not None: + _dict['default'] = self.default + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'values') and self.values is not None: + _dict['values'] = self.values return _dict def _to_dict(self): @@ -34367,72 +37847,89 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceProfile object.""" + """Return a `str` version of this InstanceProfileOSArchitecture object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceProfile') -> bool: + def __eq__(self, other: 'InstanceProfileOSArchitecture') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceProfile') -> bool: + def __ne__(self, other: 'InstanceProfileOSArchitecture') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceProfileBandwidth(): + class TypeEnum(str, Enum): + """ + The type for this profile field. + """ + ENUM = 'enum' + + +class InstanceProfilePortSpeed(): """ - InstanceProfileBandwidth. + InstanceProfilePortSpeed. """ def __init__(self) -> None: """ - Initialize a InstanceProfileBandwidth object. + Initialize a InstanceProfilePortSpeed object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstanceProfileBandwidthFixed', 'InstanceProfileBandwidthRange', 'InstanceProfileBandwidthEnum', 'InstanceProfileBandwidthDependent'])) + ", ".join(['InstanceProfilePortSpeedFixed', 'InstanceProfilePortSpeedDependent'])) raise Exception(msg) -class InstanceProfileCollection(): +class InstanceProfileReference(): """ - InstanceProfileCollection. + InstanceProfileReference. - :attr List[InstanceProfile] profiles: Collection of virtual server instance - profiles. + :attr str href: The URL for this virtual server instance profile. + :attr str name: The globally unique name for this virtual server instance + profile. """ def __init__(self, - profiles: List['InstanceProfile']) -> None: + href: str, + name: str) -> None: """ - Initialize a InstanceProfileCollection object. + Initialize a InstanceProfileReference object. - :param List[InstanceProfile] profiles: Collection of virtual server - instance profiles. + :param str href: The URL for this virtual server instance profile. + :param str name: The globally unique name for this virtual server instance + profile. """ - self.profiles = profiles + self.href = href + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceProfileCollection': - """Initialize a InstanceProfileCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceProfileReference': + """Initialize a InstanceProfileReference object from a json dictionary.""" args = {} - if 'profiles' in _dict: - args['profiles'] = [InstanceProfile.from_dict(x) for x in _dict.get('profiles')] + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'profiles\' not present in InstanceProfileCollection JSON') + raise ValueError('Required property \'href\' not present in InstanceProfileReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in InstanceProfileReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceProfileCollection object from a json dictionary.""" + """Initialize a InstanceProfileReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'profiles') and self.profiles is not None: - _dict['profiles'] = [x.to_dict() for x in self.profiles] + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -34440,81 +37937,91 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceProfileCollection object.""" + """Return a `str` version of this InstanceProfileReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceProfileCollection') -> bool: + def __eq__(self, other: 'InstanceProfileReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceProfileCollection') -> bool: + def __ne__(self, other: 'InstanceProfileReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceProfileDisk(): +class InstanceProfileVCPU(): """ - Disks provided by this profile. + InstanceProfileVCPU. - :attr InstanceProfileDiskQuantity quantity: - :attr InstanceProfileDiskSize size: - :attr InstanceProfileDiskSupportedInterfaces supported_interface_types: + """ + + def __init__(self) -> None: + """ + Initialize a InstanceProfileVCPU object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['InstanceProfileVCPUFixed', 'InstanceProfileVCPURange', 'InstanceProfileVCPUEnum', 'InstanceProfileVCPUDependent'])) + raise Exception(msg) + +class InstanceProfileVCPUArchitecture(): + """ + InstanceProfileVCPUArchitecture. + + :attr str default: (optional) The default VCPU architecture for an instance with + this profile. + :attr str type: The type for this profile field. + :attr str value: The VCPU architecture for an instance with this profile. """ def __init__(self, - quantity: 'InstanceProfileDiskQuantity', - size: 'InstanceProfileDiskSize', - supported_interface_types: 'InstanceProfileDiskSupportedInterfaces') -> None: + type: str, + value: str, + *, + default: str = None) -> None: """ - Initialize a InstanceProfileDisk object. + Initialize a InstanceProfileVCPUArchitecture object. - :param InstanceProfileDiskQuantity quantity: - :param InstanceProfileDiskSize size: - :param InstanceProfileDiskSupportedInterfaces supported_interface_types: + :param str type: The type for this profile field. + :param str value: The VCPU architecture for an instance with this profile. + :param str default: (optional) The default VCPU architecture for an + instance with this profile. """ - self.quantity = quantity - self.size = size - self.supported_interface_types = supported_interface_types + self.default = default + self.type = type + self.value = value @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceProfileDisk': - """Initialize a InstanceProfileDisk object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceProfileVCPUArchitecture': + """Initialize a InstanceProfileVCPUArchitecture object from a json dictionary.""" args = {} - if 'quantity' in _dict: - args['quantity'] = _dict.get('quantity') - else: - raise ValueError('Required property \'quantity\' not present in InstanceProfileDisk JSON') - if 'size' in _dict: - args['size'] = _dict.get('size') + if 'default' in _dict: + args['default'] = _dict.get('default') + if 'type' in _dict: + args['type'] = _dict.get('type') else: - raise ValueError('Required property \'size\' not present in InstanceProfileDisk JSON') - if 'supported_interface_types' in _dict: - args['supported_interface_types'] = InstanceProfileDiskSupportedInterfaces.from_dict(_dict.get('supported_interface_types')) + raise ValueError('Required property \'type\' not present in InstanceProfileVCPUArchitecture JSON') + if 'value' in _dict: + args['value'] = _dict.get('value') else: - raise ValueError('Required property \'supported_interface_types\' not present in InstanceProfileDisk JSON') + raise ValueError('Required property \'value\' not present in InstanceProfileVCPUArchitecture JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceProfileDisk object from a json dictionary.""" + """Initialize a InstanceProfileVCPUArchitecture object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'quantity') and self.quantity is not None: - if isinstance(self.quantity, dict): - _dict['quantity'] = self.quantity - else: - _dict['quantity'] = self.quantity.to_dict() - if hasattr(self, 'size') and self.size is not None: - if isinstance(self.size, dict): - _dict['size'] = self.size - else: - _dict['size'] = self.size.to_dict() - if hasattr(self, 'supported_interface_types') and self.supported_interface_types is not None: - _dict['supported_interface_types'] = self.supported_interface_types.to_dict() + if hasattr(self, 'default') and self.default is not None: + _dict['default'] = self.default + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'value') and self.value is not None: + _dict['value'] = self.value return _dict def _to_dict(self): @@ -34522,115 +38029,258 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceProfileDisk object.""" + """Return a `str` version of this InstanceProfileVCPUArchitecture object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceProfileDisk') -> bool: + def __eq__(self, other: 'InstanceProfileVCPUArchitecture') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceProfileDisk') -> bool: + def __ne__(self, other: 'InstanceProfileVCPUArchitecture') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceProfileDiskQuantity(): + class TypeEnum(str, Enum): + """ + The type for this profile field. + """ + FIXED = 'fixed' + + +class InstanceProfileVolumeBandwidth(): """ - InstanceProfileDiskQuantity. + InstanceProfileVolumeBandwidth. """ def __init__(self) -> None: """ - Initialize a InstanceProfileDiskQuantity object. + Initialize a InstanceProfileVolumeBandwidth object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstanceProfileDiskQuantityFixed', 'InstanceProfileDiskQuantityRange', 'InstanceProfileDiskQuantityEnum', 'InstanceProfileDiskQuantityDependent'])) + ", ".join(['InstanceProfileVolumeBandwidthFixed', 'InstanceProfileVolumeBandwidthRange', 'InstanceProfileVolumeBandwidthEnum', 'InstanceProfileVolumeBandwidthDependent'])) raise Exception(msg) -class InstanceProfileDiskSize(): +class InstancePrototype(): """ - InstanceProfileDiskSize. + InstancePrototype. + :attr InstanceAvailabilityPrototype availability_policy: (optional) The + availability policy to use for this virtual server instance. + :attr InstanceDefaultTrustedProfilePrototype default_trusted_profile: (optional) + The default trusted profile configuration to use for this virtual server + instance + This property's value is used when provisioning the virtual server instance, but + not + subsequently managed. Accordingly, it is reflected as an [instance + initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) + property. + :attr List[KeyIdentity] keys: (optional) The public SSH keys for the + administrative user of the virtual server instance. Keys will be made available + to the virtual server instance as cloud-init vendor data. For cloud-init enabled + images, these keys will also be added as SSH authorized keys for the + administrative user. + For Windows images, at least one key must be specified, and one will be chosen + to encrypt [the administrator + password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys + are optional for other images, but if no keys are specified, the instance will + be inaccessible unless the specified image provides another means of access. + This property's value is used when provisioning the virtual server instance, but + not subsequently managed. Accordingly, it is reflected as an [instance + initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) + property. + :attr InstanceMetadataServicePrototype metadata_service: (optional) The metadata + service configuration. + :attr str name: (optional) The unique user-defined name for this virtual server + instance (and default system hostname). If unspecified, the name will be a + hyphenated list of randomly-selected words. + :attr List[NetworkInterfacePrototype] network_interfaces: (optional) The + additional network interfaces to create for the virtual server instance. + :attr InstancePlacementTargetPrototype placement_target: (optional) The + placement restrictions to use for the virtual server instance. + :attr InstanceProfileIdentity profile: (optional) The profile to use for this + virtual server instance. If unspecified, `bx2-2x8` will + be used, but this default value is expected to change in the future. + :attr ResourceGroupIdentity resource_group: (optional) The resource group to + use. If unspecified, the account's [default resource + group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + :attr int total_volume_bandwidth: (optional) The amount of bandwidth (in + megabits per second) allocated exclusively to instance storage volumes. An + increase in this value will result in a corresponding decrease to + `total_network_bandwidth`. + :attr str user_data: (optional) [User + data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when + setting up the virtual server instance. + :attr List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: + (optional) The additional volume attachments to create for the virtual server + instance. + :attr VPCIdentity vpc: (optional) The VPC the virtual server instance is to be a + part of. If specified, it must match + the VPC referenced by the subnets of the instance's network interfaces. """ - def __init__(self) -> None: + def __init__(self, + *, + availability_policy: 'InstanceAvailabilityPrototype' = None, + default_trusted_profile: 'InstanceDefaultTrustedProfilePrototype' = None, + keys: List['KeyIdentity'] = None, + metadata_service: 'InstanceMetadataServicePrototype' = None, + name: str = None, + network_interfaces: List['NetworkInterfacePrototype'] = None, + placement_target: 'InstancePlacementTargetPrototype' = None, + profile: 'InstanceProfileIdentity' = None, + resource_group: 'ResourceGroupIdentity' = None, + total_volume_bandwidth: int = None, + user_data: str = None, + volume_attachments: List['VolumeAttachmentPrototypeInstanceContext'] = None, + vpc: 'VPCIdentity' = None) -> None: """ - Initialize a InstanceProfileDiskSize object. + Initialize a InstancePrototype object. + :param InstanceAvailabilityPrototype availability_policy: (optional) The + availability policy to use for this virtual server instance. + :param InstanceDefaultTrustedProfilePrototype default_trusted_profile: + (optional) The default trusted profile configuration to use for this + virtual server instance + This property's value is used when provisioning the virtual server + instance, but not + subsequently managed. Accordingly, it is reflected as an [instance + initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) + property. + :param List[KeyIdentity] keys: (optional) The public SSH keys for the + administrative user of the virtual server instance. Keys will be made + available to the virtual server instance as cloud-init vendor data. For + cloud-init enabled images, these keys will also be added as SSH authorized + keys for the administrative user. + For Windows images, at least one key must be specified, and one will be + chosen to encrypt [the administrator + password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). + Keys are optional for other images, but if no keys are specified, the + instance will be inaccessible unless the specified image provides another + means of access. + This property's value is used when provisioning the virtual server + instance, but not subsequently managed. Accordingly, it is reflected as an + [instance + initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) + property. + :param InstanceMetadataServicePrototype metadata_service: (optional) The + metadata service configuration. + :param str name: (optional) The unique user-defined name for this virtual + server instance (and default system hostname). If unspecified, the name + will be a hyphenated list of randomly-selected words. + :param List[NetworkInterfacePrototype] network_interfaces: (optional) The + additional network interfaces to create for the virtual server instance. + :param InstancePlacementTargetPrototype placement_target: (optional) The + placement restrictions to use for the virtual server instance. + :param InstanceProfileIdentity profile: (optional) The profile to use for + this virtual server instance. If unspecified, `bx2-2x8` will + be used, but this default value is expected to change in the future. + :param ResourceGroupIdentity resource_group: (optional) The resource group + to use. If unspecified, the account's [default resource + group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is + used. + :param int total_volume_bandwidth: (optional) The amount of bandwidth (in + megabits per second) allocated exclusively to instance storage volumes. An + increase in this value will result in a corresponding decrease to + `total_network_bandwidth`. + :param str user_data: (optional) [User + data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available + when setting up the virtual server instance. + :param List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: + (optional) The additional volume attachments to create for the virtual + server instance. + :param VPCIdentity vpc: (optional) The VPC the virtual server instance is + to be a part of. If specified, it must match + the VPC referenced by the subnets of the instance's network interfaces. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstanceProfileDiskSizeFixed', 'InstanceProfileDiskSizeRange', 'InstanceProfileDiskSizeEnum', 'InstanceProfileDiskSizeDependent'])) + ", ".join(['InstancePrototypeInstanceByImage', 'InstancePrototypeInstanceBySourceSnapshot', 'InstancePrototypeInstanceBySourceTemplate'])) raise Exception(msg) -class InstanceProfileDiskSupportedInterfaces(): +class InstanceReference(): """ - InstanceProfileDiskSupportedInterfaces. + InstanceReference. - :attr str default: The disk interface used for attaching the disk. - The enumerated values for this property are expected to expand in the future. - When processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the resource on which the unexpected - property value was encountered. - :attr str type: The type for this profile field. - :attr List[str] values: The supported disk interfaces used for attaching the - disk. + :attr str crn: The CRN for this virtual server instance. + :attr InstanceReferenceDeleted deleted: (optional) If present, this property + indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str href: The URL for this virtual server instance. + :attr str id: The unique identifier for this virtual server instance. + :attr str name: The user-defined name for this virtual server instance (and + default system hostname). """ def __init__(self, - default: str, - type: str, - values: List[str]) -> None: + crn: str, + href: str, + id: str, + name: str, + *, + deleted: 'InstanceReferenceDeleted' = None) -> None: """ - Initialize a InstanceProfileDiskSupportedInterfaces object. + Initialize a InstanceReference object. - :param str default: The disk interface used for attaching the disk. - The enumerated values for this property are expected to expand in the - future. When processing this property, check for and log unknown values. - Optionally halt processing and surface the error, or bypass the resource on - which the unexpected property value was encountered. - :param str type: The type for this profile field. - :param List[str] values: The supported disk interfaces used for attaching - the disk. + :param str crn: The CRN for this virtual server instance. + :param str href: The URL for this virtual server instance. + :param str id: The unique identifier for this virtual server instance. + :param str name: The user-defined name for this virtual server instance + (and default system hostname). + :param InstanceReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides + some supplementary information. """ - self.default = default - self.type = type - self.values = values + self.crn = crn + self.deleted = deleted + self.href = href + self.id = id + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceProfileDiskSupportedInterfaces': - """Initialize a InstanceProfileDiskSupportedInterfaces object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceReference': + """Initialize a InstanceReference object from a json dictionary.""" args = {} - if 'default' in _dict: - args['default'] = _dict.get('default') + if 'crn' in _dict: + args['crn'] = _dict.get('crn') else: - raise ValueError('Required property \'default\' not present in InstanceProfileDiskSupportedInterfaces JSON') - if 'type' in _dict: - args['type'] = _dict.get('type') + raise ValueError('Required property \'crn\' not present in InstanceReference JSON') + if 'deleted' in _dict: + args['deleted'] = InstanceReferenceDeleted.from_dict(_dict.get('deleted')) + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'type\' not present in InstanceProfileDiskSupportedInterfaces JSON') - if 'values' in _dict: - args['values'] = _dict.get('values') + raise ValueError('Required property \'href\' not present in InstanceReference JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') else: - raise ValueError('Required property \'values\' not present in InstanceProfileDiskSupportedInterfaces JSON') + raise ValueError('Required property \'id\' not present in InstanceReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in InstanceReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceProfileDiskSupportedInterfaces object from a json dictionary.""" + """Initialize a InstanceReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'default') and self.default is not None: - _dict['default'] = self.default - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type - if hasattr(self, 'values') and self.values is not None: - _dict['values'] = self.values + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -34638,113 +38288,133 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceProfileDiskSupportedInterfaces object.""" + """Return a `str` version of this InstanceReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceProfileDiskSupportedInterfaces') -> bool: + def __eq__(self, other: 'InstanceReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceProfileDiskSupportedInterfaces') -> bool: + def __ne__(self, other: 'InstanceReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class DefaultEnum(str, Enum): - """ - The disk interface used for attaching the disk. - The enumerated values for this property are expected to expand in the future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the resource on which the unexpected - property value was encountered. - """ - NVME = 'nvme' - VIRTIO_BLK = 'virtio_blk' +class InstanceReferenceDeleted(): + """ + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. + :attr str more_info: Link to documentation about deleted resources. + """ - class TypeEnum(str, Enum): + def __init__(self, + more_info: str) -> None: """ - The type for this profile field. + Initialize a InstanceReferenceDeleted object. + + :param str more_info: Link to documentation about deleted resources. """ - ENUM = 'enum' + self.more_info = more_info + @classmethod + def from_dict(cls, _dict: Dict) -> 'InstanceReferenceDeleted': + """Initialize a InstanceReferenceDeleted object from a json dictionary.""" + args = {} + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') + else: + raise ValueError('Required property \'more_info\' not present in InstanceReferenceDeleted JSON') + return cls(**args) - class ValuesEnum(str, Enum): - """ - The disk interface used for attaching the disk. - The enumerated values for this property are expected to expand in the future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the resource on which the unexpected - property value was encountered. - """ - NVME = 'nvme' - VIRTIO_BLK = 'virtio_blk' + @classmethod + def _from_dict(cls, _dict): + """Initialize a InstanceReferenceDeleted object from a json dictionary.""" + return cls.from_dict(_dict) + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info + return _dict -class InstanceProfileGPU(): - """ - InstanceProfileGPU. + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() - """ + def __str__(self) -> str: + """Return a `str` version of this InstanceReferenceDeleted object.""" + return json.dumps(self.to_dict(), indent=2) - def __init__(self) -> None: - """ - Initialize a InstanceProfileGPU object. + def __eq__(self, other: 'InstanceReferenceDeleted') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstanceProfileGPUFixed', 'InstanceProfileGPURange', 'InstanceProfileGPUEnum', 'InstanceProfileGPUDependent'])) - raise Exception(msg) + def __ne__(self, other: 'InstanceReferenceDeleted') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other -class InstanceProfileGPUManufacturer(): +class InstanceStatusReason(): """ - InstanceProfileGPUManufacturer. + InstanceStatusReason. - :attr str type: The type for this profile field. - :attr List[str] values: The possible GPU manufacturer(s) for an instance with - this profile. + :attr str code: A snake case string succinctly identifying the status reason. + :attr str message: An explanation of the status reason. + :attr str more_info: (optional) Link to documentation about this status reason. """ def __init__(self, - type: str, - values: List[str]) -> None: + code: str, + message: str, + *, + more_info: str = None) -> None: """ - Initialize a InstanceProfileGPUManufacturer object. + Initialize a InstanceStatusReason object. - :param str type: The type for this profile field. - :param List[str] values: The possible GPU manufacturer(s) for an instance - with this profile. + :param str code: A snake case string succinctly identifying the status + reason. + :param str message: An explanation of the status reason. + :param str more_info: (optional) Link to documentation about this status + reason. """ - self.type = type - self.values = values + self.code = code + self.message = message + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceProfileGPUManufacturer': - """Initialize a InstanceProfileGPUManufacturer object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceStatusReason': + """Initialize a InstanceStatusReason object from a json dictionary.""" args = {} - if 'type' in _dict: - args['type'] = _dict.get('type') + if 'code' in _dict: + args['code'] = _dict.get('code') else: - raise ValueError('Required property \'type\' not present in InstanceProfileGPUManufacturer JSON') - if 'values' in _dict: - args['values'] = _dict.get('values') + raise ValueError('Required property \'code\' not present in InstanceStatusReason JSON') + if 'message' in _dict: + args['message'] = _dict.get('message') else: - raise ValueError('Required property \'values\' not present in InstanceProfileGPUManufacturer JSON') + raise ValueError('Required property \'message\' not present in InstanceStatusReason JSON') + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceProfileGPUManufacturer object from a json dictionary.""" + """Initialize a InstanceStatusReason object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type - if hasattr(self, 'values') and self.values is not None: - _dict['values'] = self.values + if hasattr(self, 'code') and self.code is not None: + _dict['code'] = self.code + if hasattr(self, 'message') and self.message is not None: + _dict['message'] = self.message + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -34752,89 +38422,267 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceProfileGPUManufacturer object.""" + """Return a `str` version of this InstanceStatusReason object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceProfileGPUManufacturer') -> bool: + def __eq__(self, other: 'InstanceStatusReason') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceProfileGPUManufacturer') -> bool: + def __ne__(self, other: 'InstanceStatusReason') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class TypeEnum(str, Enum): + class CodeEnum(str, Enum): """ - The type for this profile field. + A snake case string succinctly identifying the status reason. """ - ENUM = 'enum' + CANNOT_START = 'cannot_start' + CANNOT_START_CAPACITY = 'cannot_start_capacity' + CANNOT_START_COMPUTE = 'cannot_start_compute' + CANNOT_START_IP_ADDRESS = 'cannot_start_ip_address' + CANNOT_START_NETWORK = 'cannot_start_network' + CANNOT_START_PLACEMENT_GROUP = 'cannot_start_placement_group' + CANNOT_START_STORAGE = 'cannot_start_storage' + ENCRYPTION_KEY_DELETED = 'encryption_key_deleted' + STOPPED_BY_HOST_FAILURE = 'stopped_by_host_failure' + STOPPED_FOR_IMAGE_CREATION = 'stopped_for_image_creation' -class InstanceProfileGPUMemory(): +class InstanceTemplate(): """ - InstanceProfileGPUMemory. + InstanceTemplate. + :attr InstanceAvailabilityPrototype availability_policy: (optional) The + availability policy to use for this virtual server instance. + :attr datetime created_at: The date and time that the instance template was + created. + :attr str crn: The CRN for this instance template. + :attr InstanceDefaultTrustedProfilePrototype default_trusted_profile: (optional) + The default trusted profile configuration to use for this virtual server + instance + This property's value is used when provisioning the virtual server instance, but + not + subsequently managed. Accordingly, it is reflected as an [instance + initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) + property. + :attr str href: The URL for this instance template. + :attr str id: The unique identifier for this instance template. + :attr List[KeyIdentity] keys: (optional) The public SSH keys for the + administrative user of the virtual server instance. Keys will be made available + to the virtual server instance as cloud-init vendor data. For cloud-init enabled + images, these keys will also be added as SSH authorized keys for the + administrative user. + For Windows images, at least one key must be specified, and one will be chosen + to encrypt [the administrator + password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys + are optional for other images, but if no keys are specified, the instance will + be inaccessible unless the specified image provides another means of access. + This property's value is used when provisioning the virtual server instance, but + not subsequently managed. Accordingly, it is reflected as an [instance + initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) + property. + :attr InstanceMetadataServicePrototype metadata_service: (optional) The metadata + service configuration. + :attr str name: The unique user-defined name for this instance template. + :attr List[NetworkInterfacePrototype] network_interfaces: (optional) The + additional network interfaces to create for the virtual server instance. + :attr InstancePlacementTargetPrototype placement_target: (optional) The + placement restrictions to use for the virtual server instance. + :attr InstanceProfileIdentity profile: (optional) The profile to use for this + virtual server instance. If unspecified, `bx2-2x8` will + be used, but this default value is expected to change in the future. + :attr ResourceGroupReference resource_group: The resource group for this + instance template. + :attr int total_volume_bandwidth: (optional) The amount of bandwidth (in + megabits per second) allocated exclusively to instance storage volumes. An + increase in this value will result in a corresponding decrease to + `total_network_bandwidth`. + :attr str user_data: (optional) [User + data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when + setting up the virtual server instance. + :attr List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: + (optional) The additional volume attachments to create for the virtual server + instance. + :attr VPCIdentity vpc: (optional) The VPC the virtual server instance is to be a + part of. If specified, it must match + the VPC referenced by the subnets of the instance's network interfaces. """ - def __init__(self) -> None: + def __init__(self, + created_at: datetime, + crn: str, + href: str, + id: str, + name: str, + resource_group: 'ResourceGroupReference', + *, + availability_policy: 'InstanceAvailabilityPrototype' = None, + default_trusted_profile: 'InstanceDefaultTrustedProfilePrototype' = None, + keys: List['KeyIdentity'] = None, + metadata_service: 'InstanceMetadataServicePrototype' = None, + network_interfaces: List['NetworkInterfacePrototype'] = None, + placement_target: 'InstancePlacementTargetPrototype' = None, + profile: 'InstanceProfileIdentity' = None, + total_volume_bandwidth: int = None, + user_data: str = None, + volume_attachments: List['VolumeAttachmentPrototypeInstanceContext'] = None, + vpc: 'VPCIdentity' = None) -> None: """ - Initialize a InstanceProfileGPUMemory object. + Initialize a InstanceTemplate object. + :param datetime created_at: The date and time that the instance template + was created. + :param str crn: The CRN for this instance template. + :param str href: The URL for this instance template. + :param str id: The unique identifier for this instance template. + :param str name: The unique user-defined name for this instance template. + :param ResourceGroupReference resource_group: The resource group for this + instance template. + :param InstanceAvailabilityPrototype availability_policy: (optional) The + availability policy to use for this virtual server instance. + :param InstanceDefaultTrustedProfilePrototype default_trusted_profile: + (optional) The default trusted profile configuration to use for this + virtual server instance + This property's value is used when provisioning the virtual server + instance, but not + subsequently managed. Accordingly, it is reflected as an [instance + initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) + property. + :param List[KeyIdentity] keys: (optional) The public SSH keys for the + administrative user of the virtual server instance. Keys will be made + available to the virtual server instance as cloud-init vendor data. For + cloud-init enabled images, these keys will also be added as SSH authorized + keys for the administrative user. + For Windows images, at least one key must be specified, and one will be + chosen to encrypt [the administrator + password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). + Keys are optional for other images, but if no keys are specified, the + instance will be inaccessible unless the specified image provides another + means of access. + This property's value is used when provisioning the virtual server + instance, but not subsequently managed. Accordingly, it is reflected as an + [instance + initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) + property. + :param InstanceMetadataServicePrototype metadata_service: (optional) The + metadata service configuration. + :param List[NetworkInterfacePrototype] network_interfaces: (optional) The + additional network interfaces to create for the virtual server instance. + :param InstancePlacementTargetPrototype placement_target: (optional) The + placement restrictions to use for the virtual server instance. + :param InstanceProfileIdentity profile: (optional) The profile to use for + this virtual server instance. If unspecified, `bx2-2x8` will + be used, but this default value is expected to change in the future. + :param int total_volume_bandwidth: (optional) The amount of bandwidth (in + megabits per second) allocated exclusively to instance storage volumes. An + increase in this value will result in a corresponding decrease to + `total_network_bandwidth`. + :param str user_data: (optional) [User + data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available + when setting up the virtual server instance. + :param List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: + (optional) The additional volume attachments to create for the virtual + server instance. + :param VPCIdentity vpc: (optional) The VPC the virtual server instance is + to be a part of. If specified, it must match + the VPC referenced by the subnets of the instance's network interfaces. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstanceProfileGPUMemoryFixed', 'InstanceProfileGPUMemoryRange', 'InstanceProfileGPUMemoryEnum', 'InstanceProfileGPUMemoryDependent'])) + ", ".join(['InstanceTemplateInstanceByImage', 'InstanceTemplateInstanceBySourceSnapshot'])) raise Exception(msg) -class InstanceProfileGPUModel(): +class InstanceTemplateCollection(): """ - InstanceProfileGPUModel. + InstanceTemplateCollection. - :attr str type: The type for this profile field. - :attr List[str] values: The possible GPU model(s) for an instance with this - profile. + :attr InstanceTemplateCollectionFirst first: A link to the first page of + resources. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr InstanceTemplateCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages + except the last page. + :attr List[InstanceTemplate] templates: Collection of instance templates. + :attr int total_count: The total number of resources across all pages. """ def __init__(self, - type: str, - values: List[str]) -> None: + first: 'InstanceTemplateCollectionFirst', + limit: int, + templates: List['InstanceTemplate'], + total_count: int, + *, + next: 'InstanceTemplateCollectionNext' = None) -> None: """ - Initialize a InstanceProfileGPUModel object. + Initialize a InstanceTemplateCollection object. - :param str type: The type for this profile field. - :param List[str] values: The possible GPU model(s) for an instance with - this profile. + :param InstanceTemplateCollectionFirst first: A link to the first page of + resources. + :param int limit: The maximum number of resources that can be returned by + the request. + :param List[InstanceTemplate] templates: Collection of instance templates. + :param int total_count: The total number of resources across all pages. + :param InstanceTemplateCollectionNext next: (optional) A link to the next + page of resources. This property is present for all pages + except the last page. """ - self.type = type - self.values = values + self.first = first + self.limit = limit + self.next = next + self.templates = templates + self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceProfileGPUModel': - """Initialize a InstanceProfileGPUModel object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceTemplateCollection': + """Initialize a InstanceTemplateCollection object from a json dictionary.""" args = {} - if 'type' in _dict: - args['type'] = _dict.get('type') + if 'first' in _dict: + args['first'] = InstanceTemplateCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'type\' not present in InstanceProfileGPUModel JSON') - if 'values' in _dict: - args['values'] = _dict.get('values') + raise ValueError('Required property \'first\' not present in InstanceTemplateCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') else: - raise ValueError('Required property \'values\' not present in InstanceProfileGPUModel JSON') + raise ValueError('Required property \'limit\' not present in InstanceTemplateCollection JSON') + if 'next' in _dict: + args['next'] = InstanceTemplateCollectionNext.from_dict(_dict.get('next')) + if 'templates' in _dict: + args['templates'] = _dict.get('templates') + else: + raise ValueError('Required property \'templates\' not present in InstanceTemplateCollection JSON') + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') + else: + raise ValueError('Required property \'total_count\' not present in InstanceTemplateCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceProfileGPUModel object from a json dictionary.""" + """Initialize a InstanceTemplateCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type - if hasattr(self, 'values') and self.values is not None: - _dict['values'] = self.values + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'templates') and self.templates is not None: + templates_list = [] + for x in self.templates: + if isinstance(x, dict): + templates_list.append(x) + else: + templates_list.append(x.to_dict()) + _dict['templates'] = templates_list + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count return _dict def _to_dict(self): @@ -34842,116 +38690,55 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceProfileGPUModel object.""" + """Return a `str` version of this InstanceTemplateCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceProfileGPUModel') -> bool: + def __eq__(self, other: 'InstanceTemplateCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceProfileGPUModel') -> bool: + def __ne__(self, other: 'InstanceTemplateCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class TypeEnum(str, Enum): - """ - The type for this profile field. - """ - ENUM = 'enum' - - -class InstanceProfileIdentity(): - """ - Identifies an instance profile by a unique property. - - """ - - def __init__(self) -> None: - """ - Initialize a InstanceProfileIdentity object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstanceProfileIdentityByName', 'InstanceProfileIdentityByHref'])) - raise Exception(msg) - -class InstanceProfileMemory(): - """ - InstanceProfileMemory. - - """ - - def __init__(self) -> None: - """ - Initialize a InstanceProfileMemory object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstanceProfileMemoryFixed', 'InstanceProfileMemoryRange', 'InstanceProfileMemoryEnum', 'InstanceProfileMemoryDependent'])) - raise Exception(msg) - -class InstanceProfileOSArchitecture(): +class InstanceTemplateCollectionFirst(): """ - InstanceProfileOSArchitecture. + A link to the first page of resources. - :attr str default: The default OS architecture for an instance with this - profile. - :attr str type: The type for this profile field. - :attr List[str] values: The supported OS architecture(s) for an instance with - this profile. + :attr str href: The URL for a page of resources. """ def __init__(self, - default: str, - type: str, - values: List[str]) -> None: + href: str) -> None: """ - Initialize a InstanceProfileOSArchitecture object. + Initialize a InstanceTemplateCollectionFirst object. - :param str default: The default OS architecture for an instance with this - profile. - :param str type: The type for this profile field. - :param List[str] values: The supported OS architecture(s) for an instance - with this profile. + :param str href: The URL for a page of resources. """ - self.default = default - self.type = type - self.values = values + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceProfileOSArchitecture': - """Initialize a InstanceProfileOSArchitecture object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceTemplateCollectionFirst': + """Initialize a InstanceTemplateCollectionFirst object from a json dictionary.""" args = {} - if 'default' in _dict: - args['default'] = _dict.get('default') - else: - raise ValueError('Required property \'default\' not present in InstanceProfileOSArchitecture JSON') - if 'type' in _dict: - args['type'] = _dict.get('type') - else: - raise ValueError('Required property \'type\' not present in InstanceProfileOSArchitecture JSON') - if 'values' in _dict: - args['values'] = _dict.get('values') + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'values\' not present in InstanceProfileOSArchitecture JSON') + raise ValueError('Required property \'href\' not present in InstanceTemplateCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceProfileOSArchitecture object from a json dictionary.""" + """Initialize a InstanceTemplateCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'default') and self.default is not None: - _dict['default'] = self.default - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type - if hasattr(self, 'values') and self.values is not None: - _dict['values'] = self.values + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -34959,80 +38746,49 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceProfileOSArchitecture object.""" + """Return a `str` version of this InstanceTemplateCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceProfileOSArchitecture') -> bool: + def __eq__(self, other: 'InstanceTemplateCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceProfileOSArchitecture') -> bool: + def __ne__(self, other: 'InstanceTemplateCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class TypeEnum(str, Enum): - """ - The type for this profile field. - """ - ENUM = 'enum' - - -class InstanceProfilePortSpeed(): - """ - InstanceProfilePortSpeed. - - """ - - def __init__(self) -> None: - """ - Initialize a InstanceProfilePortSpeed object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstanceProfilePortSpeedFixed', 'InstanceProfilePortSpeedDependent'])) - raise Exception(msg) - -class InstanceProfileReference(): +class InstanceTemplateCollectionNext(): """ - InstanceProfileReference. + A link to the next page of resources. This property is present for all pages except + the last page. - :attr str href: The URL for this virtual server instance profile. - :attr str name: The globally unique name for this virtual server instance - profile. + :attr str href: The URL for a page of resources. """ def __init__(self, - href: str, - name: str) -> None: + href: str) -> None: """ - Initialize a InstanceProfileReference object. + Initialize a InstanceTemplateCollectionNext object. - :param str href: The URL for this virtual server instance profile. - :param str name: The globally unique name for this virtual server instance - profile. + :param str href: The URL for a page of resources. """ self.href = href - self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceProfileReference': - """Initialize a InstanceProfileReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceTemplateCollectionNext': + """Initialize a InstanceTemplateCollectionNext object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in InstanceProfileReference JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in InstanceProfileReference JSON') + raise ValueError('Required property \'href\' not present in InstanceTemplateCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceProfileReference object from a json dictionary.""" + """Initialize a InstanceTemplateCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -35040,8 +38796,6 @@ def to_dict(self) -> Dict: _dict = {} if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name return _dict def _to_dict(self): @@ -35049,91 +38803,71 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceProfileReference object.""" + """Return a `str` version of this InstanceTemplateCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceProfileReference') -> bool: + def __eq__(self, other: 'InstanceTemplateCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceProfileReference') -> bool: + def __ne__(self, other: 'InstanceTemplateCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceProfileVCPU(): +class InstanceTemplateIdentity(): """ - InstanceProfileVCPU. + Identifies an instance template by a unique property. """ def __init__(self) -> None: """ - Initialize a InstanceProfileVCPU object. + Initialize a InstanceTemplateIdentity object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstanceProfileVCPUFixed', 'InstanceProfileVCPURange', 'InstanceProfileVCPUEnum', 'InstanceProfileVCPUDependent'])) + ", ".join(['InstanceTemplateIdentityById', 'InstanceTemplateIdentityByHref', 'InstanceTemplateIdentityByCRN'])) raise Exception(msg) -class InstanceProfileVCPUArchitecture(): +class InstanceTemplatePatch(): """ - InstanceProfileVCPUArchitecture. + InstanceTemplatePatch. - :attr str default: (optional) The default VCPU architecture for an instance with - this profile. - :attr str type: The type for this profile field. - :attr str value: The VCPU architecture for an instance with this profile. + :attr str name: (optional) The unique user-defined name for this instance + template. """ def __init__(self, - type: str, - value: str, *, - default: str = None) -> None: + name: str = None) -> None: """ - Initialize a InstanceProfileVCPUArchitecture object. + Initialize a InstanceTemplatePatch object. - :param str type: The type for this profile field. - :param str value: The VCPU architecture for an instance with this profile. - :param str default: (optional) The default VCPU architecture for an - instance with this profile. + :param str name: (optional) The unique user-defined name for this instance + template. """ - self.default = default - self.type = type - self.value = value + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceProfileVCPUArchitecture': - """Initialize a InstanceProfileVCPUArchitecture object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'InstanceTemplatePatch': + """Initialize a InstanceTemplatePatch object from a json dictionary.""" args = {} - if 'default' in _dict: - args['default'] = _dict.get('default') - if 'type' in _dict: - args['type'] = _dict.get('type') - else: - raise ValueError('Required property \'type\' not present in InstanceProfileVCPUArchitecture JSON') - if 'value' in _dict: - args['value'] = _dict.get('value') - else: - raise ValueError('Required property \'value\' not present in InstanceProfileVCPUArchitecture JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceProfileVCPUArchitecture object from a json dictionary.""" + """Initialize a InstanceTemplatePatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'default') and self.default is not None: - _dict['default'] = self.default - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type - if hasattr(self, 'value') and self.value is not None: - _dict['value'] = self.value + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -35141,44 +38875,22 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceProfileVCPUArchitecture object.""" + """Return a `str` version of this InstanceTemplatePatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceProfileVCPUArchitecture') -> bool: + def __eq__(self, other: 'InstanceTemplatePatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceProfileVCPUArchitecture') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - - class TypeEnum(str, Enum): - """ - The type for this profile field. - """ - FIXED = 'fixed' - - -class InstanceProfileVolumeBandwidth(): - """ - InstanceProfileVolumeBandwidth. - - """ - - def __init__(self) -> None: - """ - Initialize a InstanceProfileVolumeBandwidth object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstanceProfileVolumeBandwidthFixed', 'InstanceProfileVolumeBandwidthRange', 'InstanceProfileVolumeBandwidthEnum', 'InstanceProfileVolumeBandwidthDependent'])) - raise Exception(msg) + def __ne__(self, other: 'InstanceTemplatePatch') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other -class InstancePrototype(): +class InstanceTemplatePrototype(): """ - InstancePrototype. + InstanceTemplatePrototype. :attr InstanceAvailabilityPrototype availability_policy: (optional) The availability policy to use for this virtual server instance. @@ -35223,10 +38935,12 @@ class InstancePrototype(): megabits per second) allocated exclusively to instance storage volumes. An increase in this value will result in a corresponding decrease to `total_network_bandwidth`. - :attr str user_data: (optional) User data to be made available when setting up - the virtual server instance. + :attr str user_data: (optional) [User + data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when + setting up the virtual server instance. :attr List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: - (optional) The volume attachments for this virtual server instance. + (optional) The additional volume attachments to create for the virtual server + instance. :attr VPCIdentity vpc: (optional) The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the subnets of the instance's network interfaces. @@ -35248,7 +38962,7 @@ def __init__(self, volume_attachments: List['VolumeAttachmentPrototypeInstanceContext'] = None, vpc: 'VPCIdentity' = None) -> None: """ - Initialize a InstancePrototype object. + Initialize a InstanceTemplatePrototype object. :param InstanceAvailabilityPrototype availability_policy: (optional) The availability policy to use for this virtual server instance. @@ -35296,30 +39010,31 @@ def __init__(self, megabits per second) allocated exclusively to instance storage volumes. An increase in this value will result in a corresponding decrease to `total_network_bandwidth`. - :param str user_data: (optional) User data to be made available when - setting up the virtual server instance. + :param str user_data: (optional) [User + data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available + when setting up the virtual server instance. :param List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: - (optional) The volume attachments for this virtual server instance. + (optional) The additional volume attachments to create for the virtual + server instance. :param VPCIdentity vpc: (optional) The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the subnets of the instance's network interfaces. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstancePrototypeInstanceByImage', 'InstancePrototypeInstanceBySourceSnapshot', 'InstancePrototypeInstanceBySourceTemplate'])) + ", ".join(['InstanceTemplatePrototypeInstanceByImage', 'InstanceTemplatePrototypeInstanceBySourceTemplate'])) raise Exception(msg) -class InstanceReference(): +class InstanceTemplateReference(): """ - InstanceReference. + InstanceTemplateReference. - :attr str crn: The CRN for this virtual server instance. - :attr InstanceReferenceDeleted deleted: (optional) If present, this property - indicates the referenced resource has been deleted and provides + :attr str crn: The CRN for this instance template. + :attr InstanceTemplateReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides some supplementary information. - :attr str href: The URL for this virtual server instance. - :attr str id: The unique identifier for this virtual server instance. - :attr str name: The user-defined name for this virtual server instance (and - default system hostname). + :attr str href: The URL for this instance template. + :attr str id: The unique identifier for this instance template. + :attr str name: The unique user-defined name for this instance template. """ def __init__(self, @@ -35328,67 +39043,508 @@ def __init__(self, id: str, name: str, *, - deleted: 'InstanceReferenceDeleted' = None) -> None: + deleted: 'InstanceTemplateReferenceDeleted' = None) -> None: """ - Initialize a InstanceReference object. + Initialize a InstanceTemplateReference object. - :param str crn: The CRN for this virtual server instance. - :param str href: The URL for this virtual server instance. - :param str id: The unique identifier for this virtual server instance. - :param str name: The user-defined name for this virtual server instance - (and default system hostname). - :param InstanceReferenceDeleted deleted: (optional) If present, this - property indicates the referenced resource has been deleted and provides + :param str crn: The CRN for this instance template. + :param str href: The URL for this instance template. + :param str id: The unique identifier for this instance template. + :param str name: The unique user-defined name for this instance template. + :param InstanceTemplateReferenceDeleted deleted: (optional) If present, + this property indicates the referenced resource has been deleted and + provides some supplementary information. """ - self.crn = crn - self.deleted = deleted + self.crn = crn + self.deleted = deleted + self.href = href + self.id = id + self.name = name + + @classmethod + def from_dict(cls, _dict: Dict) -> 'InstanceTemplateReference': + """Initialize a InstanceTemplateReference object from a json dictionary.""" + args = {} + if 'crn' in _dict: + args['crn'] = _dict.get('crn') + else: + raise ValueError('Required property \'crn\' not present in InstanceTemplateReference JSON') + if 'deleted' in _dict: + args['deleted'] = InstanceTemplateReferenceDeleted.from_dict(_dict.get('deleted')) + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in InstanceTemplateReference JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in InstanceTemplateReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in InstanceTemplateReference JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a InstanceTemplateReference object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this InstanceTemplateReference object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'InstanceTemplateReference') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'InstanceTemplateReference') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class InstanceTemplateReferenceDeleted(): + """ + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. + + :attr str more_info: Link to documentation about deleted resources. + """ + + def __init__(self, + more_info: str) -> None: + """ + Initialize a InstanceTemplateReferenceDeleted object. + + :param str more_info: Link to documentation about deleted resources. + """ + self.more_info = more_info + + @classmethod + def from_dict(cls, _dict: Dict) -> 'InstanceTemplateReferenceDeleted': + """Initialize a InstanceTemplateReferenceDeleted object from a json dictionary.""" + args = {} + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') + else: + raise ValueError('Required property \'more_info\' not present in InstanceTemplateReferenceDeleted JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a InstanceTemplateReferenceDeleted object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this InstanceTemplateReferenceDeleted object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'InstanceTemplateReferenceDeleted') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'InstanceTemplateReferenceDeleted') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class InstanceVCPU(): + """ + The virtual server instance VCPU configuration. + + :attr str architecture: The VCPU architecture. + :attr int count: The number of VCPUs assigned. + """ + + def __init__(self, + architecture: str, + count: int) -> None: + """ + Initialize a InstanceVCPU object. + + :param str architecture: The VCPU architecture. + :param int count: The number of VCPUs assigned. + """ + self.architecture = architecture + self.count = count + + @classmethod + def from_dict(cls, _dict: Dict) -> 'InstanceVCPU': + """Initialize a InstanceVCPU object from a json dictionary.""" + args = {} + if 'architecture' in _dict: + args['architecture'] = _dict.get('architecture') + else: + raise ValueError('Required property \'architecture\' not present in InstanceVCPU JSON') + if 'count' in _dict: + args['count'] = _dict.get('count') + else: + raise ValueError('Required property \'count\' not present in InstanceVCPU JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a InstanceVCPU object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'architecture') and self.architecture is not None: + _dict['architecture'] = self.architecture + if hasattr(self, 'count') and self.count is not None: + _dict['count'] = self.count + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this InstanceVCPU object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'InstanceVCPU') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'InstanceVCPU') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class Key(): + """ + Key. + + :attr datetime created_at: The date and time that the key was created. + :attr str crn: The CRN for this key. + :attr str fingerprint: The fingerprint for this key. The value is returned + base64-encoded and prefixed with the hash algorithm (always `SHA256`). + :attr str href: The URL for this key. + :attr str id: The unique identifier for this key. + :attr int length: The length of this key (in bits). + :attr str name: The unique user-defined name for this key. If unspecified, the + name will be a hyphenated list of randomly-selected words. + :attr str public_key: The public SSH key, consisting of two space-separated + fields: the algorithm name, and the base64-encoded key. + :attr ResourceGroupReference resource_group: The resource group for this key. + :attr str type: The crypto-system used by this key. + """ + + def __init__(self, + created_at: datetime, + crn: str, + fingerprint: str, + href: str, + id: str, + length: int, + name: str, + public_key: str, + resource_group: 'ResourceGroupReference', + type: str) -> None: + """ + Initialize a Key object. + + :param datetime created_at: The date and time that the key was created. + :param str crn: The CRN for this key. + :param str fingerprint: The fingerprint for this key. The value is + returned base64-encoded and prefixed with the hash algorithm (always + `SHA256`). + :param str href: The URL for this key. + :param str id: The unique identifier for this key. + :param int length: The length of this key (in bits). + :param str name: The unique user-defined name for this key. If unspecified, + the name will be a hyphenated list of randomly-selected words. + :param str public_key: The public SSH key, consisting of two + space-separated fields: the algorithm name, and the base64-encoded key. + :param ResourceGroupReference resource_group: The resource group for this + key. + :param str type: The crypto-system used by this key. + """ + self.created_at = created_at + self.crn = crn + self.fingerprint = fingerprint + self.href = href + self.id = id + self.length = length + self.name = name + self.public_key = public_key + self.resource_group = resource_group + self.type = type + + @classmethod + def from_dict(cls, _dict: Dict) -> 'Key': + """Initialize a Key object from a json dictionary.""" + args = {} + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) + else: + raise ValueError('Required property \'created_at\' not present in Key JSON') + if 'crn' in _dict: + args['crn'] = _dict.get('crn') + else: + raise ValueError('Required property \'crn\' not present in Key JSON') + if 'fingerprint' in _dict: + args['fingerprint'] = _dict.get('fingerprint') + else: + raise ValueError('Required property \'fingerprint\' not present in Key JSON') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in Key JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in Key JSON') + if 'length' in _dict: + args['length'] = _dict.get('length') + else: + raise ValueError('Required property \'length\' not present in Key JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in Key JSON') + if 'public_key' in _dict: + args['public_key'] = _dict.get('public_key') + else: + raise ValueError('Required property \'public_key\' not present in Key JSON') + if 'resource_group' in _dict: + args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) + else: + raise ValueError('Required property \'resource_group\' not present in Key JSON') + if 'type' in _dict: + args['type'] = _dict.get('type') + else: + raise ValueError('Required property \'type\' not present in Key JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a Key object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'fingerprint') and self.fingerprint is not None: + _dict['fingerprint'] = self.fingerprint + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'length') and self.length is not None: + _dict['length'] = self.length + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'public_key') and self.public_key is not None: + _dict['public_key'] = self.public_key + if hasattr(self, 'resource_group') and self.resource_group is not None: + _dict['resource_group'] = self.resource_group.to_dict() + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this Key object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'Key') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'Key') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class TypeEnum(str, Enum): + """ + The crypto-system used by this key. + """ + RSA = 'rsa' + + +class KeyCollection(): + """ + KeyCollection. + + :attr KeyCollectionFirst first: A link to the first page of resources. + :attr List[Key] keys: Collection of keys. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr KeyCollectionNext next: (optional) A link to the next page of resources. + This property is present for all pages + except the last page. + :attr int total_count: The total number of resources across all pages. + """ + + def __init__(self, + first: 'KeyCollectionFirst', + keys: List['Key'], + limit: int, + total_count: int, + *, + next: 'KeyCollectionNext' = None) -> None: + """ + Initialize a KeyCollection object. + + :param KeyCollectionFirst first: A link to the first page of resources. + :param List[Key] keys: Collection of keys. + :param int limit: The maximum number of resources that can be returned by + the request. + :param int total_count: The total number of resources across all pages. + :param KeyCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages + except the last page. + """ + self.first = first + self.keys = keys + self.limit = limit + self.next = next + self.total_count = total_count + + @classmethod + def from_dict(cls, _dict: Dict) -> 'KeyCollection': + """Initialize a KeyCollection object from a json dictionary.""" + args = {} + if 'first' in _dict: + args['first'] = KeyCollectionFirst.from_dict(_dict.get('first')) + else: + raise ValueError('Required property \'first\' not present in KeyCollection JSON') + if 'keys' in _dict: + args['keys'] = [Key.from_dict(x) for x in _dict.get('keys')] + else: + raise ValueError('Required property \'keys\' not present in KeyCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') + else: + raise ValueError('Required property \'limit\' not present in KeyCollection JSON') + if 'next' in _dict: + args['next'] = KeyCollectionNext.from_dict(_dict.get('next')) + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') + else: + raise ValueError('Required property \'total_count\' not present in KeyCollection JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a KeyCollection object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'keys') and self.keys is not None: + _dict['keys'] = [x.to_dict() for x in self.keys] + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this KeyCollection object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'KeyCollection') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'KeyCollection') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class KeyCollectionFirst(): + """ + A link to the first page of resources. + + :attr str href: The URL for a page of resources. + """ + + def __init__(self, + href: str) -> None: + """ + Initialize a KeyCollectionFirst object. + + :param str href: The URL for a page of resources. + """ self.href = href - self.id = id - self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceReference': - """Initialize a InstanceReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'KeyCollectionFirst': + """Initialize a KeyCollectionFirst object from a json dictionary.""" args = {} - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in InstanceReference JSON') - if 'deleted' in _dict: - args['deleted'] = InstanceReferenceDeleted.from_dict(_dict.get('deleted')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in InstanceReference JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in InstanceReference JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in InstanceReference JSON') + raise ValueError('Required property \'href\' not present in KeyCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceReference object from a json dictionary.""" + """Initialize a KeyCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name return _dict def _to_dict(self): @@ -35396,56 +39552,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceReference object.""" + """Return a `str` version of this KeyCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceReference') -> bool: + def __eq__(self, other: 'KeyCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceReference') -> bool: + def __ne__(self, other: 'KeyCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceReferenceDeleted(): +class KeyCollectionNext(): """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. + A link to the next page of resources. This property is present for all pages except + the last page. - :attr str more_info: Link to documentation about deleted resources. + :attr str href: The URL for a page of resources. """ def __init__(self, - more_info: str) -> None: + href: str) -> None: """ - Initialize a InstanceReferenceDeleted object. + Initialize a KeyCollectionNext object. - :param str more_info: Link to documentation about deleted resources. + :param str href: The URL for a page of resources. """ - self.more_info = more_info + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceReferenceDeleted': - """Initialize a InstanceReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'KeyCollectionNext': + """Initialize a KeyCollectionNext object from a json dictionary.""" args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'more_info\' not present in InstanceReferenceDeleted JSON') + raise ValueError('Required property \'href\' not present in KeyCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceReferenceDeleted object from a json dictionary.""" + """Initialize a KeyCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -35453,76 +39609,69 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceReferenceDeleted object.""" + """Return a `str` version of this KeyCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceReferenceDeleted') -> bool: + def __eq__(self, other: 'KeyCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceReferenceDeleted') -> bool: + def __ne__(self, other: 'KeyCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceStatusReason(): +class KeyIdentity(): """ - InstanceStatusReason. + Identifies a key by a unique property. - :attr str code: A snake case string succinctly identifying the status reason. - :attr str message: An explanation of the status reason. - :attr str more_info: (optional) Link to documentation about this status reason. + """ + + def __init__(self) -> None: + """ + Initialize a KeyIdentity object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['KeyIdentityById', 'KeyIdentityByCRN', 'KeyIdentityByHref', 'KeyIdentityByFingerprint'])) + raise Exception(msg) + +class KeyPatch(): + """ + KeyPatch. + + :attr str name: (optional) The user-defined name for this key. """ def __init__(self, - code: str, - message: str, *, - more_info: str = None) -> None: + name: str = None) -> None: """ - Initialize a InstanceStatusReason object. + Initialize a KeyPatch object. - :param str code: A snake case string succinctly identifying the status - reason. - :param str message: An explanation of the status reason. - :param str more_info: (optional) Link to documentation about this status - reason. + :param str name: (optional) The user-defined name for this key. """ - self.code = code - self.message = message - self.more_info = more_info + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceStatusReason': - """Initialize a InstanceStatusReason object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'KeyPatch': + """Initialize a KeyPatch object from a json dictionary.""" args = {} - if 'code' in _dict: - args['code'] = _dict.get('code') - else: - raise ValueError('Required property \'code\' not present in InstanceStatusReason JSON') - if 'message' in _dict: - args['message'] = _dict.get('message') - else: - raise ValueError('Required property \'message\' not present in InstanceStatusReason JSON') - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') + if 'name' in _dict: + args['name'] = _dict.get('name') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceStatusReason object from a json dictionary.""" + """Initialize a KeyPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'code') and self.code is not None: - _dict['code'] = self.code - if hasattr(self, 'message') and self.message is not None: - _dict['message'] = self.message - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -35530,263 +39679,111 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceStatusReason object.""" + """Return a `str` version of this KeyPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceStatusReason') -> bool: + def __eq__(self, other: 'KeyPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceStatusReason') -> bool: + def __ne__(self, other: 'KeyPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class CodeEnum(str, Enum): - """ - A snake case string succinctly identifying the status reason. - """ - CANNOT_START = 'cannot_start' - CANNOT_START_CAPACITY = 'cannot_start_capacity' - CANNOT_START_COMPUTE = 'cannot_start_compute' - CANNOT_START_IP_ADDRESS = 'cannot_start_ip_address' - CANNOT_START_NETWORK = 'cannot_start_network' - CANNOT_START_PLACEMENT_GROUP = 'cannot_start_placement_group' - CANNOT_START_STORAGE = 'cannot_start_storage' - ENCRYPTION_KEY_DELETED = 'encryption_key_deleted' - STOPPED_BY_HOST_FAILURE = 'stopped_by_host_failure' - STOPPED_FOR_IMAGE_CREATION = 'stopped_for_image_creation' - - -class InstanceTemplate(): +class KeyReference(): """ - InstanceTemplate. + KeyReference. - :attr InstanceAvailabilityPrototype availability_policy: (optional) The - availability policy to use for this virtual server instance. - :attr datetime created_at: The date and time that the instance template was - created. - :attr str crn: The CRN for this instance template. - :attr InstanceDefaultTrustedProfilePrototype default_trusted_profile: (optional) - The default trusted profile configuration to use for this virtual server - instance - This property's value is used when provisioning the virtual server instance, but - not - subsequently managed. Accordingly, it is reflected as an [instance - initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) - property. - :attr str href: The URL for this instance template. - :attr str id: The unique identifier for this instance template. - :attr List[KeyIdentity] keys: (optional) The public SSH keys for the - administrative user of the virtual server instance. Keys will be made available - to the virtual server instance as cloud-init vendor data. For cloud-init enabled - images, these keys will also be added as SSH authorized keys for the - administrative user. - For Windows images, at least one key must be specified, and one will be chosen - to encrypt [the administrator - password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys - are optional for other images, but if no keys are specified, the instance will - be inaccessible unless the specified image provides another means of access. - This property's value is used when provisioning the virtual server instance, but - not subsequently managed. Accordingly, it is reflected as an [instance - initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) - property. - :attr InstanceMetadataServicePrototype metadata_service: (optional) The metadata - service configuration. - :attr str name: The unique user-defined name for this instance template. - :attr List[NetworkInterfacePrototype] network_interfaces: (optional) The - additional network interfaces to create for the virtual server instance. - :attr InstancePlacementTargetPrototype placement_target: (optional) The - placement restrictions to use for the virtual server instance. - :attr InstanceProfileIdentity profile: (optional) The profile to use for this - virtual server instance. If unspecified, `bx2-2x8` will - be used, but this default value is expected to change in the future. - :attr ResourceGroupReference resource_group: The resource group for this - instance template. - :attr int total_volume_bandwidth: (optional) The amount of bandwidth (in - megabits per second) allocated exclusively to instance storage volumes. An - increase in this value will result in a corresponding decrease to - `total_network_bandwidth`. - :attr str user_data: (optional) User data to be made available when setting up - the virtual server instance. - :attr List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: - (optional) The volume attachments for this virtual server instance. - :attr VPCIdentity vpc: (optional) The VPC the virtual server instance is to be a - part of. If specified, it must match - the VPC referenced by the subnets of the instance's network interfaces. + :attr str crn: The CRN for this key. + :attr KeyReferenceDeleted deleted: (optional) If present, this property + indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str fingerprint: The fingerprint for this key. The value is returned + base64-encoded and prefixed with the hash algorithm (always `SHA256`). + :attr str href: The URL for this key. + :attr str id: The unique identifier for this key. + :attr str name: The user-defined name for this key. """ def __init__(self, - created_at: datetime, crn: str, + fingerprint: str, href: str, id: str, name: str, - resource_group: 'ResourceGroupReference', - *, - availability_policy: 'InstanceAvailabilityPrototype' = None, - default_trusted_profile: 'InstanceDefaultTrustedProfilePrototype' = None, - keys: List['KeyIdentity'] = None, - metadata_service: 'InstanceMetadataServicePrototype' = None, - network_interfaces: List['NetworkInterfacePrototype'] = None, - placement_target: 'InstancePlacementTargetPrototype' = None, - profile: 'InstanceProfileIdentity' = None, - total_volume_bandwidth: int = None, - user_data: str = None, - volume_attachments: List['VolumeAttachmentPrototypeInstanceContext'] = None, - vpc: 'VPCIdentity' = None) -> None: - """ - Initialize a InstanceTemplate object. - - :param datetime created_at: The date and time that the instance template - was created. - :param str crn: The CRN for this instance template. - :param str href: The URL for this instance template. - :param str id: The unique identifier for this instance template. - :param str name: The unique user-defined name for this instance template. - :param ResourceGroupReference resource_group: The resource group for this - instance template. - :param InstanceAvailabilityPrototype availability_policy: (optional) The - availability policy to use for this virtual server instance. - :param InstanceDefaultTrustedProfilePrototype default_trusted_profile: - (optional) The default trusted profile configuration to use for this - virtual server instance - This property's value is used when provisioning the virtual server - instance, but not - subsequently managed. Accordingly, it is reflected as an [instance - initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) - property. - :param List[KeyIdentity] keys: (optional) The public SSH keys for the - administrative user of the virtual server instance. Keys will be made - available to the virtual server instance as cloud-init vendor data. For - cloud-init enabled images, these keys will also be added as SSH authorized - keys for the administrative user. - For Windows images, at least one key must be specified, and one will be - chosen to encrypt [the administrator - password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). - Keys are optional for other images, but if no keys are specified, the - instance will be inaccessible unless the specified image provides another - means of access. - This property's value is used when provisioning the virtual server - instance, but not subsequently managed. Accordingly, it is reflected as an - [instance - initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) - property. - :param InstanceMetadataServicePrototype metadata_service: (optional) The - metadata service configuration. - :param List[NetworkInterfacePrototype] network_interfaces: (optional) The - additional network interfaces to create for the virtual server instance. - :param InstancePlacementTargetPrototype placement_target: (optional) The - placement restrictions to use for the virtual server instance. - :param InstanceProfileIdentity profile: (optional) The profile to use for - this virtual server instance. If unspecified, `bx2-2x8` will - be used, but this default value is expected to change in the future. - :param int total_volume_bandwidth: (optional) The amount of bandwidth (in - megabits per second) allocated exclusively to instance storage volumes. An - increase in this value will result in a corresponding decrease to - `total_network_bandwidth`. - :param str user_data: (optional) User data to be made available when - setting up the virtual server instance. - :param List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: - (optional) The volume attachments for this virtual server instance. - :param VPCIdentity vpc: (optional) The VPC the virtual server instance is - to be a part of. If specified, it must match - the VPC referenced by the subnets of the instance's network interfaces. - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstanceTemplateInstanceByImage', 'InstanceTemplateInstanceBySourceSnapshot'])) - raise Exception(msg) - -class InstanceTemplateCollection(): - """ - InstanceTemplateCollection. - - :attr InstanceTemplateCollectionFirst first: A link to the first page of - resources. - :attr int limit: The maximum number of resources that can be returned by the - request. - :attr InstanceTemplateCollectionNext next: (optional) A link to the next page of - resources. This property is present for all pages - except the last page. - :attr List[InstanceTemplate] templates: Collection of instance templates. - :attr int total_count: The total number of resources across all pages. - """ - - def __init__(self, - first: 'InstanceTemplateCollectionFirst', - limit: int, - templates: List['InstanceTemplate'], - total_count: int, *, - next: 'InstanceTemplateCollectionNext' = None) -> None: + deleted: 'KeyReferenceDeleted' = None) -> None: """ - Initialize a InstanceTemplateCollection object. + Initialize a KeyReference object. - :param InstanceTemplateCollectionFirst first: A link to the first page of - resources. - :param int limit: The maximum number of resources that can be returned by - the request. - :param List[InstanceTemplate] templates: Collection of instance templates. - :param int total_count: The total number of resources across all pages. - :param InstanceTemplateCollectionNext next: (optional) A link to the next - page of resources. This property is present for all pages - except the last page. + :param str crn: The CRN for this key. + :param str fingerprint: The fingerprint for this key. The value is + returned base64-encoded and prefixed with the hash algorithm (always + `SHA256`). + :param str href: The URL for this key. + :param str id: The unique identifier for this key. + :param str name: The user-defined name for this key. + :param KeyReferenceDeleted deleted: (optional) If present, this property + indicates the referenced resource has been deleted and provides + some supplementary information. """ - self.first = first - self.limit = limit - self.next = next - self.templates = templates - self.total_count = total_count + self.crn = crn + self.deleted = deleted + self.fingerprint = fingerprint + self.href = href + self.id = id + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceTemplateCollection': - """Initialize a InstanceTemplateCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'KeyReference': + """Initialize a KeyReference object from a json dictionary.""" args = {} - if 'first' in _dict: - args['first'] = InstanceTemplateCollectionFirst.from_dict(_dict.get('first')) + if 'crn' in _dict: + args['crn'] = _dict.get('crn') else: - raise ValueError('Required property \'first\' not present in InstanceTemplateCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') + raise ValueError('Required property \'crn\' not present in KeyReference JSON') + if 'deleted' in _dict: + args['deleted'] = KeyReferenceDeleted.from_dict(_dict.get('deleted')) + if 'fingerprint' in _dict: + args['fingerprint'] = _dict.get('fingerprint') else: - raise ValueError('Required property \'limit\' not present in InstanceTemplateCollection JSON') - if 'next' in _dict: - args['next'] = InstanceTemplateCollectionNext.from_dict(_dict.get('next')) - if 'templates' in _dict: - args['templates'] = _dict.get('templates') + raise ValueError('Required property \'fingerprint\' not present in KeyReference JSON') + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'templates\' not present in InstanceTemplateCollection JSON') - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') + raise ValueError('Required property \'href\' not present in KeyReference JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') else: - raise ValueError('Required property \'total_count\' not present in InstanceTemplateCollection JSON') + raise ValueError('Required property \'id\' not present in KeyReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in KeyReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceTemplateCollection object from a json dictionary.""" + """Initialize a KeyReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'templates') and self.templates is not None: - templates_list = [] - for x in self.templates: - if isinstance(x, dict): - templates_list.append(x) - else: - templates_list.append(x.to_dict()) - _dict['templates'] = templates_list - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() + if hasattr(self, 'fingerprint') and self.fingerprint is not None: + _dict['fingerprint'] = self.fingerprint + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -35794,55 +39791,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceTemplateCollection object.""" + """Return a `str` version of this KeyReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceTemplateCollection') -> bool: + def __eq__(self, other: 'KeyReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceTemplateCollection') -> bool: + def __ne__(self, other: 'KeyReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceTemplateCollectionFirst(): +class KeyReferenceDeleted(): """ - A link to the first page of resources. + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. - :attr str href: The URL for a page of resources. + :attr str more_info: Link to documentation about deleted resources. """ def __init__(self, - href: str) -> None: + more_info: str) -> None: """ - Initialize a InstanceTemplateCollectionFirst object. + Initialize a KeyReferenceDeleted object. - :param str href: The URL for a page of resources. + :param str more_info: Link to documentation about deleted resources. """ - self.href = href + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceTemplateCollectionFirst': - """Initialize a InstanceTemplateCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'KeyReferenceDeleted': + """Initialize a KeyReferenceDeleted object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'href\' not present in InstanceTemplateCollectionFirst JSON') + raise ValueError('Required property \'more_info\' not present in KeyReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceTemplateCollectionFirst object from a json dictionary.""" + """Initialize a KeyReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -35850,56 +39848,71 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceTemplateCollectionFirst object.""" + """Return a `str` version of this KeyReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceTemplateCollectionFirst') -> bool: + def __eq__(self, other: 'KeyReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceTemplateCollectionFirst') -> bool: + def __ne__(self, other: 'KeyReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceTemplateCollectionNext(): +class LegacyCloudObjectStorageBucketIdentity(): """ - A link to the next page of resources. This property is present for all pages except - the last page. + Identifies a Cloud Object Storage bucket by a unique property. - :attr str href: The URL for a page of resources. + """ + + def __init__(self) -> None: + """ + Initialize a LegacyCloudObjectStorageBucketIdentity object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName'])) + raise Exception(msg) + +class LegacyCloudObjectStorageBucketReference(): + """ + LegacyCloudObjectStorageBucketReference. + + :attr str name: The globally unique name of this Cloud Object Storage bucket. """ def __init__(self, - href: str) -> None: + name: str) -> None: """ - Initialize a InstanceTemplateCollectionNext object. + Initialize a LegacyCloudObjectStorageBucketReference object. - :param str href: The URL for a page of resources. + :param str name: The globally unique name of this Cloud Object Storage + bucket. """ - self.href = href + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceTemplateCollectionNext': - """Initialize a InstanceTemplateCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LegacyCloudObjectStorageBucketReference': + """Initialize a LegacyCloudObjectStorageBucketReference object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') + if 'name' in _dict: + args['name'] = _dict.get('name') else: - raise ValueError('Required property \'href\' not present in InstanceTemplateCollectionNext JSON') + raise ValueError('Required property \'name\' not present in LegacyCloudObjectStorageBucketReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceTemplateCollectionNext object from a json dictionary.""" + """Initialize a LegacyCloudObjectStorageBucketReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -35907,71 +39920,296 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceTemplateCollectionNext object.""" + """Return a `str` version of this LegacyCloudObjectStorageBucketReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceTemplateCollectionNext') -> bool: + def __eq__(self, other: 'LegacyCloudObjectStorageBucketReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceTemplateCollectionNext') -> bool: + def __ne__(self, other: 'LegacyCloudObjectStorageBucketReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceTemplateIdentity(): - """ - Identifies an instance template by a unique property. - - """ - - def __init__(self) -> None: - """ - Initialize a InstanceTemplateIdentity object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstanceTemplateIdentityById', 'InstanceTemplateIdentityByHref', 'InstanceTemplateIdentityByCRN'])) - raise Exception(msg) - -class InstanceTemplatePatch(): +class LoadBalancer(): """ - InstanceTemplatePatch. + LoadBalancer. - :attr str name: (optional) The unique user-defined name for this instance - template. + :attr datetime created_at: The date and time that this load balancer was + created. + :attr str crn: The load balancer's CRN. + :attr str hostname: Fully qualified domain name assigned to this load balancer. + :attr str href: The load balancer's canonical URL. + :attr str id: The unique identifier for this load balancer. + :attr bool is_public: The type of this load balancer, public or private. + :attr List[LoadBalancerListenerReference] listeners: The listeners of this load + balancer. + :attr LoadBalancerLogging logging: The logging configuration for this load + balancer. + :attr str name: The unique user-defined name for this load balancer. + :attr str operating_status: The operating status of this load balancer. + :attr List[LoadBalancerPoolReference] pools: The pools of this load balancer. + :attr List[LoadBalancerPrivateIpsItem] private_ips: The private IP addresses + assigned to this load balancer. + :attr LoadBalancerProfileReference profile: The profile for this load balancer. + :attr str provisioning_status: The provisioning status of this load balancer. + :attr List[IP] public_ips: The public IP addresses assigned to this load + balancer. + Applicable only for public load balancers. + :attr ResourceGroupReference resource_group: The resource group for this load + balancer. + :attr str resource_type: The resource type. + :attr bool route_mode: Indicates whether route mode is enabled for this load + balancer. + At present, public load balancers are not supported with route mode enabled. + :attr List[SecurityGroupReference] security_groups: The security groups + targeting this load balancer. + Applicable only for load balancers that support security groups. + :attr bool security_groups_supported: Indicates whether this load balancer + supports security groups. + :attr List[SubnetReference] subnets: The subnets this load balancer is part of. + :attr bool udp_supported: Indicates whether this load balancer supports UDP. """ def __init__(self, - *, - name: str = None) -> None: + created_at: datetime, + crn: str, + hostname: str, + href: str, + id: str, + is_public: bool, + listeners: List['LoadBalancerListenerReference'], + logging: 'LoadBalancerLogging', + name: str, + operating_status: str, + pools: List['LoadBalancerPoolReference'], + private_ips: List['LoadBalancerPrivateIpsItem'], + profile: 'LoadBalancerProfileReference', + provisioning_status: str, + public_ips: List['IP'], + resource_group: 'ResourceGroupReference', + resource_type: str, + route_mode: bool, + security_groups: List['SecurityGroupReference'], + security_groups_supported: bool, + subnets: List['SubnetReference'], + udp_supported: bool) -> None: """ - Initialize a InstanceTemplatePatch object. + Initialize a LoadBalancer object. - :param str name: (optional) The unique user-defined name for this instance - template. + :param datetime created_at: The date and time that this load balancer was + created. + :param str crn: The load balancer's CRN. + :param str hostname: Fully qualified domain name assigned to this load + balancer. + :param str href: The load balancer's canonical URL. + :param str id: The unique identifier for this load balancer. + :param bool is_public: The type of this load balancer, public or private. + :param List[LoadBalancerListenerReference] listeners: The listeners of this + load balancer. + :param LoadBalancerLogging logging: The logging configuration for this load + balancer. + :param str name: The unique user-defined name for this load balancer. + :param str operating_status: The operating status of this load balancer. + :param List[LoadBalancerPoolReference] pools: The pools of this load + balancer. + :param List[LoadBalancerPrivateIpsItem] private_ips: The private IP + addresses assigned to this load balancer. + :param LoadBalancerProfileReference profile: The profile for this load + balancer. + :param str provisioning_status: The provisioning status of this load + balancer. + :param List[IP] public_ips: The public IP addresses assigned to this load + balancer. + Applicable only for public load balancers. + :param ResourceGroupReference resource_group: The resource group for this + load balancer. + :param str resource_type: The resource type. + :param bool route_mode: Indicates whether route mode is enabled for this + load balancer. + At present, public load balancers are not supported with route mode + enabled. + :param List[SecurityGroupReference] security_groups: The security groups + targeting this load balancer. + Applicable only for load balancers that support security groups. + :param bool security_groups_supported: Indicates whether this load balancer + supports security groups. + :param List[SubnetReference] subnets: The subnets this load balancer is + part of. + :param bool udp_supported: Indicates whether this load balancer supports + UDP. """ + self.created_at = created_at + self.crn = crn + self.hostname = hostname + self.href = href + self.id = id + self.is_public = is_public + self.listeners = listeners + self.logging = logging self.name = name + self.operating_status = operating_status + self.pools = pools + self.private_ips = private_ips + self.profile = profile + self.provisioning_status = provisioning_status + self.public_ips = public_ips + self.resource_group = resource_group + self.resource_type = resource_type + self.route_mode = route_mode + self.security_groups = security_groups + self.security_groups_supported = security_groups_supported + self.subnets = subnets + self.udp_supported = udp_supported @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceTemplatePatch': - """Initialize a InstanceTemplatePatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancer': + """Initialize a LoadBalancer object from a json dictionary.""" args = {} + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) + else: + raise ValueError('Required property \'created_at\' not present in LoadBalancer JSON') + if 'crn' in _dict: + args['crn'] = _dict.get('crn') + else: + raise ValueError('Required property \'crn\' not present in LoadBalancer JSON') + if 'hostname' in _dict: + args['hostname'] = _dict.get('hostname') + else: + raise ValueError('Required property \'hostname\' not present in LoadBalancer JSON') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in LoadBalancer JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in LoadBalancer JSON') + if 'is_public' in _dict: + args['is_public'] = _dict.get('is_public') + else: + raise ValueError('Required property \'is_public\' not present in LoadBalancer JSON') + if 'listeners' in _dict: + args['listeners'] = [LoadBalancerListenerReference.from_dict(x) for x in _dict.get('listeners')] + else: + raise ValueError('Required property \'listeners\' not present in LoadBalancer JSON') + if 'logging' in _dict: + args['logging'] = LoadBalancerLogging.from_dict(_dict.get('logging')) + else: + raise ValueError('Required property \'logging\' not present in LoadBalancer JSON') if 'name' in _dict: args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in LoadBalancer JSON') + if 'operating_status' in _dict: + args['operating_status'] = _dict.get('operating_status') + else: + raise ValueError('Required property \'operating_status\' not present in LoadBalancer JSON') + if 'pools' in _dict: + args['pools'] = [LoadBalancerPoolReference.from_dict(x) for x in _dict.get('pools')] + else: + raise ValueError('Required property \'pools\' not present in LoadBalancer JSON') + if 'private_ips' in _dict: + args['private_ips'] = [LoadBalancerPrivateIpsItem.from_dict(x) for x in _dict.get('private_ips')] + else: + raise ValueError('Required property \'private_ips\' not present in LoadBalancer JSON') + if 'profile' in _dict: + args['profile'] = LoadBalancerProfileReference.from_dict(_dict.get('profile')) + else: + raise ValueError('Required property \'profile\' not present in LoadBalancer JSON') + if 'provisioning_status' in _dict: + args['provisioning_status'] = _dict.get('provisioning_status') + else: + raise ValueError('Required property \'provisioning_status\' not present in LoadBalancer JSON') + if 'public_ips' in _dict: + args['public_ips'] = [IP.from_dict(x) for x in _dict.get('public_ips')] + else: + raise ValueError('Required property \'public_ips\' not present in LoadBalancer JSON') + if 'resource_group' in _dict: + args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) + else: + raise ValueError('Required property \'resource_group\' not present in LoadBalancer JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in LoadBalancer JSON') + if 'route_mode' in _dict: + args['route_mode'] = _dict.get('route_mode') + else: + raise ValueError('Required property \'route_mode\' not present in LoadBalancer JSON') + if 'security_groups' in _dict: + args['security_groups'] = [SecurityGroupReference.from_dict(x) for x in _dict.get('security_groups')] + else: + raise ValueError('Required property \'security_groups\' not present in LoadBalancer JSON') + if 'security_groups_supported' in _dict: + args['security_groups_supported'] = _dict.get('security_groups_supported') + else: + raise ValueError('Required property \'security_groups_supported\' not present in LoadBalancer JSON') + if 'subnets' in _dict: + args['subnets'] = [SubnetReference.from_dict(x) for x in _dict.get('subnets')] + else: + raise ValueError('Required property \'subnets\' not present in LoadBalancer JSON') + if 'udp_supported' in _dict: + args['udp_supported'] = _dict.get('udp_supported') + else: + raise ValueError('Required property \'udp_supported\' not present in LoadBalancer JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceTemplatePatch object from a json dictionary.""" + """Initialize a LoadBalancer object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'hostname') and self.hostname is not None: + _dict['hostname'] = self.hostname + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'is_public') and self.is_public is not None: + _dict['is_public'] = self.is_public + if hasattr(self, 'listeners') and self.listeners is not None: + _dict['listeners'] = [x.to_dict() for x in self.listeners] + if hasattr(self, 'logging') and self.logging is not None: + _dict['logging'] = self.logging.to_dict() if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name + if hasattr(self, 'operating_status') and self.operating_status is not None: + _dict['operating_status'] = self.operating_status + if hasattr(self, 'pools') and self.pools is not None: + _dict['pools'] = [x.to_dict() for x in self.pools] + if hasattr(self, 'private_ips') and self.private_ips is not None: + _dict['private_ips'] = [x.to_dict() for x in self.private_ips] + if hasattr(self, 'profile') and self.profile is not None: + _dict['profile'] = self.profile.to_dict() + if hasattr(self, 'provisioning_status') and self.provisioning_status is not None: + _dict['provisioning_status'] = self.provisioning_status + if hasattr(self, 'public_ips') and self.public_ips is not None: + _dict['public_ips'] = [x.to_dict() for x in self.public_ips] + if hasattr(self, 'resource_group') and self.resource_group is not None: + _dict['resource_group'] = self.resource_group.to_dict() + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + if hasattr(self, 'route_mode') and self.route_mode is not None: + _dict['route_mode'] = self.route_mode + if hasattr(self, 'security_groups') and self.security_groups is not None: + _dict['security_groups'] = [x.to_dict() for x in self.security_groups] + if hasattr(self, 'security_groups_supported') and self.security_groups_supported is not None: + _dict['security_groups_supported'] = self.security_groups_supported + if hasattr(self, 'subnets') and self.subnets is not None: + _dict['subnets'] = [x.to_dict() for x in self.subnets] + if hasattr(self, 'udp_supported') and self.udp_supported is not None: + _dict['udp_supported'] = self.udp_supported return _dict def _to_dict(self): @@ -35979,231 +40217,128 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceTemplatePatch object.""" + """Return a `str` version of this LoadBalancer object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceTemplatePatch') -> bool: + def __eq__(self, other: 'LoadBalancer') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceTemplatePatch') -> bool: + def __ne__(self, other: 'LoadBalancer') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceTemplatePrototype(): - """ - InstanceTemplatePrototype. + class OperatingStatusEnum(str, Enum): + """ + The operating status of this load balancer. + """ + OFFLINE = 'offline' + ONLINE = 'online' - :attr InstanceAvailabilityPrototype availability_policy: (optional) The - availability policy to use for this virtual server instance. - :attr InstanceDefaultTrustedProfilePrototype default_trusted_profile: (optional) - The default trusted profile configuration to use for this virtual server - instance - This property's value is used when provisioning the virtual server instance, but - not - subsequently managed. Accordingly, it is reflected as an [instance - initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) - property. - :attr List[KeyIdentity] keys: (optional) The public SSH keys for the - administrative user of the virtual server instance. Keys will be made available - to the virtual server instance as cloud-init vendor data. For cloud-init enabled - images, these keys will also be added as SSH authorized keys for the - administrative user. - For Windows images, at least one key must be specified, and one will be chosen - to encrypt [the administrator - password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys - are optional for other images, but if no keys are specified, the instance will - be inaccessible unless the specified image provides another means of access. - This property's value is used when provisioning the virtual server instance, but - not subsequently managed. Accordingly, it is reflected as an [instance - initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) - property. - :attr InstanceMetadataServicePrototype metadata_service: (optional) The metadata - service configuration. - :attr str name: (optional) The unique user-defined name for this virtual server - instance (and default system hostname). If unspecified, the name will be a - hyphenated list of randomly-selected words. - :attr List[NetworkInterfacePrototype] network_interfaces: (optional) The - additional network interfaces to create for the virtual server instance. - :attr InstancePlacementTargetPrototype placement_target: (optional) The - placement restrictions to use for the virtual server instance. - :attr InstanceProfileIdentity profile: (optional) The profile to use for this - virtual server instance. If unspecified, `bx2-2x8` will - be used, but this default value is expected to change in the future. - :attr ResourceGroupIdentity resource_group: (optional) The resource group to - use. If unspecified, the account's [default resource - group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - :attr int total_volume_bandwidth: (optional) The amount of bandwidth (in - megabits per second) allocated exclusively to instance storage volumes. An - increase in this value will result in a corresponding decrease to - `total_network_bandwidth`. - :attr str user_data: (optional) User data to be made available when setting up - the virtual server instance. - :attr List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: - (optional) The volume attachments for this virtual server instance. - :attr VPCIdentity vpc: (optional) The VPC the virtual server instance is to be a - part of. If specified, it must match - the VPC referenced by the subnets of the instance's network interfaces. - """ - def __init__(self, - *, - availability_policy: 'InstanceAvailabilityPrototype' = None, - default_trusted_profile: 'InstanceDefaultTrustedProfilePrototype' = None, - keys: List['KeyIdentity'] = None, - metadata_service: 'InstanceMetadataServicePrototype' = None, - name: str = None, - network_interfaces: List['NetworkInterfacePrototype'] = None, - placement_target: 'InstancePlacementTargetPrototype' = None, - profile: 'InstanceProfileIdentity' = None, - resource_group: 'ResourceGroupIdentity' = None, - total_volume_bandwidth: int = None, - user_data: str = None, - volume_attachments: List['VolumeAttachmentPrototypeInstanceContext'] = None, - vpc: 'VPCIdentity' = None) -> None: + class ProvisioningStatusEnum(str, Enum): """ - Initialize a InstanceTemplatePrototype object. + The provisioning status of this load balancer. + """ + ACTIVE = 'active' + CREATE_PENDING = 'create_pending' + DELETE_PENDING = 'delete_pending' + FAILED = 'failed' + MAINTENANCE_PENDING = 'maintenance_pending' + UPDATE_PENDING = 'update_pending' - :param InstanceAvailabilityPrototype availability_policy: (optional) The - availability policy to use for this virtual server instance. - :param InstanceDefaultTrustedProfilePrototype default_trusted_profile: - (optional) The default trusted profile configuration to use for this - virtual server instance - This property's value is used when provisioning the virtual server - instance, but not - subsequently managed. Accordingly, it is reflected as an [instance - initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) - property. - :param List[KeyIdentity] keys: (optional) The public SSH keys for the - administrative user of the virtual server instance. Keys will be made - available to the virtual server instance as cloud-init vendor data. For - cloud-init enabled images, these keys will also be added as SSH authorized - keys for the administrative user. - For Windows images, at least one key must be specified, and one will be - chosen to encrypt [the administrator - password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). - Keys are optional for other images, but if no keys are specified, the - instance will be inaccessible unless the specified image provides another - means of access. - This property's value is used when provisioning the virtual server - instance, but not subsequently managed. Accordingly, it is reflected as an - [instance - initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) - property. - :param InstanceMetadataServicePrototype metadata_service: (optional) The - metadata service configuration. - :param str name: (optional) The unique user-defined name for this virtual - server instance (and default system hostname). If unspecified, the name - will be a hyphenated list of randomly-selected words. - :param List[NetworkInterfacePrototype] network_interfaces: (optional) The - additional network interfaces to create for the virtual server instance. - :param InstancePlacementTargetPrototype placement_target: (optional) The - placement restrictions to use for the virtual server instance. - :param InstanceProfileIdentity profile: (optional) The profile to use for - this virtual server instance. If unspecified, `bx2-2x8` will - be used, but this default value is expected to change in the future. - :param ResourceGroupIdentity resource_group: (optional) The resource group - to use. If unspecified, the account's [default resource - group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is - used. - :param int total_volume_bandwidth: (optional) The amount of bandwidth (in - megabits per second) allocated exclusively to instance storage volumes. An - increase in this value will result in a corresponding decrease to - `total_network_bandwidth`. - :param str user_data: (optional) User data to be made available when - setting up the virtual server instance. - :param List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: - (optional) The volume attachments for this virtual server instance. - :param VPCIdentity vpc: (optional) The VPC the virtual server instance is - to be a part of. If specified, it must match - the VPC referenced by the subnets of the instance's network interfaces. + + class ResourceTypeEnum(str, Enum): """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['InstanceTemplatePrototypeInstanceByImage', 'InstanceTemplatePrototypeInstanceBySourceTemplate'])) - raise Exception(msg) + The resource type. + """ + LOAD_BALANCER = 'load_balancer' -class InstanceTemplateReference(): + +class LoadBalancerCollection(): """ - InstanceTemplateReference. + LoadBalancerCollection. - :attr str crn: The CRN for this instance template. - :attr InstanceTemplateReferenceDeleted deleted: (optional) If present, this - property indicates the referenced resource has been deleted and provides - some supplementary information. - :attr str href: The URL for this instance template. - :attr str id: The unique identifier for this instance template. - :attr str name: The unique user-defined name for this instance template. + :attr LoadBalancerCollectionFirst first: A link to the first page of resources. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr List[LoadBalancer] load_balancers: Collection of load balancers. + :attr LoadBalancerCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages + except the last page. + :attr int total_count: The total number of resources across all pages. """ def __init__(self, - crn: str, - href: str, - id: str, - name: str, + first: 'LoadBalancerCollectionFirst', + limit: int, + load_balancers: List['LoadBalancer'], + total_count: int, *, - deleted: 'InstanceTemplateReferenceDeleted' = None) -> None: + next: 'LoadBalancerCollectionNext' = None) -> None: """ - Initialize a InstanceTemplateReference object. + Initialize a LoadBalancerCollection object. - :param str crn: The CRN for this instance template. - :param str href: The URL for this instance template. - :param str id: The unique identifier for this instance template. - :param str name: The unique user-defined name for this instance template. - :param InstanceTemplateReferenceDeleted deleted: (optional) If present, - this property indicates the referenced resource has been deleted and - provides - some supplementary information. + :param LoadBalancerCollectionFirst first: A link to the first page of + resources. + :param int limit: The maximum number of resources that can be returned by + the request. + :param List[LoadBalancer] load_balancers: Collection of load balancers. + :param int total_count: The total number of resources across all pages. + :param LoadBalancerCollectionNext next: (optional) A link to the next page + of resources. This property is present for all pages + except the last page. """ - self.crn = crn - self.deleted = deleted - self.href = href - self.id = id - self.name = name + self.first = first + self.limit = limit + self.load_balancers = load_balancers + self.next = next + self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceTemplateReference': - """Initialize a InstanceTemplateReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerCollection': + """Initialize a LoadBalancerCollection object from a json dictionary.""" args = {} - if 'crn' in _dict: - args['crn'] = _dict.get('crn') + if 'first' in _dict: + args['first'] = LoadBalancerCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'crn\' not present in InstanceTemplateReference JSON') - if 'deleted' in _dict: - args['deleted'] = InstanceTemplateReferenceDeleted.from_dict(_dict.get('deleted')) - if 'href' in _dict: - args['href'] = _dict.get('href') + raise ValueError('Required property \'first\' not present in LoadBalancerCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') else: - raise ValueError('Required property \'href\' not present in InstanceTemplateReference JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') + raise ValueError('Required property \'limit\' not present in LoadBalancerCollection JSON') + if 'load_balancers' in _dict: + args['load_balancers'] = [LoadBalancer.from_dict(x) for x in _dict.get('load_balancers')] else: - raise ValueError('Required property \'id\' not present in InstanceTemplateReference JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') + raise ValueError('Required property \'load_balancers\' not present in LoadBalancerCollection JSON') + if 'next' in _dict: + args['next'] = LoadBalancerCollectionNext.from_dict(_dict.get('next')) + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') else: - raise ValueError('Required property \'name\' not present in InstanceTemplateReference JSON') + raise ValueError('Required property \'total_count\' not present in LoadBalancerCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceTemplateReference object from a json dictionary.""" + """Initialize a LoadBalancerCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'load_balancers') and self.load_balancers is not None: + _dict['load_balancers'] = [x.to_dict() for x in self.load_balancers] + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count return _dict def _to_dict(self): @@ -36211,56 +40346,55 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceTemplateReference object.""" + """Return a `str` version of this LoadBalancerCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceTemplateReference') -> bool: + def __eq__(self, other: 'LoadBalancerCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceTemplateReference') -> bool: + def __ne__(self, other: 'LoadBalancerCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceTemplateReferenceDeleted(): +class LoadBalancerCollectionFirst(): """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. + A link to the first page of resources. - :attr str more_info: Link to documentation about deleted resources. + :attr str href: The URL for a page of resources. """ def __init__(self, - more_info: str) -> None: + href: str) -> None: """ - Initialize a InstanceTemplateReferenceDeleted object. + Initialize a LoadBalancerCollectionFirst object. - :param str more_info: Link to documentation about deleted resources. + :param str href: The URL for a page of resources. """ - self.more_info = more_info + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceTemplateReferenceDeleted': - """Initialize a InstanceTemplateReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerCollectionFirst': + """Initialize a LoadBalancerCollectionFirst object from a json dictionary.""" args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'more_info\' not present in InstanceTemplateReferenceDeleted JSON') + raise ValueError('Required property \'href\' not present in LoadBalancerCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceTemplateReferenceDeleted object from a json dictionary.""" + """Initialize a LoadBalancerCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -36268,65 +40402,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceTemplateReferenceDeleted object.""" + """Return a `str` version of this LoadBalancerCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceTemplateReferenceDeleted') -> bool: + def __eq__(self, other: 'LoadBalancerCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceTemplateReferenceDeleted') -> bool: + def __ne__(self, other: 'LoadBalancerCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class InstanceVCPU(): +class LoadBalancerCollectionNext(): """ - The virtual server instance VCPU configuration. + A link to the next page of resources. This property is present for all pages except + the last page. - :attr str architecture: The VCPU architecture. - :attr int count: The number of VCPUs assigned. + :attr str href: The URL for a page of resources. """ def __init__(self, - architecture: str, - count: int) -> None: + href: str) -> None: """ - Initialize a InstanceVCPU object. + Initialize a LoadBalancerCollectionNext object. - :param str architecture: The VCPU architecture. - :param int count: The number of VCPUs assigned. + :param str href: The URL for a page of resources. """ - self.architecture = architecture - self.count = count + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'InstanceVCPU': - """Initialize a InstanceVCPU object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerCollectionNext': + """Initialize a LoadBalancerCollectionNext object from a json dictionary.""" args = {} - if 'architecture' in _dict: - args['architecture'] = _dict.get('architecture') - else: - raise ValueError('Required property \'architecture\' not present in InstanceVCPU JSON') - if 'count' in _dict: - args['count'] = _dict.get('count') + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'count\' not present in InstanceVCPU JSON') + raise ValueError('Required property \'href\' not present in LoadBalancerCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a InstanceVCPU object from a json dictionary.""" + """Initialize a LoadBalancerCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'architecture') and self.architecture is not None: - _dict['architecture'] = self.architecture - if hasattr(self, 'count') and self.count is not None: - _dict['count'] = self.count + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -36334,153 +40459,252 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this InstanceVCPU object.""" + """Return a `str` version of this LoadBalancerCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'InstanceVCPU') -> bool: + def __eq__(self, other: 'LoadBalancerCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'InstanceVCPU') -> bool: + def __ne__(self, other: 'LoadBalancerCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class Key(): +class LoadBalancerIdentity(): """ - Key. + Identifies a load balancer by a unique property. - :attr datetime created_at: The date and time that the key was created. - :attr str crn: The CRN for this key. - :attr str fingerprint: The fingerprint for this key. The value is returned - base64-encoded and prefixed with the hash algorithm (always `SHA256`). - :attr str href: The URL for this key. - :attr str id: The unique identifier for this key. - :attr int length: The length of this key (in bits). - :attr str name: The unique user-defined name for this key. If unspecified, the - name will be a hyphenated list of randomly-selected words. - :attr str public_key: The public SSH key, consisting of two space-separated - fields: the algorithm name, and the base64-encoded key. - :attr ResourceGroupReference resource_group: The resource group for this key. - :attr str type: The crypto-system used by this key. + """ + + def __init__(self) -> None: + """ + Initialize a LoadBalancerIdentity object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['LoadBalancerIdentityById', 'LoadBalancerIdentityByCRN', 'LoadBalancerIdentityByHref'])) + raise Exception(msg) + +class LoadBalancerListener(): + """ + LoadBalancerListener. + + :attr bool accept_proxy_protocol: If set to `true`, this listener will accept + and forward PROXY protocol information. Supported by load balancers in the + `application` family (otherwise always `false`). Additional restrictions: + - If this listener has `https_redirect` specified, its `accept_proxy_protocol` + value must + match the `accept_proxy_protocol` value of the `https_redirect` listener. + - If this listener is the target of another listener's `https_redirect`, its + `accept_proxy_protocol` value must match that listener's + `accept_proxy_protocol` value. + :attr CertificateInstanceReference certificate_instance: (optional) The + certificate instance used for SSL termination. It is applicable only to `https` + protocol. + :attr int connection_limit: (optional) The connection limit of the listener. + :attr datetime created_at: The date and time that this listener was created. + :attr LoadBalancerPoolReference default_pool: (optional) The default pool for + this listener. If absent, this listener has no default pool. + :attr str href: The listener's canonical URL. + :attr LoadBalancerListenerHTTPSRedirect https_redirect: (optional) If specified, + the target listener that requests are redirected to. + :attr str id: The unique identifier for this load balancer listener. + :attr List[LoadBalancerListenerPolicyReference] policies: (optional) The + policies for this listener. + :attr int port: The listener port number, or the inclusive lower bound of the + port range. + :attr int port_max: The inclusive upper bound of the range of ports used by this + listener. + At present, only load balancers in the `network` family support more than one + port per listener. + :attr int port_min: The inclusive lower bound of the range of ports used by this + listener. + At present, only load balancers in the `network` family support more than one + port per listener. + :attr str protocol: The listener protocol. Load balancers in the `network` + family support `tcp` and + `udp` (if `udp_supported` is `true`). Load balancers in the `application` family + support `tcp`, `http`, and `https`. Each listener in the load balancer must have + a unique `port` and `protocol` combination. + The enumerated values for this property are expected to expand in the future. + When processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the listener on which the unexpected + property value was encountered. + :attr str provisioning_status: The provisioning status of this listener. """ def __init__(self, + accept_proxy_protocol: bool, created_at: datetime, - crn: str, - fingerprint: str, href: str, id: str, - length: int, - name: str, - public_key: str, - resource_group: 'ResourceGroupReference', - type: str) -> None: + port: int, + port_max: int, + port_min: int, + protocol: str, + provisioning_status: str, + *, + certificate_instance: 'CertificateInstanceReference' = None, + connection_limit: int = None, + default_pool: 'LoadBalancerPoolReference' = None, + https_redirect: 'LoadBalancerListenerHTTPSRedirect' = None, + policies: List['LoadBalancerListenerPolicyReference'] = None) -> None: """ - Initialize a Key object. + Initialize a LoadBalancerListener object. - :param datetime created_at: The date and time that the key was created. - :param str crn: The CRN for this key. - :param str fingerprint: The fingerprint for this key. The value is - returned base64-encoded and prefixed with the hash algorithm (always - `SHA256`). - :param str href: The URL for this key. - :param str id: The unique identifier for this key. - :param int length: The length of this key (in bits). - :param str name: The unique user-defined name for this key. If unspecified, - the name will be a hyphenated list of randomly-selected words. - :param str public_key: The public SSH key, consisting of two - space-separated fields: the algorithm name, and the base64-encoded key. - :param ResourceGroupReference resource_group: The resource group for this - key. - :param str type: The crypto-system used by this key. + :param bool accept_proxy_protocol: If set to `true`, this listener will + accept and forward PROXY protocol information. Supported by load balancers + in the `application` family (otherwise always `false`). Additional + restrictions: + - If this listener has `https_redirect` specified, its + `accept_proxy_protocol` value must + match the `accept_proxy_protocol` value of the `https_redirect` listener. + - If this listener is the target of another listener's `https_redirect`, + its + `accept_proxy_protocol` value must match that listener's + `accept_proxy_protocol` value. + :param datetime created_at: The date and time that this listener was + created. + :param str href: The listener's canonical URL. + :param str id: The unique identifier for this load balancer listener. + :param int port: The listener port number, or the inclusive lower bound of + the port range. + :param int port_max: The inclusive upper bound of the range of ports used + by this listener. + At present, only load balancers in the `network` family support more than + one port per listener. + :param int port_min: The inclusive lower bound of the range of ports used + by this listener. + At present, only load balancers in the `network` family support more than + one port per listener. + :param str protocol: The listener protocol. Load balancers in the `network` + family support `tcp` and + `udp` (if `udp_supported` is `true`). Load balancers in the `application` + family support `tcp`, `http`, and `https`. Each listener in the load + balancer must have a unique `port` and `protocol` combination. + The enumerated values for this property are expected to expand in the + future. When processing this property, check for and log unknown values. + Optionally halt processing and surface the error, or bypass the listener on + which the unexpected property value was encountered. + :param str provisioning_status: The provisioning status of this listener. + :param CertificateInstanceReference certificate_instance: (optional) The + certificate instance used for SSL termination. It is applicable only to + `https` + protocol. + :param int connection_limit: (optional) The connection limit of the + listener. + :param LoadBalancerPoolReference default_pool: (optional) The default pool + for this listener. If absent, this listener has no default pool. + :param LoadBalancerListenerHTTPSRedirect https_redirect: (optional) If + specified, the target listener that requests are redirected to. + :param List[LoadBalancerListenerPolicyReference] policies: (optional) The + policies for this listener. """ + self.accept_proxy_protocol = accept_proxy_protocol + self.certificate_instance = certificate_instance + self.connection_limit = connection_limit self.created_at = created_at - self.crn = crn - self.fingerprint = fingerprint + self.default_pool = default_pool self.href = href + self.https_redirect = https_redirect self.id = id - self.length = length - self.name = name - self.public_key = public_key - self.resource_group = resource_group - self.type = type + self.policies = policies + self.port = port + self.port_max = port_max + self.port_min = port_min + self.protocol = protocol + self.provisioning_status = provisioning_status @classmethod - def from_dict(cls, _dict: Dict) -> 'Key': - """Initialize a Key object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerListener': + """Initialize a LoadBalancerListener object from a json dictionary.""" args = {} + if 'accept_proxy_protocol' in _dict: + args['accept_proxy_protocol'] = _dict.get('accept_proxy_protocol') + else: + raise ValueError('Required property \'accept_proxy_protocol\' not present in LoadBalancerListener JSON') + if 'certificate_instance' in _dict: + args['certificate_instance'] = CertificateInstanceReference.from_dict(_dict.get('certificate_instance')) + if 'connection_limit' in _dict: + args['connection_limit'] = _dict.get('connection_limit') if 'created_at' in _dict: args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError('Required property \'created_at\' not present in Key JSON') - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in Key JSON') - if 'fingerprint' in _dict: - args['fingerprint'] = _dict.get('fingerprint') - else: - raise ValueError('Required property \'fingerprint\' not present in Key JSON') + raise ValueError('Required property \'created_at\' not present in LoadBalancerListener JSON') + if 'default_pool' in _dict: + args['default_pool'] = LoadBalancerPoolReference.from_dict(_dict.get('default_pool')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in Key JSON') + raise ValueError('Required property \'href\' not present in LoadBalancerListener JSON') + if 'https_redirect' in _dict: + args['https_redirect'] = LoadBalancerListenerHTTPSRedirect.from_dict(_dict.get('https_redirect')) if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in Key JSON') - if 'length' in _dict: - args['length'] = _dict.get('length') + raise ValueError('Required property \'id\' not present in LoadBalancerListener JSON') + if 'policies' in _dict: + args['policies'] = [LoadBalancerListenerPolicyReference.from_dict(x) for x in _dict.get('policies')] + if 'port' in _dict: + args['port'] = _dict.get('port') else: - raise ValueError('Required property \'length\' not present in Key JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') + raise ValueError('Required property \'port\' not present in LoadBalancerListener JSON') + if 'port_max' in _dict: + args['port_max'] = _dict.get('port_max') else: - raise ValueError('Required property \'name\' not present in Key JSON') - if 'public_key' in _dict: - args['public_key'] = _dict.get('public_key') + raise ValueError('Required property \'port_max\' not present in LoadBalancerListener JSON') + if 'port_min' in _dict: + args['port_min'] = _dict.get('port_min') else: - raise ValueError('Required property \'public_key\' not present in Key JSON') - if 'resource_group' in _dict: - args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) + raise ValueError('Required property \'port_min\' not present in LoadBalancerListener JSON') + if 'protocol' in _dict: + args['protocol'] = _dict.get('protocol') else: - raise ValueError('Required property \'resource_group\' not present in Key JSON') - if 'type' in _dict: - args['type'] = _dict.get('type') + raise ValueError('Required property \'protocol\' not present in LoadBalancerListener JSON') + if 'provisioning_status' in _dict: + args['provisioning_status'] = _dict.get('provisioning_status') else: - raise ValueError('Required property \'type\' not present in Key JSON') + raise ValueError('Required property \'provisioning_status\' not present in LoadBalancerListener JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a Key object from a json dictionary.""" + """Initialize a LoadBalancerListener object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'accept_proxy_protocol') and self.accept_proxy_protocol is not None: + _dict['accept_proxy_protocol'] = self.accept_proxy_protocol + if hasattr(self, 'certificate_instance') and self.certificate_instance is not None: + _dict['certificate_instance'] = self.certificate_instance.to_dict() + if hasattr(self, 'connection_limit') and self.connection_limit is not None: + _dict['connection_limit'] = self.connection_limit if hasattr(self, 'created_at') and self.created_at is not None: _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - if hasattr(self, 'fingerprint') and self.fingerprint is not None: - _dict['fingerprint'] = self.fingerprint + if hasattr(self, 'default_pool') and self.default_pool is not None: + _dict['default_pool'] = self.default_pool.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href + if hasattr(self, 'https_redirect') and self.https_redirect is not None: + _dict['https_redirect'] = self.https_redirect.to_dict() if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id - if hasattr(self, 'length') and self.length is not None: - _dict['length'] = self.length - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'public_key') and self.public_key is not None: - _dict['public_key'] = self.public_key - if hasattr(self, 'resource_group') and self.resource_group is not None: - _dict['resource_group'] = self.resource_group.to_dict() - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type + if hasattr(self, 'policies') and self.policies is not None: + _dict['policies'] = [x.to_dict() for x in self.policies] + if hasattr(self, 'port') and self.port is not None: + _dict['port'] = self.port + if hasattr(self, 'port_max') and self.port_max is not None: + _dict['port_max'] = self.port_max + if hasattr(self, 'port_min') and self.port_min is not None: + _dict['port_min'] = self.port_min + if hasattr(self, 'protocol') and self.protocol is not None: + _dict['protocol'] = self.protocol + if hasattr(self, 'provisioning_status') and self.provisioning_status is not None: + _dict['provisioning_status'] = self.provisioning_status return _dict def _to_dict(self): @@ -36488,107 +40712,159 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this Key object.""" + """Return a `str` version of this LoadBalancerListener object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'Key') -> bool: + def __eq__(self, other: 'LoadBalancerListener') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'Key') -> bool: + def __ne__(self, other: 'LoadBalancerListener') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class TypeEnum(str, Enum): + class ProtocolEnum(str, Enum): """ - The crypto-system used by this key. + The listener protocol. Load balancers in the `network` family support `tcp` and + `udp` (if `udp_supported` is `true`). Load balancers in the `application` family + support `tcp`, `http`, and `https`. Each listener in the load balancer must have a + unique `port` and `protocol` combination. + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the listener on which the unexpected + property value was encountered. """ - RSA = 'rsa' + HTTP = 'http' + HTTPS = 'https' + TCP = 'tcp' + UDP = 'udp' -class KeyCollection(): + class ProvisioningStatusEnum(str, Enum): + """ + The provisioning status of this listener. + """ + ACTIVE = 'active' + CREATE_PENDING = 'create_pending' + DELETE_PENDING = 'delete_pending' + FAILED = 'failed' + MAINTENANCE_PENDING = 'maintenance_pending' + UPDATE_PENDING = 'update_pending' + + +class LoadBalancerListenerCollection(): """ - KeyCollection. + LoadBalancerListenerCollection. - :attr KeyCollectionFirst first: A link to the first page of resources. - :attr List[Key] keys: Collection of keys. - :attr int limit: The maximum number of resources that can be returned by the - request. - :attr KeyCollectionNext next: (optional) A link to the next page of resources. - This property is present for all pages - except the last page. - :attr int total_count: The total number of resources across all pages. + :attr List[LoadBalancerListener] listeners: Collection of listeners. """ def __init__(self, - first: 'KeyCollectionFirst', - keys: List['Key'], - limit: int, - total_count: int, + listeners: List['LoadBalancerListener']) -> None: + """ + Initialize a LoadBalancerListenerCollection object. + + :param List[LoadBalancerListener] listeners: Collection of listeners. + """ + self.listeners = listeners + + @classmethod + def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerCollection': + """Initialize a LoadBalancerListenerCollection object from a json dictionary.""" + args = {} + if 'listeners' in _dict: + args['listeners'] = [LoadBalancerListener.from_dict(x) for x in _dict.get('listeners')] + else: + raise ValueError('Required property \'listeners\' not present in LoadBalancerListenerCollection JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a LoadBalancerListenerCollection object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'listeners') and self.listeners is not None: + _dict['listeners'] = [x.to_dict() for x in self.listeners] + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this LoadBalancerListenerCollection object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'LoadBalancerListenerCollection') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'LoadBalancerListenerCollection') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class LoadBalancerListenerHTTPSRedirect(): + """ + LoadBalancerListenerHTTPSRedirect. + + :attr int http_status_code: The HTTP status code for this redirect. + :attr LoadBalancerListenerReference listener: + :attr str uri: (optional) The redirect relative target URI. + """ + + def __init__(self, + http_status_code: int, + listener: 'LoadBalancerListenerReference', *, - next: 'KeyCollectionNext' = None) -> None: + uri: str = None) -> None: """ - Initialize a KeyCollection object. + Initialize a LoadBalancerListenerHTTPSRedirect object. - :param KeyCollectionFirst first: A link to the first page of resources. - :param List[Key] keys: Collection of keys. - :param int limit: The maximum number of resources that can be returned by - the request. - :param int total_count: The total number of resources across all pages. - :param KeyCollectionNext next: (optional) A link to the next page of - resources. This property is present for all pages - except the last page. + :param int http_status_code: The HTTP status code for this redirect. + :param LoadBalancerListenerReference listener: + :param str uri: (optional) The redirect relative target URI. """ - self.first = first - self.keys = keys - self.limit = limit - self.next = next - self.total_count = total_count + self.http_status_code = http_status_code + self.listener = listener + self.uri = uri @classmethod - def from_dict(cls, _dict: Dict) -> 'KeyCollection': - """Initialize a KeyCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerHTTPSRedirect': + """Initialize a LoadBalancerListenerHTTPSRedirect object from a json dictionary.""" args = {} - if 'first' in _dict: - args['first'] = KeyCollectionFirst.from_dict(_dict.get('first')) - else: - raise ValueError('Required property \'first\' not present in KeyCollection JSON') - if 'keys' in _dict: - args['keys'] = [Key.from_dict(x) for x in _dict.get('keys')] - else: - raise ValueError('Required property \'keys\' not present in KeyCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') + if 'http_status_code' in _dict: + args['http_status_code'] = _dict.get('http_status_code') else: - raise ValueError('Required property \'limit\' not present in KeyCollection JSON') - if 'next' in _dict: - args['next'] = KeyCollectionNext.from_dict(_dict.get('next')) - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') + raise ValueError('Required property \'http_status_code\' not present in LoadBalancerListenerHTTPSRedirect JSON') + if 'listener' in _dict: + args['listener'] = LoadBalancerListenerReference.from_dict(_dict.get('listener')) else: - raise ValueError('Required property \'total_count\' not present in KeyCollection JSON') + raise ValueError('Required property \'listener\' not present in LoadBalancerListenerHTTPSRedirect JSON') + if 'uri' in _dict: + args['uri'] = _dict.get('uri') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a KeyCollection object from a json dictionary.""" + """Initialize a LoadBalancerListenerHTTPSRedirect object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'keys') and self.keys is not None: - _dict['keys'] = [x.to_dict() for x in self.keys] - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count + if hasattr(self, 'http_status_code') and self.http_status_code is not None: + _dict['http_status_code'] = self.http_status_code + if hasattr(self, 'listener') and self.listener is not None: + _dict['listener'] = self.listener.to_dict() + if hasattr(self, 'uri') and self.uri is not None: + _dict['uri'] = self.uri return _dict def _to_dict(self): @@ -36596,55 +40872,76 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this KeyCollection object.""" + """Return a `str` version of this LoadBalancerListenerHTTPSRedirect object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'KeyCollection') -> bool: + def __eq__(self, other: 'LoadBalancerListenerHTTPSRedirect') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'KeyCollection') -> bool: + def __ne__(self, other: 'LoadBalancerListenerHTTPSRedirect') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class KeyCollectionFirst(): +class LoadBalancerListenerHTTPSRedirectPatch(): """ - A link to the first page of resources. + LoadBalancerListenerHTTPSRedirectPatch. - :attr str href: The URL for a page of resources. + :attr int http_status_code: (optional) The HTTP status code for this redirect. + :attr LoadBalancerListenerIdentity listener: (optional) Identifies a load + balancer listener by a unique property. + :attr str uri: (optional) The redirect relative target URI. """ def __init__(self, - href: str) -> None: + *, + http_status_code: int = None, + listener: 'LoadBalancerListenerIdentity' = None, + uri: str = None) -> None: """ - Initialize a KeyCollectionFirst object. + Initialize a LoadBalancerListenerHTTPSRedirectPatch object. - :param str href: The URL for a page of resources. + :param int http_status_code: (optional) The HTTP status code for this + redirect. + :param LoadBalancerListenerIdentity listener: (optional) Identifies a load + balancer listener by a unique property. + :param str uri: (optional) The redirect relative target URI. """ - self.href = href + self.http_status_code = http_status_code + self.listener = listener + self.uri = uri @classmethod - def from_dict(cls, _dict: Dict) -> 'KeyCollectionFirst': - """Initialize a KeyCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerHTTPSRedirectPatch': + """Initialize a LoadBalancerListenerHTTPSRedirectPatch object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in KeyCollectionFirst JSON') + if 'http_status_code' in _dict: + args['http_status_code'] = _dict.get('http_status_code') + if 'listener' in _dict: + args['listener'] = _dict.get('listener') + if 'uri' in _dict: + args['uri'] = _dict.get('uri') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a KeyCollectionFirst object from a json dictionary.""" + """Initialize a LoadBalancerListenerHTTPSRedirectPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'http_status_code') and self.http_status_code is not None: + _dict['http_status_code'] = self.http_status_code + if hasattr(self, 'listener') and self.listener is not None: + if isinstance(self.listener, dict): + _dict['listener'] = self.listener + else: + _dict['listener'] = self.listener.to_dict() + if hasattr(self, 'uri') and self.uri is not None: + _dict['uri'] = self.uri return _dict def _to_dict(self): @@ -36652,56 +40949,79 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this KeyCollectionFirst object.""" + """Return a `str` version of this LoadBalancerListenerHTTPSRedirectPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'KeyCollectionFirst') -> bool: + def __eq__(self, other: 'LoadBalancerListenerHTTPSRedirectPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'KeyCollectionFirst') -> bool: + def __ne__(self, other: 'LoadBalancerListenerHTTPSRedirectPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class KeyCollectionNext(): +class LoadBalancerListenerHTTPSRedirectPrototype(): """ - A link to the next page of resources. This property is present for all pages except - the last page. + LoadBalancerListenerHTTPSRedirectPrototype. - :attr str href: The URL for a page of resources. + :attr int http_status_code: The HTTP status code for this redirect. + :attr LoadBalancerListenerIdentity listener: Identifies a load balancer listener + by a unique property. + :attr str uri: (optional) The redirect relative target URI. """ def __init__(self, - href: str) -> None: + http_status_code: int, + listener: 'LoadBalancerListenerIdentity', + *, + uri: str = None) -> None: """ - Initialize a KeyCollectionNext object. + Initialize a LoadBalancerListenerHTTPSRedirectPrototype object. - :param str href: The URL for a page of resources. + :param int http_status_code: The HTTP status code for this redirect. + :param LoadBalancerListenerIdentity listener: Identifies a load balancer + listener by a unique property. + :param str uri: (optional) The redirect relative target URI. """ - self.href = href + self.http_status_code = http_status_code + self.listener = listener + self.uri = uri @classmethod - def from_dict(cls, _dict: Dict) -> 'KeyCollectionNext': - """Initialize a KeyCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerHTTPSRedirectPrototype': + """Initialize a LoadBalancerListenerHTTPSRedirectPrototype object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') + if 'http_status_code' in _dict: + args['http_status_code'] = _dict.get('http_status_code') else: - raise ValueError('Required property \'href\' not present in KeyCollectionNext JSON') + raise ValueError('Required property \'http_status_code\' not present in LoadBalancerListenerHTTPSRedirectPrototype JSON') + if 'listener' in _dict: + args['listener'] = _dict.get('listener') + else: + raise ValueError('Required property \'listener\' not present in LoadBalancerListenerHTTPSRedirectPrototype JSON') + if 'uri' in _dict: + args['uri'] = _dict.get('uri') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a KeyCollectionNext object from a json dictionary.""" + """Initialize a LoadBalancerListenerHTTPSRedirectPrototype object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'http_status_code') and self.http_status_code is not None: + _dict['http_status_code'] = self.http_status_code + if hasattr(self, 'listener') and self.listener is not None: + if isinstance(self.listener, dict): + _dict['listener'] = self.listener + else: + _dict['listener'] = self.listener.to_dict() + if hasattr(self, 'uri') and self.uri is not None: + _dict['uri'] = self.uri return _dict def _to_dict(self): @@ -36709,69 +41029,236 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this KeyCollectionNext object.""" + """Return a `str` version of this LoadBalancerListenerHTTPSRedirectPrototype object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'KeyCollectionNext') -> bool: + def __eq__(self, other: 'LoadBalancerListenerHTTPSRedirectPrototype') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'KeyCollectionNext') -> bool: + def __ne__(self, other: 'LoadBalancerListenerHTTPSRedirectPrototype') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class KeyIdentity(): +class LoadBalancerListenerIdentity(): """ - Identifies a key by a unique property. + Identifies a load balancer listener by a unique property. """ def __init__(self) -> None: """ - Initialize a KeyIdentity object. + Initialize a LoadBalancerListenerIdentity object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['KeyIdentityById', 'KeyIdentityByCRN', 'KeyIdentityByHref', 'KeyIdentityByFingerprint'])) + ", ".join(['LoadBalancerListenerIdentityById', 'LoadBalancerListenerIdentityByHref'])) raise Exception(msg) -class KeyPatch(): +class LoadBalancerListenerPatch(): """ - KeyPatch. + LoadBalancerListenerPatch. - :attr str name: (optional) The user-defined name for this key. + :attr bool accept_proxy_protocol: (optional) If set to `true`, this listener + will accept and forward PROXY protocol information. Supported by load balancers + in the `application` family (otherwise always `false`). Additional restrictions: + - If this listener has `https_redirect` specified, its `accept_proxy_protocol` + value must + match the `accept_proxy_protocol` value of the `https_redirect` listener. + - If this listener is the target of another listener's `https_redirect`, its + `accept_proxy_protocol` value must match that listener's + `accept_proxy_protocol` value. + :attr CertificateInstanceIdentity certificate_instance: (optional) The + certificate instance used for SSL termination. It is applicable only to `https` + protocol. + :attr int connection_limit: (optional) The connection limit of the listener. + :attr LoadBalancerPoolIdentity default_pool: (optional) The default pool for + this listener. The specified pool must: + - Belong to this load balancer + - Have the same `protocol` as this listener, or have a compatible protocol. + At present, the compatible protocols are `http` and `https`. + - Not already be the `default_pool` for another listener + Specify `null` to remove an existing default pool. + :attr LoadBalancerListenerHTTPSRedirectPatch https_redirect: (optional) The + target listener that requests will be redirected to. This listener must have a + `protocol` of `http`, and the target listener must have a `protocol` of `https`. + Specify `null` to remove any existing https redirect. + :attr int port: (optional) The listener port number, or the inclusive lower + bound of the port range. Each listener in the load balancer must have a unique + `port` and `protocol` combination. + Not supported for load balancers operating with route mode enabled. + :attr int port_max: (optional) The inclusive upper bound of the range of ports + used by this listener. Must not be less than `port_min`. + At present, only load balancers operating with route mode enabled, and public + load balancers in the `network` family support different values for `port_min` + and + `port_max`. When route mode is enabled, the value `65535` must be specified. + The specified port range must not overlap with port ranges used by other + listeners for this load balancer using the same protocol. + :attr int port_min: (optional) The inclusive lower bound of the range of ports + used by this listener. Must not be greater than `port_max`. + At present, only load balancers operating with route mode enabled, and public + load balancers in the `network` family support different values for `port_min` + and + `port_max`. When route mode is enabled, the value `1` must be specified. + The specified port range must not overlap with port ranges used by other + listeners for this load balancer using the same protocol. + :attr str protocol: (optional) The listener protocol. Each listener in the load + balancer must have a unique `port` and `protocol` combination. Additional + restrictions: + - If this load balancer is in the `network` family, the protocol must be `tcp` + or `udp` (if `udp_supported` is `true`) , and it cannot be changed while + `default_pool` is set. + - If `https_redirect` is set, the protocol must be `http`. + - If this listener is a listener's `https_redirect` target, the protocol must be + `https`. """ def __init__(self, *, - name: str = None) -> None: + accept_proxy_protocol: bool = None, + certificate_instance: 'CertificateInstanceIdentity' = None, + connection_limit: int = None, + default_pool: 'LoadBalancerPoolIdentity' = None, + https_redirect: 'LoadBalancerListenerHTTPSRedirectPatch' = None, + port: int = None, + port_max: int = None, + port_min: int = None, + protocol: str = None) -> None: """ - Initialize a KeyPatch object. + Initialize a LoadBalancerListenerPatch object. - :param str name: (optional) The user-defined name for this key. + :param bool accept_proxy_protocol: (optional) If set to `true`, this + listener will accept and forward PROXY protocol information. Supported by + load balancers in the `application` family (otherwise always `false`). + Additional restrictions: + - If this listener has `https_redirect` specified, its + `accept_proxy_protocol` value must + match the `accept_proxy_protocol` value of the `https_redirect` listener. + - If this listener is the target of another listener's `https_redirect`, + its + `accept_proxy_protocol` value must match that listener's + `accept_proxy_protocol` value. + :param CertificateInstanceIdentity certificate_instance: (optional) The + certificate instance used for SSL termination. It is applicable only to + `https` + protocol. + :param int connection_limit: (optional) The connection limit of the + listener. + :param LoadBalancerPoolIdentity default_pool: (optional) The default pool + for this listener. The specified pool must: + - Belong to this load balancer + - Have the same `protocol` as this listener, or have a compatible protocol. + At present, the compatible protocols are `http` and `https`. + - Not already be the `default_pool` for another listener + Specify `null` to remove an existing default pool. + :param LoadBalancerListenerHTTPSRedirectPatch https_redirect: (optional) + The target listener that requests will be redirected to. This listener must + have a + `protocol` of `http`, and the target listener must have a `protocol` of + `https`. + Specify `null` to remove any existing https redirect. + :param int port: (optional) The listener port number, or the inclusive + lower bound of the port range. Each listener in the load balancer must have + a unique `port` and `protocol` combination. + Not supported for load balancers operating with route mode enabled. + :param int port_max: (optional) The inclusive upper bound of the range of + ports used by this listener. Must not be less than `port_min`. + At present, only load balancers operating with route mode enabled, and + public load balancers in the `network` family support different values for + `port_min` and + `port_max`. When route mode is enabled, the value `65535` must be + specified. + The specified port range must not overlap with port ranges used by other + listeners for this load balancer using the same protocol. + :param int port_min: (optional) The inclusive lower bound of the range of + ports used by this listener. Must not be greater than `port_max`. + At present, only load balancers operating with route mode enabled, and + public load balancers in the `network` family support different values for + `port_min` and + `port_max`. When route mode is enabled, the value `1` must be specified. + The specified port range must not overlap with port ranges used by other + listeners for this load balancer using the same protocol. + :param str protocol: (optional) The listener protocol. Each listener in the + load balancer must have a unique `port` and `protocol` combination. + Additional restrictions: + - If this load balancer is in the `network` family, the protocol must be + `tcp` + or `udp` (if `udp_supported` is `true`) , and it cannot be changed while + `default_pool` is set. + - If `https_redirect` is set, the protocol must be `http`. + - If this listener is a listener's `https_redirect` target, the protocol + must be + `https`. """ - self.name = name + self.accept_proxy_protocol = accept_proxy_protocol + self.certificate_instance = certificate_instance + self.connection_limit = connection_limit + self.default_pool = default_pool + self.https_redirect = https_redirect + self.port = port + self.port_max = port_max + self.port_min = port_min + self.protocol = protocol @classmethod - def from_dict(cls, _dict: Dict) -> 'KeyPatch': - """Initialize a KeyPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPatch': + """Initialize a LoadBalancerListenerPatch object from a json dictionary.""" args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') + if 'accept_proxy_protocol' in _dict: + args['accept_proxy_protocol'] = _dict.get('accept_proxy_protocol') + if 'certificate_instance' in _dict: + args['certificate_instance'] = _dict.get('certificate_instance') + if 'connection_limit' in _dict: + args['connection_limit'] = _dict.get('connection_limit') + if 'default_pool' in _dict: + args['default_pool'] = _dict.get('default_pool') + if 'https_redirect' in _dict: + args['https_redirect'] = LoadBalancerListenerHTTPSRedirectPatch.from_dict(_dict.get('https_redirect')) + if 'port' in _dict: + args['port'] = _dict.get('port') + if 'port_max' in _dict: + args['port_max'] = _dict.get('port_max') + if 'port_min' in _dict: + args['port_min'] = _dict.get('port_min') + if 'protocol' in _dict: + args['protocol'] = _dict.get('protocol') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a KeyPatch object from a json dictionary.""" + """Initialize a LoadBalancerListenerPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name + if hasattr(self, 'accept_proxy_protocol') and self.accept_proxy_protocol is not None: + _dict['accept_proxy_protocol'] = self.accept_proxy_protocol + if hasattr(self, 'certificate_instance') and self.certificate_instance is not None: + if isinstance(self.certificate_instance, dict): + _dict['certificate_instance'] = self.certificate_instance + else: + _dict['certificate_instance'] = self.certificate_instance.to_dict() + if hasattr(self, 'connection_limit') and self.connection_limit is not None: + _dict['connection_limit'] = self.connection_limit + if hasattr(self, 'default_pool') and self.default_pool is not None: + if isinstance(self.default_pool, dict): + _dict['default_pool'] = self.default_pool + else: + _dict['default_pool'] = self.default_pool.to_dict() + if hasattr(self, 'https_redirect') and self.https_redirect is not None: + _dict['https_redirect'] = self.https_redirect.to_dict() + if hasattr(self, 'port') and self.port is not None: + _dict['port'] = self.port + if hasattr(self, 'port_max') and self.port_max is not None: + _dict['port_max'] = self.port_max + if hasattr(self, 'port_min') and self.port_min is not None: + _dict['port_min'] = self.port_min + if hasattr(self, 'protocol') and self.protocol is not None: + _dict['protocol'] = self.protocol return _dict def _to_dict(self): @@ -36779,111 +41266,176 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this KeyPatch object.""" + """Return a `str` version of this LoadBalancerListenerPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'KeyPatch') -> bool: + def __eq__(self, other: 'LoadBalancerListenerPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'KeyPatch') -> bool: + def __ne__(self, other: 'LoadBalancerListenerPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class KeyReference(): + class ProtocolEnum(str, Enum): + """ + The listener protocol. Each listener in the load balancer must have a unique + `port` and `protocol` combination. Additional restrictions: + - If this load balancer is in the `network` family, the protocol must be `tcp` + or `udp` (if `udp_supported` is `true`) , and it cannot be changed while + `default_pool` is set. + - If `https_redirect` is set, the protocol must be `http`. + - If this listener is a listener's `https_redirect` target, the protocol must be + `https`. + """ + HTTP = 'http' + HTTPS = 'https' + TCP = 'tcp' + UDP = 'udp' + + +class LoadBalancerListenerPolicy(): """ - KeyReference. + LoadBalancerListenerPolicy. - :attr str crn: The CRN for this key. - :attr KeyReferenceDeleted deleted: (optional) If present, this property - indicates the referenced resource has been deleted and provides - some supplementary information. - :attr str fingerprint: The fingerprint for this key. The value is returned - base64-encoded and prefixed with the hash algorithm (always `SHA256`). - :attr str href: The URL for this key. - :attr str id: The unique identifier for this key. - :attr str name: The user-defined name for this key. + :attr str action: The policy action. + The enumerated values for this property are expected to expand in the future. + When processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the policy on which the unexpected + property value was encountered. + :attr datetime created_at: The date and time that this policy was created. + :attr str href: The listener policy's canonical URL. + :attr str id: The policy's unique identifier. + :attr str name: The user-defined name for this policy. + :attr int priority: Priority of the policy. Lower value indicates higher + priority. + :attr str provisioning_status: The provisioning status of this policy. + :attr List[LoadBalancerListenerPolicyRuleReference] rules: The rules for this + policy. + :attr LoadBalancerListenerPolicyTarget target: (optional) - If `action` is + `forward`, the response is a `LoadBalancerPoolReference` + - If `action` is `redirect`, the response is a + `LoadBalancerListenerPolicyRedirectURL` + - If `action` is `https_redirect`, the response is a + `LoadBalancerListenerHTTPSRedirect`. """ def __init__(self, - crn: str, - fingerprint: str, + action: str, + created_at: datetime, href: str, id: str, name: str, + priority: int, + provisioning_status: str, + rules: List['LoadBalancerListenerPolicyRuleReference'], *, - deleted: 'KeyReferenceDeleted' = None) -> None: + target: 'LoadBalancerListenerPolicyTarget' = None) -> None: """ - Initialize a KeyReference object. + Initialize a LoadBalancerListenerPolicy object. - :param str crn: The CRN for this key. - :param str fingerprint: The fingerprint for this key. The value is - returned base64-encoded and prefixed with the hash algorithm (always - `SHA256`). - :param str href: The URL for this key. - :param str id: The unique identifier for this key. - :param str name: The user-defined name for this key. - :param KeyReferenceDeleted deleted: (optional) If present, this property - indicates the referenced resource has been deleted and provides - some supplementary information. + :param str action: The policy action. + The enumerated values for this property are expected to expand in the + future. When processing this property, check for and log unknown values. + Optionally halt processing and surface the error, or bypass the policy on + which the unexpected property value was encountered. + :param datetime created_at: The date and time that this policy was created. + :param str href: The listener policy's canonical URL. + :param str id: The policy's unique identifier. + :param str name: The user-defined name for this policy. + :param int priority: Priority of the policy. Lower value indicates higher + priority. + :param str provisioning_status: The provisioning status of this policy. + :param List[LoadBalancerListenerPolicyRuleReference] rules: The rules for + this policy. + :param LoadBalancerListenerPolicyTarget target: (optional) - If `action` is + `forward`, the response is a `LoadBalancerPoolReference` + - If `action` is `redirect`, the response is a + `LoadBalancerListenerPolicyRedirectURL` + - If `action` is `https_redirect`, the response is a + `LoadBalancerListenerHTTPSRedirect`. """ - self.crn = crn - self.deleted = deleted - self.fingerprint = fingerprint + self.action = action + self.created_at = created_at self.href = href self.id = id self.name = name + self.priority = priority + self.provisioning_status = provisioning_status + self.rules = rules + self.target = target @classmethod - def from_dict(cls, _dict: Dict) -> 'KeyReference': - """Initialize a KeyReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPolicy': + """Initialize a LoadBalancerListenerPolicy object from a json dictionary.""" args = {} - if 'crn' in _dict: - args['crn'] = _dict.get('crn') + if 'action' in _dict: + args['action'] = _dict.get('action') else: - raise ValueError('Required property \'crn\' not present in KeyReference JSON') - if 'deleted' in _dict: - args['deleted'] = KeyReferenceDeleted.from_dict(_dict.get('deleted')) - if 'fingerprint' in _dict: - args['fingerprint'] = _dict.get('fingerprint') + raise ValueError('Required property \'action\' not present in LoadBalancerListenerPolicy JSON') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError('Required property \'fingerprint\' not present in KeyReference JSON') + raise ValueError('Required property \'created_at\' not present in LoadBalancerListenerPolicy JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in KeyReference JSON') + raise ValueError('Required property \'href\' not present in LoadBalancerListenerPolicy JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in KeyReference JSON') + raise ValueError('Required property \'id\' not present in LoadBalancerListenerPolicy JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in KeyReference JSON') + raise ValueError('Required property \'name\' not present in LoadBalancerListenerPolicy JSON') + if 'priority' in _dict: + args['priority'] = _dict.get('priority') + else: + raise ValueError('Required property \'priority\' not present in LoadBalancerListenerPolicy JSON') + if 'provisioning_status' in _dict: + args['provisioning_status'] = _dict.get('provisioning_status') + else: + raise ValueError('Required property \'provisioning_status\' not present in LoadBalancerListenerPolicy JSON') + if 'rules' in _dict: + args['rules'] = [LoadBalancerListenerPolicyRuleReference.from_dict(x) for x in _dict.get('rules')] + else: + raise ValueError('Required property \'rules\' not present in LoadBalancerListenerPolicy JSON') + if 'target' in _dict: + args['target'] = _dict.get('target') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a KeyReference object from a json dictionary.""" + """Initialize a LoadBalancerListenerPolicy object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() - if hasattr(self, 'fingerprint') and self.fingerprint is not None: - _dict['fingerprint'] = self.fingerprint + if hasattr(self, 'action') and self.action is not None: + _dict['action'] = self.action + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name + if hasattr(self, 'priority') and self.priority is not None: + _dict['priority'] = self.priority + if hasattr(self, 'provisioning_status') and self.provisioning_status is not None: + _dict['provisioning_status'] = self.provisioning_status + if hasattr(self, 'rules') and self.rules is not None: + _dict['rules'] = [x.to_dict() for x in self.rules] + if hasattr(self, 'target') and self.target is not None: + if isinstance(self.target, dict): + _dict['target'] = self.target + else: + _dict['target'] = self.target.to_dict() return _dict def _to_dict(self): @@ -36891,128 +41443,81 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this KeyReference object.""" + """Return a `str` version of this LoadBalancerListenerPolicy object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'KeyReference') -> bool: + def __eq__(self, other: 'LoadBalancerListenerPolicy') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'KeyReference') -> bool: + def __ne__(self, other: 'LoadBalancerListenerPolicy') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class KeyReferenceDeleted(): - """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. - - :attr str more_info: Link to documentation about deleted resources. - """ - - def __init__(self, - more_info: str) -> None: + class ActionEnum(str, Enum): """ - Initialize a KeyReferenceDeleted object. - - :param str more_info: Link to documentation about deleted resources. + The policy action. + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the policy on which the unexpected + property value was encountered. """ - self.more_info = more_info - - @classmethod - def from_dict(cls, _dict: Dict) -> 'KeyReferenceDeleted': - """Initialize a KeyReferenceDeleted object from a json dictionary.""" - args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') - else: - raise ValueError('Required property \'more_info\' not present in KeyReferenceDeleted JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a KeyReferenceDeleted object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this KeyReferenceDeleted object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'KeyReferenceDeleted') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'KeyReferenceDeleted') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - -class LegacyCloudObjectStorageBucketIdentity(): - """ - Identifies a Cloud Object Storage bucket by a unique property. + FORWARD = 'forward' + HTTPS_REDIRECT = 'https_redirect' + REDIRECT = 'redirect' + REJECT = 'reject' - """ - def __init__(self) -> None: + class ProvisioningStatusEnum(str, Enum): """ - Initialize a LegacyCloudObjectStorageBucketIdentity object. - + The provisioning status of this policy. """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName'])) - raise Exception(msg) + ACTIVE = 'active' + CREATE_PENDING = 'create_pending' + DELETE_PENDING = 'delete_pending' + FAILED = 'failed' + MAINTENANCE_PENDING = 'maintenance_pending' + UPDATE_PENDING = 'update_pending' -class LegacyCloudObjectStorageBucketReference(): + +class LoadBalancerListenerPolicyCollection(): """ - LegacyCloudObjectStorageBucketReference. + LoadBalancerListenerPolicyCollection. - :attr str name: The globally unique name of this Cloud Object Storage bucket. + :attr List[LoadBalancerListenerPolicy] policies: Collection of policies. """ def __init__(self, - name: str) -> None: + policies: List['LoadBalancerListenerPolicy']) -> None: """ - Initialize a LegacyCloudObjectStorageBucketReference object. + Initialize a LoadBalancerListenerPolicyCollection object. - :param str name: The globally unique name of this Cloud Object Storage - bucket. + :param List[LoadBalancerListenerPolicy] policies: Collection of policies. """ - self.name = name + self.policies = policies @classmethod - def from_dict(cls, _dict: Dict) -> 'LegacyCloudObjectStorageBucketReference': - """Initialize a LegacyCloudObjectStorageBucketReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPolicyCollection': + """Initialize a LoadBalancerListenerPolicyCollection object from a json dictionary.""" args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') + if 'policies' in _dict: + args['policies'] = [LoadBalancerListenerPolicy.from_dict(x) for x in _dict.get('policies')] else: - raise ValueError('Required property \'name\' not present in LegacyCloudObjectStorageBucketReference JSON') + raise ValueError('Required property \'policies\' not present in LoadBalancerListenerPolicyCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LegacyCloudObjectStorageBucketReference object from a json dictionary.""" + """Initialize a LoadBalancerListenerPolicyCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name + if hasattr(self, 'policies') and self.policies is not None: + _dict['policies'] = [x.to_dict() for x in self.policies] return _dict def _to_dict(self): @@ -37020,296 +41525,87 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LegacyCloudObjectStorageBucketReference object.""" + """Return a `str` version of this LoadBalancerListenerPolicyCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LegacyCloudObjectStorageBucketReference') -> bool: + def __eq__(self, other: 'LoadBalancerListenerPolicyCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LegacyCloudObjectStorageBucketReference') -> bool: + def __ne__(self, other: 'LoadBalancerListenerPolicyCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancer(): +class LoadBalancerListenerPolicyPatch(): """ - LoadBalancer. + LoadBalancerListenerPolicyPatch. - :attr datetime created_at: The date and time that this load balancer was - created. - :attr str crn: The load balancer's CRN. - :attr str hostname: Fully qualified domain name assigned to this load balancer. - :attr str href: The load balancer's canonical URL. - :attr str id: The unique identifier for this load balancer. - :attr bool is_public: The type of this load balancer, public or private. - :attr List[LoadBalancerListenerReference] listeners: The listeners of this load - balancer. - :attr LoadBalancerLogging logging: The logging configuration for this load - balancer. - :attr str name: The unique user-defined name for this load balancer. - :attr str operating_status: The operating status of this load balancer. - :attr List[LoadBalancerPoolReference] pools: The pools of this load balancer. - :attr List[LoadBalancerPrivateIpsItem] private_ips: The private IP addresses - assigned to this load balancer. - :attr LoadBalancerProfileReference profile: The profile for this load balancer. - :attr str provisioning_status: The provisioning status of this load balancer. - :attr List[IP] public_ips: The public IP addresses assigned to this load - balancer. - Applicable only for public load balancers. - :attr ResourceGroupReference resource_group: The resource group for this load - balancer. - :attr str resource_type: The resource type. - :attr bool route_mode: Indicates whether route mode is enabled for this load - balancer. - At present, public load balancers are not supported with route mode enabled. - :attr List[SecurityGroupReference] security_groups: The security groups - targeting this load balancer. - Applicable only for load balancers that support security groups. - :attr bool security_groups_supported: Indicates whether this load balancer - supports security groups. - :attr List[SubnetReference] subnets: The subnets this load balancer is part of. - :attr bool udp_supported: Indicates whether this load balancer supports UDP. + :attr str name: (optional) The user-defined name for this policy. Names must be + unique within the load balancer listener the policy resides in. + :attr int priority: (optional) Priority of the policy. Lower value indicates + higher priority. + :attr LoadBalancerListenerPolicyTargetPatch target: (optional) - If `action` is + `forward`, specify a `LoadBalancerPoolIdentity`. + - If `action` is `redirect`, specify a + `LoadBalancerListenerPolicyRedirectURLPatch`. + - If `action` is `https_redirect`, specify a + `LoadBalancerListenerPolicyHTTPSRedirectPatch`. """ def __init__(self, - created_at: datetime, - crn: str, - hostname: str, - href: str, - id: str, - is_public: bool, - listeners: List['LoadBalancerListenerReference'], - logging: 'LoadBalancerLogging', - name: str, - operating_status: str, - pools: List['LoadBalancerPoolReference'], - private_ips: List['LoadBalancerPrivateIpsItem'], - profile: 'LoadBalancerProfileReference', - provisioning_status: str, - public_ips: List['IP'], - resource_group: 'ResourceGroupReference', - resource_type: str, - route_mode: bool, - security_groups: List['SecurityGroupReference'], - security_groups_supported: bool, - subnets: List['SubnetReference'], - udp_supported: bool) -> None: + *, + name: str = None, + priority: int = None, + target: 'LoadBalancerListenerPolicyTargetPatch' = None) -> None: """ - Initialize a LoadBalancer object. + Initialize a LoadBalancerListenerPolicyPatch object. - :param datetime created_at: The date and time that this load balancer was - created. - :param str crn: The load balancer's CRN. - :param str hostname: Fully qualified domain name assigned to this load - balancer. - :param str href: The load balancer's canonical URL. - :param str id: The unique identifier for this load balancer. - :param bool is_public: The type of this load balancer, public or private. - :param List[LoadBalancerListenerReference] listeners: The listeners of this - load balancer. - :param LoadBalancerLogging logging: The logging configuration for this load - balancer. - :param str name: The unique user-defined name for this load balancer. - :param str operating_status: The operating status of this load balancer. - :param List[LoadBalancerPoolReference] pools: The pools of this load - balancer. - :param List[LoadBalancerPrivateIpsItem] private_ips: The private IP - addresses assigned to this load balancer. - :param LoadBalancerProfileReference profile: The profile for this load - balancer. - :param str provisioning_status: The provisioning status of this load - balancer. - :param List[IP] public_ips: The public IP addresses assigned to this load - balancer. - Applicable only for public load balancers. - :param ResourceGroupReference resource_group: The resource group for this - load balancer. - :param str resource_type: The resource type. - :param bool route_mode: Indicates whether route mode is enabled for this - load balancer. - At present, public load balancers are not supported with route mode - enabled. - :param List[SecurityGroupReference] security_groups: The security groups - targeting this load balancer. - Applicable only for load balancers that support security groups. - :param bool security_groups_supported: Indicates whether this load balancer - supports security groups. - :param List[SubnetReference] subnets: The subnets this load balancer is - part of. - :param bool udp_supported: Indicates whether this load balancer supports - UDP. + :param str name: (optional) The user-defined name for this policy. Names + must be unique within the load balancer listener the policy resides in. + :param int priority: (optional) Priority of the policy. Lower value + indicates higher priority. + :param LoadBalancerListenerPolicyTargetPatch target: (optional) - If + `action` is `forward`, specify a `LoadBalancerPoolIdentity`. + - If `action` is `redirect`, specify a + `LoadBalancerListenerPolicyRedirectURLPatch`. + - If `action` is `https_redirect`, specify a + `LoadBalancerListenerPolicyHTTPSRedirectPatch`. """ - self.created_at = created_at - self.crn = crn - self.hostname = hostname - self.href = href - self.id = id - self.is_public = is_public - self.listeners = listeners - self.logging = logging self.name = name - self.operating_status = operating_status - self.pools = pools - self.private_ips = private_ips - self.profile = profile - self.provisioning_status = provisioning_status - self.public_ips = public_ips - self.resource_group = resource_group - self.resource_type = resource_type - self.route_mode = route_mode - self.security_groups = security_groups - self.security_groups_supported = security_groups_supported - self.subnets = subnets - self.udp_supported = udp_supported + self.priority = priority + self.target = target @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancer': - """Initialize a LoadBalancer object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPolicyPatch': + """Initialize a LoadBalancerListenerPolicyPatch object from a json dictionary.""" args = {} - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - else: - raise ValueError('Required property \'created_at\' not present in LoadBalancer JSON') - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in LoadBalancer JSON') - if 'hostname' in _dict: - args['hostname'] = _dict.get('hostname') - else: - raise ValueError('Required property \'hostname\' not present in LoadBalancer JSON') - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in LoadBalancer JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in LoadBalancer JSON') - if 'is_public' in _dict: - args['is_public'] = _dict.get('is_public') - else: - raise ValueError('Required property \'is_public\' not present in LoadBalancer JSON') - if 'listeners' in _dict: - args['listeners'] = [LoadBalancerListenerReference.from_dict(x) for x in _dict.get('listeners')] - else: - raise ValueError('Required property \'listeners\' not present in LoadBalancer JSON') - if 'logging' in _dict: - args['logging'] = LoadBalancerLogging.from_dict(_dict.get('logging')) - else: - raise ValueError('Required property \'logging\' not present in LoadBalancer JSON') if 'name' in _dict: args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in LoadBalancer JSON') - if 'operating_status' in _dict: - args['operating_status'] = _dict.get('operating_status') - else: - raise ValueError('Required property \'operating_status\' not present in LoadBalancer JSON') - if 'pools' in _dict: - args['pools'] = [LoadBalancerPoolReference.from_dict(x) for x in _dict.get('pools')] - else: - raise ValueError('Required property \'pools\' not present in LoadBalancer JSON') - if 'private_ips' in _dict: - args['private_ips'] = [LoadBalancerPrivateIpsItem.from_dict(x) for x in _dict.get('private_ips')] - else: - raise ValueError('Required property \'private_ips\' not present in LoadBalancer JSON') - if 'profile' in _dict: - args['profile'] = LoadBalancerProfileReference.from_dict(_dict.get('profile')) - else: - raise ValueError('Required property \'profile\' not present in LoadBalancer JSON') - if 'provisioning_status' in _dict: - args['provisioning_status'] = _dict.get('provisioning_status') - else: - raise ValueError('Required property \'provisioning_status\' not present in LoadBalancer JSON') - if 'public_ips' in _dict: - args['public_ips'] = [IP.from_dict(x) for x in _dict.get('public_ips')] - else: - raise ValueError('Required property \'public_ips\' not present in LoadBalancer JSON') - if 'resource_group' in _dict: - args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) - else: - raise ValueError('Required property \'resource_group\' not present in LoadBalancer JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in LoadBalancer JSON') - if 'route_mode' in _dict: - args['route_mode'] = _dict.get('route_mode') - else: - raise ValueError('Required property \'route_mode\' not present in LoadBalancer JSON') - if 'security_groups' in _dict: - args['security_groups'] = [SecurityGroupReference.from_dict(x) for x in _dict.get('security_groups')] - else: - raise ValueError('Required property \'security_groups\' not present in LoadBalancer JSON') - if 'security_groups_supported' in _dict: - args['security_groups_supported'] = _dict.get('security_groups_supported') - else: - raise ValueError('Required property \'security_groups_supported\' not present in LoadBalancer JSON') - if 'subnets' in _dict: - args['subnets'] = [SubnetReference.from_dict(x) for x in _dict.get('subnets')] - else: - raise ValueError('Required property \'subnets\' not present in LoadBalancer JSON') - if 'udp_supported' in _dict: - args['udp_supported'] = _dict.get('udp_supported') - else: - raise ValueError('Required property \'udp_supported\' not present in LoadBalancer JSON') + if 'priority' in _dict: + args['priority'] = _dict.get('priority') + if 'target' in _dict: + args['target'] = _dict.get('target') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancer object from a json dictionary.""" + """Initialize a LoadBalancerListenerPolicyPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - if hasattr(self, 'hostname') and self.hostname is not None: - _dict['hostname'] = self.hostname - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'is_public') and self.is_public is not None: - _dict['is_public'] = self.is_public - if hasattr(self, 'listeners') and self.listeners is not None: - _dict['listeners'] = [x.to_dict() for x in self.listeners] - if hasattr(self, 'logging') and self.logging is not None: - _dict['logging'] = self.logging.to_dict() if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'operating_status') and self.operating_status is not None: - _dict['operating_status'] = self.operating_status - if hasattr(self, 'pools') and self.pools is not None: - _dict['pools'] = [x.to_dict() for x in self.pools] - if hasattr(self, 'private_ips') and self.private_ips is not None: - _dict['private_ips'] = [x.to_dict() for x in self.private_ips] - if hasattr(self, 'profile') and self.profile is not None: - _dict['profile'] = self.profile.to_dict() - if hasattr(self, 'provisioning_status') and self.provisioning_status is not None: - _dict['provisioning_status'] = self.provisioning_status - if hasattr(self, 'public_ips') and self.public_ips is not None: - _dict['public_ips'] = [x.to_dict() for x in self.public_ips] - if hasattr(self, 'resource_group') and self.resource_group is not None: - _dict['resource_group'] = self.resource_group.to_dict() - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type - if hasattr(self, 'route_mode') and self.route_mode is not None: - _dict['route_mode'] = self.route_mode - if hasattr(self, 'security_groups') and self.security_groups is not None: - _dict['security_groups'] = [x.to_dict() for x in self.security_groups] - if hasattr(self, 'security_groups_supported') and self.security_groups_supported is not None: - _dict['security_groups_supported'] = self.security_groups_supported - if hasattr(self, 'subnets') and self.subnets is not None: - _dict['subnets'] = [x.to_dict() for x in self.subnets] - if hasattr(self, 'udp_supported') and self.udp_supported is not None: - _dict['udp_supported'] = self.udp_supported + if hasattr(self, 'priority') and self.priority is not None: + _dict['priority'] = self.priority + if hasattr(self, 'target') and self.target is not None: + if isinstance(self.target, dict): + _dict['target'] = self.target + else: + _dict['target'] = self.target.to_dict() return _dict def _to_dict(self): @@ -37317,128 +41613,117 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancer object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'LoadBalancer') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'LoadBalancer') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - - class OperatingStatusEnum(str, Enum): - """ - The operating status of this load balancer. - """ - OFFLINE = 'offline' - ONLINE = 'online' - - - class ProvisioningStatusEnum(str, Enum): - """ - The provisioning status of this load balancer. - """ - ACTIVE = 'active' - CREATE_PENDING = 'create_pending' - DELETE_PENDING = 'delete_pending' - FAILED = 'failed' - MAINTENANCE_PENDING = 'maintenance_pending' - UPDATE_PENDING = 'update_pending' - + """Return a `str` version of this LoadBalancerListenerPolicyPatch object.""" + return json.dumps(self.to_dict(), indent=2) - class ResourceTypeEnum(str, Enum): - """ - The resource type. - """ - LOAD_BALANCER = 'load_balancer' + def __eq__(self, other: 'LoadBalancerListenerPolicyPatch') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + def __ne__(self, other: 'LoadBalancerListenerPolicyPatch') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other -class LoadBalancerCollection(): +class LoadBalancerListenerPolicyPrototype(): """ - LoadBalancerCollection. + LoadBalancerListenerPolicyPrototype. - :attr LoadBalancerCollectionFirst first: A link to the first page of resources. - :attr int limit: The maximum number of resources that can be returned by the - request. - :attr List[LoadBalancer] load_balancers: Collection of load balancers. - :attr LoadBalancerCollectionNext next: (optional) A link to the next page of - resources. This property is present for all pages - except the last page. - :attr int total_count: The total number of resources across all pages. + :attr str action: The policy action. + The enumerated values for this property are expected to expand in the future. + When processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the policy on which the unexpected + property value was encountered. + :attr str name: (optional) The user-defined name for this policy. Names must be + unique within the load balancer listener the policy resides in. + :attr int priority: Priority of the policy. Lower value indicates higher + priority. + :attr List[LoadBalancerListenerPolicyRulePrototype] rules: (optional) The rule + prototype objects for this policy. + :attr LoadBalancerListenerPolicyTargetPrototype target: (optional) - If `action` + is `forward`, specify a `LoadBalancerPoolIdentity`. + - If `action` is `redirect`, specify a + `LoadBalancerListenerPolicyRedirectURLPrototype`. + - If `action` is `https_redirect`, specify a + `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. """ def __init__(self, - first: 'LoadBalancerCollectionFirst', - limit: int, - load_balancers: List['LoadBalancer'], - total_count: int, + action: str, + priority: int, *, - next: 'LoadBalancerCollectionNext' = None) -> None: + name: str = None, + rules: List['LoadBalancerListenerPolicyRulePrototype'] = None, + target: 'LoadBalancerListenerPolicyTargetPrototype' = None) -> None: """ - Initialize a LoadBalancerCollection object. + Initialize a LoadBalancerListenerPolicyPrototype object. - :param LoadBalancerCollectionFirst first: A link to the first page of - resources. - :param int limit: The maximum number of resources that can be returned by - the request. - :param List[LoadBalancer] load_balancers: Collection of load balancers. - :param int total_count: The total number of resources across all pages. - :param LoadBalancerCollectionNext next: (optional) A link to the next page - of resources. This property is present for all pages - except the last page. + :param str action: The policy action. + The enumerated values for this property are expected to expand in the + future. When processing this property, check for and log unknown values. + Optionally halt processing and surface the error, or bypass the policy on + which the unexpected property value was encountered. + :param int priority: Priority of the policy. Lower value indicates higher + priority. + :param str name: (optional) The user-defined name for this policy. Names + must be unique within the load balancer listener the policy resides in. + :param List[LoadBalancerListenerPolicyRulePrototype] rules: (optional) The + rule prototype objects for this policy. + :param LoadBalancerListenerPolicyTargetPrototype target: (optional) - If + `action` is `forward`, specify a `LoadBalancerPoolIdentity`. + - If `action` is `redirect`, specify a + `LoadBalancerListenerPolicyRedirectURLPrototype`. + - If `action` is `https_redirect`, specify a + `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. """ - self.first = first - self.limit = limit - self.load_balancers = load_balancers - self.next = next - self.total_count = total_count + self.action = action + self.name = name + self.priority = priority + self.rules = rules + self.target = target @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerCollection': - """Initialize a LoadBalancerCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPolicyPrototype': + """Initialize a LoadBalancerListenerPolicyPrototype object from a json dictionary.""" args = {} - if 'first' in _dict: - args['first'] = LoadBalancerCollectionFirst.from_dict(_dict.get('first')) - else: - raise ValueError('Required property \'first\' not present in LoadBalancerCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') - else: - raise ValueError('Required property \'limit\' not present in LoadBalancerCollection JSON') - if 'load_balancers' in _dict: - args['load_balancers'] = [LoadBalancer.from_dict(x) for x in _dict.get('load_balancers')] + if 'action' in _dict: + args['action'] = _dict.get('action') else: - raise ValueError('Required property \'load_balancers\' not present in LoadBalancerCollection JSON') - if 'next' in _dict: - args['next'] = LoadBalancerCollectionNext.from_dict(_dict.get('next')) - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') + raise ValueError('Required property \'action\' not present in LoadBalancerListenerPolicyPrototype JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + if 'priority' in _dict: + args['priority'] = _dict.get('priority') else: - raise ValueError('Required property \'total_count\' not present in LoadBalancerCollection JSON') + raise ValueError('Required property \'priority\' not present in LoadBalancerListenerPolicyPrototype JSON') + if 'rules' in _dict: + args['rules'] = [LoadBalancerListenerPolicyRulePrototype.from_dict(x) for x in _dict.get('rules')] + if 'target' in _dict: + args['target'] = _dict.get('target') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerCollection object from a json dictionary.""" + """Initialize a LoadBalancerListenerPolicyPrototype object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'load_balancers') and self.load_balancers is not None: - _dict['load_balancers'] = [x.to_dict() for x in self.load_balancers] - if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count + if hasattr(self, 'action') and self.action is not None: + _dict['action'] = self.action + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'priority') and self.priority is not None: + _dict['priority'] = self.priority + if hasattr(self, 'rules') and self.rules is not None: + _dict['rules'] = [x.to_dict() for x in self.rules] + if hasattr(self, 'target') and self.target is not None: + if isinstance(self.target, dict): + _dict['target'] = self.target + else: + _dict['target'] = self.target.to_dict() return _dict def _to_dict(self): @@ -37446,55 +41731,93 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerCollection object.""" + """Return a `str` version of this LoadBalancerListenerPolicyPrototype object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerCollection') -> bool: + def __eq__(self, other: 'LoadBalancerListenerPolicyPrototype') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerCollection') -> bool: + def __ne__(self, other: 'LoadBalancerListenerPolicyPrototype') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerCollectionFirst(): + class ActionEnum(str, Enum): + """ + The policy action. + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the policy on which the unexpected + property value was encountered. + """ + FORWARD = 'forward' + HTTPS_REDIRECT = 'https_redirect' + REDIRECT = 'redirect' + REJECT = 'reject' + + +class LoadBalancerListenerPolicyReference(): """ - A link to the first page of resources. + LoadBalancerListenerPolicyReference. - :attr str href: The URL for a page of resources. + :attr LoadBalancerListenerPolicyReferenceDeleted deleted: (optional) If present, + this property indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str href: The listener policy's canonical URL. + :attr str id: The policy's unique identifier. """ def __init__(self, - href: str) -> None: + href: str, + id: str, + *, + deleted: 'LoadBalancerListenerPolicyReferenceDeleted' = None) -> None: """ - Initialize a LoadBalancerCollectionFirst object. + Initialize a LoadBalancerListenerPolicyReference object. - :param str href: The URL for a page of resources. + :param str href: The listener policy's canonical URL. + :param str id: The policy's unique identifier. + :param LoadBalancerListenerPolicyReferenceDeleted deleted: (optional) If + present, this property indicates the referenced resource has been deleted + and provides + some supplementary information. """ + self.deleted = deleted self.href = href + self.id = id @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerCollectionFirst': - """Initialize a LoadBalancerCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPolicyReference': + """Initialize a LoadBalancerListenerPolicyReference object from a json dictionary.""" args = {} + if 'deleted' in _dict: + args['deleted'] = LoadBalancerListenerPolicyReferenceDeleted.from_dict(_dict.get('deleted')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in LoadBalancerCollectionFirst JSON') + raise ValueError('Required property \'href\' not present in LoadBalancerListenerPolicyReference JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in LoadBalancerListenerPolicyReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerCollectionFirst object from a json dictionary.""" + """Initialize a LoadBalancerListenerPolicyReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id return _dict def _to_dict(self): @@ -37502,56 +41825,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerCollectionFirst object.""" + """Return a `str` version of this LoadBalancerListenerPolicyReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerCollectionFirst') -> bool: + def __eq__(self, other: 'LoadBalancerListenerPolicyReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerCollectionFirst') -> bool: + def __ne__(self, other: 'LoadBalancerListenerPolicyReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerCollectionNext(): +class LoadBalancerListenerPolicyReferenceDeleted(): """ - A link to the next page of resources. This property is present for all pages except - the last page. + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. - :attr str href: The URL for a page of resources. + :attr str more_info: Link to documentation about deleted resources. """ def __init__(self, - href: str) -> None: + more_info: str) -> None: """ - Initialize a LoadBalancerCollectionNext object. + Initialize a LoadBalancerListenerPolicyReferenceDeleted object. - :param str href: The URL for a page of resources. + :param str more_info: Link to documentation about deleted resources. """ - self.href = href + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerCollectionNext': - """Initialize a LoadBalancerCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPolicyReferenceDeleted': + """Initialize a LoadBalancerListenerPolicyReferenceDeleted object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'href\' not present in LoadBalancerCollectionNext JSON') + raise ValueError('Required property \'more_info\' not present in LoadBalancerListenerPolicyReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerCollectionNext object from a json dictionary.""" + """Initialize a LoadBalancerListenerPolicyReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -37559,252 +41882,144 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerCollectionNext object.""" + """Return a `str` version of this LoadBalancerListenerPolicyReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerCollectionNext') -> bool: + def __eq__(self, other: 'LoadBalancerListenerPolicyReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerCollectionNext') -> bool: + def __ne__(self, other: 'LoadBalancerListenerPolicyReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerIdentity(): - """ - Identifies a load balancer by a unique property. - - """ - - def __init__(self) -> None: - """ - Initialize a LoadBalancerIdentity object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['LoadBalancerIdentityById', 'LoadBalancerIdentityByCRN', 'LoadBalancerIdentityByHref'])) - raise Exception(msg) - -class LoadBalancerListener(): +class LoadBalancerListenerPolicyRule(): """ - LoadBalancerListener. + LoadBalancerListenerPolicyRule. - :attr bool accept_proxy_protocol: If set to `true`, this listener will accept - and forward PROXY protocol information. Supported by load balancers in the - `application` family (otherwise always `false`). Additional restrictions: - - If this listener has `https_redirect` specified, its `accept_proxy_protocol` - value must - match the `accept_proxy_protocol` value of the `https_redirect` listener. - - If this listener is the target of another listener's `https_redirect`, its - `accept_proxy_protocol` value must match that listener's - `accept_proxy_protocol` value. - :attr CertificateInstanceReference certificate_instance: (optional) The - certificate instance used for SSL termination. It is applicable only to `https` - protocol. - :attr int connection_limit: (optional) The connection limit of the listener. - :attr datetime created_at: The date and time that this listener was created. - :attr LoadBalancerPoolReference default_pool: (optional) The default pool for - this listener. If absent, this listener has no default pool. - :attr str href: The listener's canonical URL. - :attr LoadBalancerListenerHTTPSRedirect https_redirect: (optional) If specified, - the target listener that requests are redirected to. - :attr str id: The unique identifier for this load balancer listener. - :attr List[LoadBalancerListenerPolicyReference] policies: (optional) The - policies for this listener. - :attr int port: The listener port number, or the inclusive lower bound of the - port range. - :attr int port_max: The inclusive upper bound of the range of ports used by this - listener. - At present, only load balancers in the `network` family support more than one - port per listener. - :attr int port_min: The inclusive lower bound of the range of ports used by this - listener. - At present, only load balancers in the `network` family support more than one - port per listener. - :attr str protocol: The listener protocol. Load balancers in the `network` - family support `tcp` and - `udp` (if `udp_supported` is `true`). Load balancers in the `application` family - support `tcp`, `http`, and `https`. Each listener in the load balancer must have - a unique `port` and `protocol` combination. - The enumerated values for this property are expected to expand in the future. - When processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the listener on which the unexpected - property value was encountered. - :attr str provisioning_status: The provisioning status of this listener. + :attr str condition: The condition of the rule. + :attr datetime created_at: The date and time that this rule was created. + :attr str field: (optional) The field. This is applicable to `header`, `query`, + and `body` rule types. + If the rule type is `header`, this property is required. + If the rule type is `query`, this is optional. If specified and the rule + condition is not + `matches_regex`, the value must be percent-encoded. + If the rule type is `body`, this is optional. + :attr str href: The rule's canonical URL. + :attr str id: The rule's unique identifier. + :attr str provisioning_status: The provisioning status of this rule. + :attr str type: The type of the rule. + Body rules are applied to form-encoded request bodies using the `UTF-8` + character set. + :attr str value: Value to be matched for rule condition. + If the rule type is `query` and the rule condition is not `matches_regex`, the + value must be percent-encoded. """ def __init__(self, - accept_proxy_protocol: bool, + condition: str, created_at: datetime, href: str, id: str, - port: int, - port_max: int, - port_min: int, - protocol: str, provisioning_status: str, + type: str, + value: str, *, - certificate_instance: 'CertificateInstanceReference' = None, - connection_limit: int = None, - default_pool: 'LoadBalancerPoolReference' = None, - https_redirect: 'LoadBalancerListenerHTTPSRedirect' = None, - policies: List['LoadBalancerListenerPolicyReference'] = None) -> None: + field: str = None) -> None: """ - Initialize a LoadBalancerListener object. + Initialize a LoadBalancerListenerPolicyRule object. - :param bool accept_proxy_protocol: If set to `true`, this listener will - accept and forward PROXY protocol information. Supported by load balancers - in the `application` family (otherwise always `false`). Additional - restrictions: - - If this listener has `https_redirect` specified, its - `accept_proxy_protocol` value must - match the `accept_proxy_protocol` value of the `https_redirect` listener. - - If this listener is the target of another listener's `https_redirect`, - its - `accept_proxy_protocol` value must match that listener's - `accept_proxy_protocol` value. - :param datetime created_at: The date and time that this listener was - created. - :param str href: The listener's canonical URL. - :param str id: The unique identifier for this load balancer listener. - :param int port: The listener port number, or the inclusive lower bound of - the port range. - :param int port_max: The inclusive upper bound of the range of ports used - by this listener. - At present, only load balancers in the `network` family support more than - one port per listener. - :param int port_min: The inclusive lower bound of the range of ports used - by this listener. - At present, only load balancers in the `network` family support more than - one port per listener. - :param str protocol: The listener protocol. Load balancers in the `network` - family support `tcp` and - `udp` (if `udp_supported` is `true`). Load balancers in the `application` - family support `tcp`, `http`, and `https`. Each listener in the load - balancer must have a unique `port` and `protocol` combination. - The enumerated values for this property are expected to expand in the - future. When processing this property, check for and log unknown values. - Optionally halt processing and surface the error, or bypass the listener on - which the unexpected property value was encountered. - :param str provisioning_status: The provisioning status of this listener. - :param CertificateInstanceReference certificate_instance: (optional) The - certificate instance used for SSL termination. It is applicable only to - `https` - protocol. - :param int connection_limit: (optional) The connection limit of the - listener. - :param LoadBalancerPoolReference default_pool: (optional) The default pool - for this listener. If absent, this listener has no default pool. - :param LoadBalancerListenerHTTPSRedirect https_redirect: (optional) If - specified, the target listener that requests are redirected to. - :param List[LoadBalancerListenerPolicyReference] policies: (optional) The - policies for this listener. + :param str condition: The condition of the rule. + :param datetime created_at: The date and time that this rule was created. + :param str href: The rule's canonical URL. + :param str id: The rule's unique identifier. + :param str provisioning_status: The provisioning status of this rule. + :param str type: The type of the rule. + Body rules are applied to form-encoded request bodies using the `UTF-8` + character set. + :param str value: Value to be matched for rule condition. + If the rule type is `query` and the rule condition is not `matches_regex`, + the value must be percent-encoded. + :param str field: (optional) The field. This is applicable to `header`, + `query`, and `body` rule types. + If the rule type is `header`, this property is required. + If the rule type is `query`, this is optional. If specified and the rule + condition is not + `matches_regex`, the value must be percent-encoded. + If the rule type is `body`, this is optional. """ - self.accept_proxy_protocol = accept_proxy_protocol - self.certificate_instance = certificate_instance - self.connection_limit = connection_limit + self.condition = condition self.created_at = created_at - self.default_pool = default_pool + self.field = field self.href = href - self.https_redirect = https_redirect self.id = id - self.policies = policies - self.port = port - self.port_max = port_max - self.port_min = port_min - self.protocol = protocol self.provisioning_status = provisioning_status + self.type = type + self.value = value @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerListener': - """Initialize a LoadBalancerListener object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPolicyRule': + """Initialize a LoadBalancerListenerPolicyRule object from a json dictionary.""" args = {} - if 'accept_proxy_protocol' in _dict: - args['accept_proxy_protocol'] = _dict.get('accept_proxy_protocol') + if 'condition' in _dict: + args['condition'] = _dict.get('condition') else: - raise ValueError('Required property \'accept_proxy_protocol\' not present in LoadBalancerListener JSON') - if 'certificate_instance' in _dict: - args['certificate_instance'] = CertificateInstanceReference.from_dict(_dict.get('certificate_instance')) - if 'connection_limit' in _dict: - args['connection_limit'] = _dict.get('connection_limit') + raise ValueError('Required property \'condition\' not present in LoadBalancerListenerPolicyRule JSON') if 'created_at' in _dict: args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError('Required property \'created_at\' not present in LoadBalancerListener JSON') - if 'default_pool' in _dict: - args['default_pool'] = LoadBalancerPoolReference.from_dict(_dict.get('default_pool')) + raise ValueError('Required property \'created_at\' not present in LoadBalancerListenerPolicyRule JSON') + if 'field' in _dict: + args['field'] = _dict.get('field') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in LoadBalancerListener JSON') - if 'https_redirect' in _dict: - args['https_redirect'] = LoadBalancerListenerHTTPSRedirect.from_dict(_dict.get('https_redirect')) + raise ValueError('Required property \'href\' not present in LoadBalancerListenerPolicyRule JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in LoadBalancerListener JSON') - if 'policies' in _dict: - args['policies'] = [LoadBalancerListenerPolicyReference.from_dict(x) for x in _dict.get('policies')] - if 'port' in _dict: - args['port'] = _dict.get('port') - else: - raise ValueError('Required property \'port\' not present in LoadBalancerListener JSON') - if 'port_max' in _dict: - args['port_max'] = _dict.get('port_max') - else: - raise ValueError('Required property \'port_max\' not present in LoadBalancerListener JSON') - if 'port_min' in _dict: - args['port_min'] = _dict.get('port_min') - else: - raise ValueError('Required property \'port_min\' not present in LoadBalancerListener JSON') - if 'protocol' in _dict: - args['protocol'] = _dict.get('protocol') - else: - raise ValueError('Required property \'protocol\' not present in LoadBalancerListener JSON') + raise ValueError('Required property \'id\' not present in LoadBalancerListenerPolicyRule JSON') if 'provisioning_status' in _dict: args['provisioning_status'] = _dict.get('provisioning_status') else: - raise ValueError('Required property \'provisioning_status\' not present in LoadBalancerListener JSON') + raise ValueError('Required property \'provisioning_status\' not present in LoadBalancerListenerPolicyRule JSON') + if 'type' in _dict: + args['type'] = _dict.get('type') + else: + raise ValueError('Required property \'type\' not present in LoadBalancerListenerPolicyRule JSON') + if 'value' in _dict: + args['value'] = _dict.get('value') + else: + raise ValueError('Required property \'value\' not present in LoadBalancerListenerPolicyRule JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerListener object from a json dictionary.""" + """Initialize a LoadBalancerListenerPolicyRule object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'accept_proxy_protocol') and self.accept_proxy_protocol is not None: - _dict['accept_proxy_protocol'] = self.accept_proxy_protocol - if hasattr(self, 'certificate_instance') and self.certificate_instance is not None: - _dict['certificate_instance'] = self.certificate_instance.to_dict() - if hasattr(self, 'connection_limit') and self.connection_limit is not None: - _dict['connection_limit'] = self.connection_limit + if hasattr(self, 'condition') and self.condition is not None: + _dict['condition'] = self.condition if hasattr(self, 'created_at') and self.created_at is not None: _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'default_pool') and self.default_pool is not None: - _dict['default_pool'] = self.default_pool.to_dict() + if hasattr(self, 'field') and self.field is not None: + _dict['field'] = self.field if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href - if hasattr(self, 'https_redirect') and self.https_redirect is not None: - _dict['https_redirect'] = self.https_redirect.to_dict() if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'policies') and self.policies is not None: - _dict['policies'] = [x.to_dict() for x in self.policies] - if hasattr(self, 'port') and self.port is not None: - _dict['port'] = self.port - if hasattr(self, 'port_max') and self.port_max is not None: - _dict['port_max'] = self.port_max - if hasattr(self, 'port_min') and self.port_min is not None: - _dict['port_min'] = self.port_min - if hasattr(self, 'protocol') and self.protocol is not None: - _dict['protocol'] = self.protocol + _dict['id'] = self.id if hasattr(self, 'provisioning_status') and self.provisioning_status is not None: _dict['provisioning_status'] = self.provisioning_status + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'value') and self.value is not None: + _dict['value'] = self.value return _dict def _to_dict(self): @@ -37812,39 +42027,31 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerListener object.""" + """Return a `str` version of this LoadBalancerListenerPolicyRule object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerListener') -> bool: + def __eq__(self, other: 'LoadBalancerListenerPolicyRule') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerListener') -> bool: + def __ne__(self, other: 'LoadBalancerListenerPolicyRule') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ProtocolEnum(str, Enum): + class ConditionEnum(str, Enum): """ - The listener protocol. Load balancers in the `network` family support `tcp` and - `udp` (if `udp_supported` is `true`). Load balancers in the `application` family - support `tcp`, `http`, and `https`. Each listener in the load balancer must have a - unique `port` and `protocol` combination. - The enumerated values for this property are expected to expand in the future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the listener on which the unexpected - property value was encountered. + The condition of the rule. """ - HTTP = 'http' - HTTPS = 'https' - TCP = 'tcp' - UDP = 'udp' + CONTAINS = 'contains' + EQUALS = 'equals' + MATCHES_REGEX = 'matches_regex' class ProvisioningStatusEnum(str, Enum): """ - The provisioning status of this listener. + The provisioning status of this rule. """ ACTIVE = 'active' CREATE_PENDING = 'create_pending' @@ -37854,42 +42061,55 @@ class ProvisioningStatusEnum(str, Enum): UPDATE_PENDING = 'update_pending' -class LoadBalancerListenerCollection(): + class TypeEnum(str, Enum): + """ + The type of the rule. + Body rules are applied to form-encoded request bodies using the `UTF-8` character + set. + """ + BODY = 'body' + HEADER = 'header' + HOSTNAME = 'hostname' + PATH = 'path' + QUERY = 'query' + + +class LoadBalancerListenerPolicyRuleCollection(): """ - LoadBalancerListenerCollection. + LoadBalancerListenerPolicyRuleCollection. - :attr List[LoadBalancerListener] listeners: Collection of listeners. + :attr List[LoadBalancerListenerPolicyRule] rules: Collection of rules. """ def __init__(self, - listeners: List['LoadBalancerListener']) -> None: + rules: List['LoadBalancerListenerPolicyRule']) -> None: """ - Initialize a LoadBalancerListenerCollection object. + Initialize a LoadBalancerListenerPolicyRuleCollection object. - :param List[LoadBalancerListener] listeners: Collection of listeners. + :param List[LoadBalancerListenerPolicyRule] rules: Collection of rules. """ - self.listeners = listeners + self.rules = rules @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerCollection': - """Initialize a LoadBalancerListenerCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPolicyRuleCollection': + """Initialize a LoadBalancerListenerPolicyRuleCollection object from a json dictionary.""" args = {} - if 'listeners' in _dict: - args['listeners'] = [LoadBalancerListener.from_dict(x) for x in _dict.get('listeners')] + if 'rules' in _dict: + args['rules'] = [LoadBalancerListenerPolicyRule.from_dict(x) for x in _dict.get('rules')] else: - raise ValueError('Required property \'listeners\' not present in LoadBalancerListenerCollection JSON') + raise ValueError('Required property \'rules\' not present in LoadBalancerListenerPolicyRuleCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerListenerCollection object from a json dictionary.""" + """Initialize a LoadBalancerListenerPolicyRuleCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'listeners') and self.listeners is not None: - _dict['listeners'] = [x.to_dict() for x in self.listeners] + if hasattr(self, 'rules') and self.rules is not None: + _dict['rules'] = [x.to_dict() for x in self.rules] return _dict def _to_dict(self): @@ -37897,74 +42117,98 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerListenerCollection object.""" + """Return a `str` version of this LoadBalancerListenerPolicyRuleCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerListenerCollection') -> bool: + def __eq__(self, other: 'LoadBalancerListenerPolicyRuleCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerListenerCollection') -> bool: + def __ne__(self, other: 'LoadBalancerListenerPolicyRuleCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerListenerHTTPSRedirect(): +class LoadBalancerListenerPolicyRulePatch(): """ - LoadBalancerListenerHTTPSRedirect. + LoadBalancerListenerPolicyRulePatch. - :attr int http_status_code: The HTTP status code for this redirect. - :attr LoadBalancerListenerReference listener: - :attr str uri: (optional) The redirect relative target URI. + :attr str condition: (optional) The condition of the rule. + :attr str field: (optional) The field. This is applicable to `header`, `query`, + and `body` rule types. + If the rule type is `header`, this property is required. + If the rule type is `query`, this is optional. If specified and the rule + condition is not + `matches_regex`, the value must be percent-encoded. + If the rule type is `body`, this is optional. + :attr str type: (optional) The type of the rule. + Body rules are applied to form-encoded request bodies using the `UTF-8` + character set. + :attr str value: (optional) Value to be matched for rule condition. + If the rule type is `query` and the rule condition is not `matches_regex`, the + value must be percent-encoded. """ def __init__(self, - http_status_code: int, - listener: 'LoadBalancerListenerReference', *, - uri: str = None) -> None: + condition: str = None, + field: str = None, + type: str = None, + value: str = None) -> None: """ - Initialize a LoadBalancerListenerHTTPSRedirect object. + Initialize a LoadBalancerListenerPolicyRulePatch object. - :param int http_status_code: The HTTP status code for this redirect. - :param LoadBalancerListenerReference listener: - :param str uri: (optional) The redirect relative target URI. + :param str condition: (optional) The condition of the rule. + :param str field: (optional) The field. This is applicable to `header`, + `query`, and `body` rule types. + If the rule type is `header`, this property is required. + If the rule type is `query`, this is optional. If specified and the rule + condition is not + `matches_regex`, the value must be percent-encoded. + If the rule type is `body`, this is optional. + :param str type: (optional) The type of the rule. + Body rules are applied to form-encoded request bodies using the `UTF-8` + character set. + :param str value: (optional) Value to be matched for rule condition. + If the rule type is `query` and the rule condition is not `matches_regex`, + the value must be percent-encoded. """ - self.http_status_code = http_status_code - self.listener = listener - self.uri = uri + self.condition = condition + self.field = field + self.type = type + self.value = value @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerHTTPSRedirect': - """Initialize a LoadBalancerListenerHTTPSRedirect object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPolicyRulePatch': + """Initialize a LoadBalancerListenerPolicyRulePatch object from a json dictionary.""" args = {} - if 'http_status_code' in _dict: - args['http_status_code'] = _dict.get('http_status_code') - else: - raise ValueError('Required property \'http_status_code\' not present in LoadBalancerListenerHTTPSRedirect JSON') - if 'listener' in _dict: - args['listener'] = LoadBalancerListenerReference.from_dict(_dict.get('listener')) - else: - raise ValueError('Required property \'listener\' not present in LoadBalancerListenerHTTPSRedirect JSON') - if 'uri' in _dict: - args['uri'] = _dict.get('uri') + if 'condition' in _dict: + args['condition'] = _dict.get('condition') + if 'field' in _dict: + args['field'] = _dict.get('field') + if 'type' in _dict: + args['type'] = _dict.get('type') + if 'value' in _dict: + args['value'] = _dict.get('value') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerListenerHTTPSRedirect object from a json dictionary.""" + """Initialize a LoadBalancerListenerPolicyRulePatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'http_status_code') and self.http_status_code is not None: - _dict['http_status_code'] = self.http_status_code - if hasattr(self, 'listener') and self.listener is not None: - _dict['listener'] = self.listener.to_dict() - if hasattr(self, 'uri') and self.uri is not None: - _dict['uri'] = self.uri + if hasattr(self, 'condition') and self.condition is not None: + _dict['condition'] = self.condition + if hasattr(self, 'field') and self.field is not None: + _dict['field'] = self.field + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'value') and self.value is not None: + _dict['value'] = self.value return _dict def _to_dict(self): @@ -37972,76 +42216,126 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerListenerHTTPSRedirect object.""" + """Return a `str` version of this LoadBalancerListenerPolicyRulePatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerListenerHTTPSRedirect') -> bool: + def __eq__(self, other: 'LoadBalancerListenerPolicyRulePatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerListenerHTTPSRedirect') -> bool: + def __ne__(self, other: 'LoadBalancerListenerPolicyRulePatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerListenerHTTPSRedirectPatch(): + class ConditionEnum(str, Enum): + """ + The condition of the rule. + """ + CONTAINS = 'contains' + EQUALS = 'equals' + MATCHES_REGEX = 'matches_regex' + + + class TypeEnum(str, Enum): + """ + The type of the rule. + Body rules are applied to form-encoded request bodies using the `UTF-8` character + set. + """ + BODY = 'body' + HEADER = 'header' + HOSTNAME = 'hostname' + PATH = 'path' + QUERY = 'query' + + +class LoadBalancerListenerPolicyRulePrototype(): """ - LoadBalancerListenerHTTPSRedirectPatch. + LoadBalancerListenerPolicyRulePrototype. - :attr int http_status_code: (optional) The HTTP status code for this redirect. - :attr LoadBalancerListenerIdentity listener: (optional) Identifies a load - balancer listener by a unique property. - :attr str uri: (optional) The redirect relative target URI. + :attr str condition: The condition of the rule. + :attr str field: (optional) The field. This is applicable to `header`, `query`, + and `body` rule types. + If the rule type is `header`, this property is required. + If the rule type is `query`, this is optional. If specified and the rule + condition is not + `matches_regex`, the value must be percent-encoded. + If the rule type is `body`, this is optional. + :attr str type: The type of the rule. + Body rules are applied to form-encoded request bodies using the `UTF-8` + character set. + :attr str value: Value to be matched for rule condition. + If the rule type is `query` and the rule condition is not `matches_regex`, the + value must be percent-encoded. """ def __init__(self, + condition: str, + type: str, + value: str, *, - http_status_code: int = None, - listener: 'LoadBalancerListenerIdentity' = None, - uri: str = None) -> None: + field: str = None) -> None: """ - Initialize a LoadBalancerListenerHTTPSRedirectPatch object. + Initialize a LoadBalancerListenerPolicyRulePrototype object. - :param int http_status_code: (optional) The HTTP status code for this - redirect. - :param LoadBalancerListenerIdentity listener: (optional) Identifies a load - balancer listener by a unique property. - :param str uri: (optional) The redirect relative target URI. + :param str condition: The condition of the rule. + :param str type: The type of the rule. + Body rules are applied to form-encoded request bodies using the `UTF-8` + character set. + :param str value: Value to be matched for rule condition. + If the rule type is `query` and the rule condition is not `matches_regex`, + the value must be percent-encoded. + :param str field: (optional) The field. This is applicable to `header`, + `query`, and `body` rule types. + If the rule type is `header`, this property is required. + If the rule type is `query`, this is optional. If specified and the rule + condition is not + `matches_regex`, the value must be percent-encoded. + If the rule type is `body`, this is optional. """ - self.http_status_code = http_status_code - self.listener = listener - self.uri = uri + self.condition = condition + self.field = field + self.type = type + self.value = value @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerHTTPSRedirectPatch': - """Initialize a LoadBalancerListenerHTTPSRedirectPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPolicyRulePrototype': + """Initialize a LoadBalancerListenerPolicyRulePrototype object from a json dictionary.""" args = {} - if 'http_status_code' in _dict: - args['http_status_code'] = _dict.get('http_status_code') - if 'listener' in _dict: - args['listener'] = _dict.get('listener') - if 'uri' in _dict: - args['uri'] = _dict.get('uri') + if 'condition' in _dict: + args['condition'] = _dict.get('condition') + else: + raise ValueError('Required property \'condition\' not present in LoadBalancerListenerPolicyRulePrototype JSON') + if 'field' in _dict: + args['field'] = _dict.get('field') + if 'type' in _dict: + args['type'] = _dict.get('type') + else: + raise ValueError('Required property \'type\' not present in LoadBalancerListenerPolicyRulePrototype JSON') + if 'value' in _dict: + args['value'] = _dict.get('value') + else: + raise ValueError('Required property \'value\' not present in LoadBalancerListenerPolicyRulePrototype JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerListenerHTTPSRedirectPatch object from a json dictionary.""" + """Initialize a LoadBalancerListenerPolicyRulePrototype object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'http_status_code') and self.http_status_code is not None: - _dict['http_status_code'] = self.http_status_code - if hasattr(self, 'listener') and self.listener is not None: - if isinstance(self.listener, dict): - _dict['listener'] = self.listener - else: - _dict['listener'] = self.listener.to_dict() - if hasattr(self, 'uri') and self.uri is not None: - _dict['uri'] = self.uri + if hasattr(self, 'condition') and self.condition is not None: + _dict['condition'] = self.condition + if hasattr(self, 'field') and self.field is not None: + _dict['field'] = self.field + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'value') and self.value is not None: + _dict['value'] = self.value return _dict def _to_dict(self): @@ -38049,79 +42343,102 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerListenerHTTPSRedirectPatch object.""" + """Return a `str` version of this LoadBalancerListenerPolicyRulePrototype object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerListenerHTTPSRedirectPatch') -> bool: + def __eq__(self, other: 'LoadBalancerListenerPolicyRulePrototype') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerListenerHTTPSRedirectPatch') -> bool: + def __ne__(self, other: 'LoadBalancerListenerPolicyRulePrototype') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerListenerHTTPSRedirectPrototype(): + class ConditionEnum(str, Enum): + """ + The condition of the rule. + """ + CONTAINS = 'contains' + EQUALS = 'equals' + MATCHES_REGEX = 'matches_regex' + + + class TypeEnum(str, Enum): + """ + The type of the rule. + Body rules are applied to form-encoded request bodies using the `UTF-8` character + set. + """ + BODY = 'body' + HEADER = 'header' + HOSTNAME = 'hostname' + PATH = 'path' + QUERY = 'query' + + +class LoadBalancerListenerPolicyRuleReference(): """ - LoadBalancerListenerHTTPSRedirectPrototype. + LoadBalancerListenerPolicyRuleReference. - :attr int http_status_code: The HTTP status code for this redirect. - :attr LoadBalancerListenerIdentity listener: Identifies a load balancer listener - by a unique property. - :attr str uri: (optional) The redirect relative target URI. + :attr LoadBalancerListenerPolicyRuleReferenceDeleted deleted: (optional) If + present, this property indicates the referenced resource has been deleted and + provides + some supplementary information. + :attr str href: The rule's canonical URL. + :attr str id: The rule's unique identifier. """ def __init__(self, - http_status_code: int, - listener: 'LoadBalancerListenerIdentity', + href: str, + id: str, *, - uri: str = None) -> None: + deleted: 'LoadBalancerListenerPolicyRuleReferenceDeleted' = None) -> None: """ - Initialize a LoadBalancerListenerHTTPSRedirectPrototype object. + Initialize a LoadBalancerListenerPolicyRuleReference object. - :param int http_status_code: The HTTP status code for this redirect. - :param LoadBalancerListenerIdentity listener: Identifies a load balancer - listener by a unique property. - :param str uri: (optional) The redirect relative target URI. + :param str href: The rule's canonical URL. + :param str id: The rule's unique identifier. + :param LoadBalancerListenerPolicyRuleReferenceDeleted deleted: (optional) + If present, this property indicates the referenced resource has been + deleted and provides + some supplementary information. """ - self.http_status_code = http_status_code - self.listener = listener - self.uri = uri + self.deleted = deleted + self.href = href + self.id = id @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerHTTPSRedirectPrototype': - """Initialize a LoadBalancerListenerHTTPSRedirectPrototype object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPolicyRuleReference': + """Initialize a LoadBalancerListenerPolicyRuleReference object from a json dictionary.""" args = {} - if 'http_status_code' in _dict: - args['http_status_code'] = _dict.get('http_status_code') + if 'deleted' in _dict: + args['deleted'] = LoadBalancerListenerPolicyRuleReferenceDeleted.from_dict(_dict.get('deleted')) + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'http_status_code\' not present in LoadBalancerListenerHTTPSRedirectPrototype JSON') - if 'listener' in _dict: - args['listener'] = _dict.get('listener') + raise ValueError('Required property \'href\' not present in LoadBalancerListenerPolicyRuleReference JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') else: - raise ValueError('Required property \'listener\' not present in LoadBalancerListenerHTTPSRedirectPrototype JSON') - if 'uri' in _dict: - args['uri'] = _dict.get('uri') + raise ValueError('Required property \'id\' not present in LoadBalancerListenerPolicyRuleReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerListenerHTTPSRedirectPrototype object from a json dictionary.""" + """Initialize a LoadBalancerListenerPolicyRuleReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'http_status_code') and self.http_status_code is not None: - _dict['http_status_code'] = self.http_status_code - if hasattr(self, 'listener') and self.listener is not None: - if isinstance(self.listener, dict): - _dict['listener'] = self.listener - else: - _dict['listener'] = self.listener.to_dict() - if hasattr(self, 'uri') and self.uri is not None: - _dict['uri'] = self.uri + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id return _dict def _to_dict(self): @@ -38129,37 +42446,134 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerListenerHTTPSRedirectPrototype object.""" + """Return a `str` version of this LoadBalancerListenerPolicyRuleReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerListenerHTTPSRedirectPrototype') -> bool: + def __eq__(self, other: 'LoadBalancerListenerPolicyRuleReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerListenerHTTPSRedirectPrototype') -> bool: + def __ne__(self, other: 'LoadBalancerListenerPolicyRuleReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerListenerIdentity(): +class LoadBalancerListenerPolicyRuleReferenceDeleted(): """ - Identifies a load balancer listener by a unique property. + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. + + :attr str more_info: Link to documentation about deleted resources. + """ + + def __init__(self, + more_info: str) -> None: + """ + Initialize a LoadBalancerListenerPolicyRuleReferenceDeleted object. + + :param str more_info: Link to documentation about deleted resources. + """ + self.more_info = more_info + + @classmethod + def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPolicyRuleReferenceDeleted': + """Initialize a LoadBalancerListenerPolicyRuleReferenceDeleted object from a json dictionary.""" + args = {} + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') + else: + raise ValueError('Required property \'more_info\' not present in LoadBalancerListenerPolicyRuleReferenceDeleted JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a LoadBalancerListenerPolicyRuleReferenceDeleted object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this LoadBalancerListenerPolicyRuleReferenceDeleted object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'LoadBalancerListenerPolicyRuleReferenceDeleted') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'LoadBalancerListenerPolicyRuleReferenceDeleted') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class LoadBalancerListenerPolicyTarget(): + """ + - If `action` is `forward`, the response is a `LoadBalancerPoolReference` + - If `action` is `redirect`, the response is a `LoadBalancerListenerPolicyRedirectURL` + - If `action` is `https_redirect`, the response is a + `LoadBalancerListenerHTTPSRedirect`. """ def __init__(self) -> None: """ - Initialize a LoadBalancerListenerIdentity object. + Initialize a LoadBalancerListenerPolicyTarget object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['LoadBalancerListenerPolicyTargetLoadBalancerPoolReference', 'LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL', 'LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect'])) + raise Exception(msg) + +class LoadBalancerListenerPolicyTargetPatch(): + """ + - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. + - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. + - If `action` is `https_redirect`, specify a + `LoadBalancerListenerPolicyHTTPSRedirectPatch`. + + """ + + def __init__(self) -> None: + """ + Initialize a LoadBalancerListenerPolicyTargetPatch object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity', 'LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch', 'LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch'])) + raise Exception(msg) + +class LoadBalancerListenerPolicyTargetPrototype(): + """ + - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. + - If `action` is `redirect`, specify a + `LoadBalancerListenerPolicyRedirectURLPrototype`. + - If `action` is `https_redirect`, specify a + `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. + + """ + + def __init__(self) -> None: + """ + Initialize a LoadBalancerListenerPolicyTargetPrototype object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['LoadBalancerListenerIdentityById', 'LoadBalancerListenerIdentityByHref'])) + ", ".join(['LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity', 'LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype', 'LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype'])) raise Exception(msg) -class LoadBalancerListenerPatch(): +class LoadBalancerListenerPrototypeLoadBalancerContext(): """ - LoadBalancerListenerPatch. + LoadBalancerListenerPrototypeLoadBalancerContext. :attr bool accept_proxy_protocol: (optional) If set to `true`, this listener will accept and forward PROXY protocol information. Supported by load balancers @@ -38170,21 +42584,15 @@ class LoadBalancerListenerPatch(): - If this listener is the target of another listener's `https_redirect`, its `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. - :attr CertificateInstanceIdentity certificate_instance: (optional) The - certificate instance used for SSL termination. It is applicable only to `https` - protocol. :attr int connection_limit: (optional) The connection limit of the listener. - :attr LoadBalancerPoolIdentity default_pool: (optional) The default pool for - this listener. The specified pool must: - - Belong to this load balancer - - Have the same `protocol` as this listener, or have a compatible protocol. - At present, the compatible protocols are `http` and `https`. - - Not already be the `default_pool` for another listener - Specify `null` to remove an existing default pool. - :attr LoadBalancerListenerHTTPSRedirectPatch https_redirect: (optional) The - target listener that requests will be redirected to. This listener must have a - `protocol` of `http`, and the target listener must have a `protocol` of `https`. - Specify `null` to remove any existing https redirect. + :attr LoadBalancerPoolIdentityByName default_pool: (optional) The default pool + for this listener. If specified, the pool's protocol must match the + listener's protocol, or the protocols must be compatible. At present, the + compatible + protocols are `http` and `https`. + If unspecified, this listener will be created with no default pool, but one may + be + subsequently set. :attr int port: (optional) The listener port number, or the inclusive lower bound of the port range. Each listener in the load balancer must have a unique `port` and `protocol` combination. @@ -38205,31 +42613,38 @@ class LoadBalancerListenerPatch(): `port_max`. When route mode is enabled, the value `1` must be specified. The specified port range must not overlap with port ranges used by other listeners for this load balancer using the same protocol. - :attr str protocol: (optional) The listener protocol. Each listener in the load - balancer must have a unique `port` and `protocol` combination. Additional - restrictions: - - If this load balancer is in the `network` family, the protocol must be `tcp` - or `udp` (if `udp_supported` is `true`) , and it cannot be changed while - `default_pool` is set. - - If `https_redirect` is set, the protocol must be `http`. - - If this listener is a listener's `https_redirect` target, the protocol must be - `https`. + :attr str protocol: The listener protocol. Load balancers in the `network` + family support `tcp` and + `udp` (if `udp_supported` is `true`). Load balancers in the `application` family + support `tcp`, `http`, and `https`. Each listener in the load balancer must have + a unique `port` and `protocol` combination. + The enumerated values for this property are expected to expand in the future. + When processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the listener on which the unexpected + property value was encountered. """ def __init__(self, + protocol: str, *, accept_proxy_protocol: bool = None, - certificate_instance: 'CertificateInstanceIdentity' = None, connection_limit: int = None, - default_pool: 'LoadBalancerPoolIdentity' = None, - https_redirect: 'LoadBalancerListenerHTTPSRedirectPatch' = None, + default_pool: 'LoadBalancerPoolIdentityByName' = None, port: int = None, port_max: int = None, - port_min: int = None, - protocol: str = None) -> None: + port_min: int = None) -> None: """ - Initialize a LoadBalancerListenerPatch object. + Initialize a LoadBalancerListenerPrototypeLoadBalancerContext object. + :param str protocol: The listener protocol. Load balancers in the `network` + family support `tcp` and + `udp` (if `udp_supported` is `true`). Load balancers in the `application` + family support `tcp`, `http`, and `https`. Each listener in the load + balancer must have a unique `port` and `protocol` combination. + The enumerated values for this property are expected to expand in the + future. When processing this property, check for and log unknown values. + Optionally halt processing and surface the error, or bypass the listener on + which the unexpected property value was encountered. :param bool accept_proxy_protocol: (optional) If set to `true`, this listener will accept and forward PROXY protocol information. Supported by load balancers in the `application` family (otherwise always `false`). @@ -38241,25 +42656,16 @@ def __init__(self, its `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. - :param CertificateInstanceIdentity certificate_instance: (optional) The - certificate instance used for SSL termination. It is applicable only to - `https` - protocol. :param int connection_limit: (optional) The connection limit of the listener. - :param LoadBalancerPoolIdentity default_pool: (optional) The default pool - for this listener. The specified pool must: - - Belong to this load balancer - - Have the same `protocol` as this listener, or have a compatible protocol. - At present, the compatible protocols are `http` and `https`. - - Not already be the `default_pool` for another listener - Specify `null` to remove an existing default pool. - :param LoadBalancerListenerHTTPSRedirectPatch https_redirect: (optional) - The target listener that requests will be redirected to. This listener must - have a - `protocol` of `http`, and the target listener must have a `protocol` of - `https`. - Specify `null` to remove any existing https redirect. + :param LoadBalancerPoolIdentityByName default_pool: (optional) The default + pool for this listener. If specified, the pool's protocol must match the + listener's protocol, or the protocols must be compatible. At present, the + compatible + protocols are `http` and `https`. + If unspecified, this listener will be created with no default pool, but one + may be + subsequently set. :param int port: (optional) The listener port number, or the inclusive lower bound of the port range. Each listener in the load balancer must have a unique `port` and `protocol` combination. @@ -38281,42 +42687,25 @@ def __init__(self, `port_max`. When route mode is enabled, the value `1` must be specified. The specified port range must not overlap with port ranges used by other listeners for this load balancer using the same protocol. - :param str protocol: (optional) The listener protocol. Each listener in the - load balancer must have a unique `port` and `protocol` combination. - Additional restrictions: - - If this load balancer is in the `network` family, the protocol must be - `tcp` - or `udp` (if `udp_supported` is `true`) , and it cannot be changed while - `default_pool` is set. - - If `https_redirect` is set, the protocol must be `http`. - - If this listener is a listener's `https_redirect` target, the protocol - must be - `https`. """ self.accept_proxy_protocol = accept_proxy_protocol - self.certificate_instance = certificate_instance self.connection_limit = connection_limit self.default_pool = default_pool - self.https_redirect = https_redirect self.port = port self.port_max = port_max self.port_min = port_min self.protocol = protocol @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPatch': - """Initialize a LoadBalancerListenerPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPrototypeLoadBalancerContext': + """Initialize a LoadBalancerListenerPrototypeLoadBalancerContext object from a json dictionary.""" args = {} if 'accept_proxy_protocol' in _dict: args['accept_proxy_protocol'] = _dict.get('accept_proxy_protocol') - if 'certificate_instance' in _dict: - args['certificate_instance'] = _dict.get('certificate_instance') if 'connection_limit' in _dict: args['connection_limit'] = _dict.get('connection_limit') if 'default_pool' in _dict: - args['default_pool'] = _dict.get('default_pool') - if 'https_redirect' in _dict: - args['https_redirect'] = LoadBalancerListenerHTTPSRedirectPatch.from_dict(_dict.get('https_redirect')) + args['default_pool'] = LoadBalancerPoolIdentityByName.from_dict(_dict.get('default_pool')) if 'port' in _dict: args['port'] = _dict.get('port') if 'port_max' in _dict: @@ -38325,11 +42714,13 @@ def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPatch': args['port_min'] = _dict.get('port_min') if 'protocol' in _dict: args['protocol'] = _dict.get('protocol') + else: + raise ValueError('Required property \'protocol\' not present in LoadBalancerListenerPrototypeLoadBalancerContext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerListenerPatch object from a json dictionary.""" + """Initialize a LoadBalancerListenerPrototypeLoadBalancerContext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -38337,20 +42728,10 @@ def to_dict(self) -> Dict: _dict = {} if hasattr(self, 'accept_proxy_protocol') and self.accept_proxy_protocol is not None: _dict['accept_proxy_protocol'] = self.accept_proxy_protocol - if hasattr(self, 'certificate_instance') and self.certificate_instance is not None: - if isinstance(self.certificate_instance, dict): - _dict['certificate_instance'] = self.certificate_instance - else: - _dict['certificate_instance'] = self.certificate_instance.to_dict() if hasattr(self, 'connection_limit') and self.connection_limit is not None: _dict['connection_limit'] = self.connection_limit if hasattr(self, 'default_pool') and self.default_pool is not None: - if isinstance(self.default_pool, dict): - _dict['default_pool'] = self.default_pool - else: - _dict['default_pool'] = self.default_pool.to_dict() - if hasattr(self, 'https_redirect') and self.https_redirect is not None: - _dict['https_redirect'] = self.https_redirect.to_dict() + _dict['default_pool'] = self.default_pool.to_dict() if hasattr(self, 'port') and self.port is not None: _dict['port'] = self.port if hasattr(self, 'port_max') and self.port_max is not None: @@ -38366,29 +42747,29 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerListenerPatch object.""" + """Return a `str` version of this LoadBalancerListenerPrototypeLoadBalancerContext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerListenerPatch') -> bool: + def __eq__(self, other: 'LoadBalancerListenerPrototypeLoadBalancerContext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerListenerPatch') -> bool: + def __ne__(self, other: 'LoadBalancerListenerPrototypeLoadBalancerContext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other class ProtocolEnum(str, Enum): """ - The listener protocol. Each listener in the load balancer must have a unique - `port` and `protocol` combination. Additional restrictions: - - If this load balancer is in the `network` family, the protocol must be `tcp` - or `udp` (if `udp_supported` is `true`) , and it cannot be changed while - `default_pool` is set. - - If `https_redirect` is set, the protocol must be `http`. - - If this listener is a listener's `https_redirect` target, the protocol must be - `https`. + The listener protocol. Load balancers in the `network` family support `tcp` and + `udp` (if `udp_supported` is `true`). Load balancers in the `application` family + support `tcp`, `http`, and `https`. Each listener in the load balancer must have a + unique `port` and `protocol` combination. + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the listener on which the unexpected + property value was encountered. """ HTTP = 'http' HTTPS = 'https' @@ -38396,146 +42777,66 @@ class ProtocolEnum(str, Enum): UDP = 'udp' -class LoadBalancerListenerPolicy(): +class LoadBalancerListenerReference(): """ - LoadBalancerListenerPolicy. + LoadBalancerListenerReference. - :attr str action: The policy action. - The enumerated values for this property are expected to expand in the future. - When processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the policy on which the unexpected - property value was encountered. - :attr datetime created_at: The date and time that this policy was created. - :attr str href: The listener policy's canonical URL. - :attr str id: The policy's unique identifier. - :attr str name: The user-defined name for this policy. - :attr int priority: Priority of the policy. Lower value indicates higher - priority. - :attr str provisioning_status: The provisioning status of this policy. - :attr List[LoadBalancerListenerPolicyRuleReference] rules: The rules for this - policy. - :attr LoadBalancerListenerPolicyTarget target: (optional) - If `action` is - `forward`, the response is a `LoadBalancerPoolReference` - - If `action` is `redirect`, the response is a - `LoadBalancerListenerPolicyRedirectURL` - - If `action` is `https_redirect`, the response is a - `LoadBalancerListenerHTTPSRedirect`. + :attr LoadBalancerListenerReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str href: The listener's canonical URL. + :attr str id: The unique identifier for this load balancer listener. """ def __init__(self, - action: str, - created_at: datetime, href: str, id: str, - name: str, - priority: int, - provisioning_status: str, - rules: List['LoadBalancerListenerPolicyRuleReference'], *, - target: 'LoadBalancerListenerPolicyTarget' = None) -> None: + deleted: 'LoadBalancerListenerReferenceDeleted' = None) -> None: """ - Initialize a LoadBalancerListenerPolicy object. + Initialize a LoadBalancerListenerReference object. - :param str action: The policy action. - The enumerated values for this property are expected to expand in the - future. When processing this property, check for and log unknown values. - Optionally halt processing and surface the error, or bypass the policy on - which the unexpected property value was encountered. - :param datetime created_at: The date and time that this policy was created. - :param str href: The listener policy's canonical URL. - :param str id: The policy's unique identifier. - :param str name: The user-defined name for this policy. - :param int priority: Priority of the policy. Lower value indicates higher - priority. - :param str provisioning_status: The provisioning status of this policy. - :param List[LoadBalancerListenerPolicyRuleReference] rules: The rules for - this policy. - :param LoadBalancerListenerPolicyTarget target: (optional) - If `action` is - `forward`, the response is a `LoadBalancerPoolReference` - - If `action` is `redirect`, the response is a - `LoadBalancerListenerPolicyRedirectURL` - - If `action` is `https_redirect`, the response is a - `LoadBalancerListenerHTTPSRedirect`. + :param str href: The listener's canonical URL. + :param str id: The unique identifier for this load balancer listener. + :param LoadBalancerListenerReferenceDeleted deleted: (optional) If present, + this property indicates the referenced resource has been deleted and + provides + some supplementary information. """ - self.action = action - self.created_at = created_at + self.deleted = deleted self.href = href self.id = id - self.name = name - self.priority = priority - self.provisioning_status = provisioning_status - self.rules = rules - self.target = target @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPolicy': - """Initialize a LoadBalancerListenerPolicy object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerReference': + """Initialize a LoadBalancerListenerReference object from a json dictionary.""" args = {} - if 'action' in _dict: - args['action'] = _dict.get('action') - else: - raise ValueError('Required property \'action\' not present in LoadBalancerListenerPolicy JSON') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - else: - raise ValueError('Required property \'created_at\' not present in LoadBalancerListenerPolicy JSON') + if 'deleted' in _dict: + args['deleted'] = LoadBalancerListenerReferenceDeleted.from_dict(_dict.get('deleted')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in LoadBalancerListenerPolicy JSON') + raise ValueError('Required property \'href\' not present in LoadBalancerListenerReference JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in LoadBalancerListenerPolicy JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in LoadBalancerListenerPolicy JSON') - if 'priority' in _dict: - args['priority'] = _dict.get('priority') - else: - raise ValueError('Required property \'priority\' not present in LoadBalancerListenerPolicy JSON') - if 'provisioning_status' in _dict: - args['provisioning_status'] = _dict.get('provisioning_status') - else: - raise ValueError('Required property \'provisioning_status\' not present in LoadBalancerListenerPolicy JSON') - if 'rules' in _dict: - args['rules'] = [LoadBalancerListenerPolicyRuleReference.from_dict(x) for x in _dict.get('rules')] - else: - raise ValueError('Required property \'rules\' not present in LoadBalancerListenerPolicy JSON') - if 'target' in _dict: - args['target'] = _dict.get('target') + raise ValueError('Required property \'id\' not present in LoadBalancerListenerReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerListenerPolicy object from a json dictionary.""" + """Initialize a LoadBalancerListenerReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'action') and self.action is not None: - _dict['action'] = self.action - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'priority') and self.priority is not None: - _dict['priority'] = self.priority - if hasattr(self, 'provisioning_status') and self.provisioning_status is not None: - _dict['provisioning_status'] = self.provisioning_status - if hasattr(self, 'rules') and self.rules is not None: - _dict['rules'] = [x.to_dict() for x in self.rules] - if hasattr(self, 'target') and self.target is not None: - if isinstance(self.target, dict): - _dict['target'] = self.target - else: - _dict['target'] = self.target.to_dict() return _dict def _to_dict(self): @@ -38543,169 +42844,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerListenerPolicy object.""" + """Return a `str` version of this LoadBalancerListenerReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerListenerPolicy') -> bool: + def __eq__(self, other: 'LoadBalancerListenerReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerListenerPolicy') -> bool: + def __ne__(self, other: 'LoadBalancerListenerReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ActionEnum(str, Enum): - """ - The policy action. - The enumerated values for this property are expected to expand in the future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the policy on which the unexpected - property value was encountered. - """ - FORWARD = 'forward' - HTTPS_REDIRECT = 'https_redirect' - REDIRECT = 'redirect' - REJECT = 'reject' - - - class ProvisioningStatusEnum(str, Enum): - """ - The provisioning status of this policy. - """ - ACTIVE = 'active' - CREATE_PENDING = 'create_pending' - DELETE_PENDING = 'delete_pending' - FAILED = 'failed' - MAINTENANCE_PENDING = 'maintenance_pending' - UPDATE_PENDING = 'update_pending' - - -class LoadBalancerListenerPolicyCollection(): +class LoadBalancerListenerReferenceDeleted(): """ - LoadBalancerListenerPolicyCollection. + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. - :attr List[LoadBalancerListenerPolicy] policies: Collection of policies. + :attr str more_info: Link to documentation about deleted resources. """ def __init__(self, - policies: List['LoadBalancerListenerPolicy']) -> None: + more_info: str) -> None: """ - Initialize a LoadBalancerListenerPolicyCollection object. + Initialize a LoadBalancerListenerReferenceDeleted object. - :param List[LoadBalancerListenerPolicy] policies: Collection of policies. + :param str more_info: Link to documentation about deleted resources. """ - self.policies = policies + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPolicyCollection': - """Initialize a LoadBalancerListenerPolicyCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerReferenceDeleted': + """Initialize a LoadBalancerListenerReferenceDeleted object from a json dictionary.""" args = {} - if 'policies' in _dict: - args['policies'] = [LoadBalancerListenerPolicy.from_dict(x) for x in _dict.get('policies')] + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'policies\' not present in LoadBalancerListenerPolicyCollection JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a LoadBalancerListenerPolicyCollection object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'policies') and self.policies is not None: - _dict['policies'] = [x.to_dict() for x in self.policies] - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this LoadBalancerListenerPolicyCollection object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'LoadBalancerListenerPolicyCollection') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'LoadBalancerListenerPolicyCollection') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - -class LoadBalancerListenerPolicyPatch(): - """ - LoadBalancerListenerPolicyPatch. - - :attr str name: (optional) The user-defined name for this policy. Names must be - unique within the load balancer listener the policy resides in. - :attr int priority: (optional) Priority of the policy. Lower value indicates - higher priority. - :attr LoadBalancerListenerPolicyTargetPatch target: (optional) - If `action` is - `forward`, specify a `LoadBalancerPoolIdentity`. - - If `action` is `redirect`, specify a - `LoadBalancerListenerPolicyRedirectURLPatch`. - - If `action` is `https_redirect`, specify a - `LoadBalancerListenerPolicyHTTPSRedirectPatch`. - """ - - def __init__(self, - *, - name: str = None, - priority: int = None, - target: 'LoadBalancerListenerPolicyTargetPatch' = None) -> None: - """ - Initialize a LoadBalancerListenerPolicyPatch object. - - :param str name: (optional) The user-defined name for this policy. Names - must be unique within the load balancer listener the policy resides in. - :param int priority: (optional) Priority of the policy. Lower value - indicates higher priority. - :param LoadBalancerListenerPolicyTargetPatch target: (optional) - If - `action` is `forward`, specify a `LoadBalancerPoolIdentity`. - - If `action` is `redirect`, specify a - `LoadBalancerListenerPolicyRedirectURLPatch`. - - If `action` is `https_redirect`, specify a - `LoadBalancerListenerPolicyHTTPSRedirectPatch`. - """ - self.name = name - self.priority = priority - self.target = target - - @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPolicyPatch': - """Initialize a LoadBalancerListenerPolicyPatch object from a json dictionary.""" - args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') - if 'priority' in _dict: - args['priority'] = _dict.get('priority') - if 'target' in _dict: - args['target'] = _dict.get('target') + raise ValueError('Required property \'more_info\' not present in LoadBalancerListenerReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerListenerPolicyPatch object from a json dictionary.""" + """Initialize a LoadBalancerListenerReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'priority') and self.priority is not None: - _dict['priority'] = self.priority - if hasattr(self, 'target') and self.target is not None: - if isinstance(self.target, dict): - _dict['target'] = self.target - else: - _dict['target'] = self.target.to_dict() + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -38713,117 +42901,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerListenerPolicyPatch object.""" + """Return a `str` version of this LoadBalancerListenerReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerListenerPolicyPatch') -> bool: + def __eq__(self, other: 'LoadBalancerListenerReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerListenerPolicyPatch') -> bool: + def __ne__(self, other: 'LoadBalancerListenerReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerListenerPolicyPrototype(): +class LoadBalancerLogging(): """ - LoadBalancerListenerPolicyPrototype. + The logging configuration for this load balancer. - :attr str action: The policy action. - The enumerated values for this property are expected to expand in the future. - When processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the policy on which the unexpected - property value was encountered. - :attr str name: (optional) The user-defined name for this policy. Names must be - unique within the load balancer listener the policy resides in. - :attr int priority: Priority of the policy. Lower value indicates higher - priority. - :attr List[LoadBalancerListenerPolicyRulePrototype] rules: (optional) The rule - prototype objects for this policy. - :attr LoadBalancerListenerPolicyTargetPrototype target: (optional) - If `action` - is `forward`, specify a `LoadBalancerPoolIdentity`. - - If `action` is `redirect`, specify a - `LoadBalancerListenerPolicyRedirectURLPrototype`. - - If `action` is `https_redirect`, specify a - `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. + :attr LoadBalancerLoggingDatapath datapath: (optional) The datapath logging + configuration for this load balancer. """ def __init__(self, - action: str, - priority: int, *, - name: str = None, - rules: List['LoadBalancerListenerPolicyRulePrototype'] = None, - target: 'LoadBalancerListenerPolicyTargetPrototype' = None) -> None: - """ - Initialize a LoadBalancerListenerPolicyPrototype object. - - :param str action: The policy action. - The enumerated values for this property are expected to expand in the - future. When processing this property, check for and log unknown values. - Optionally halt processing and surface the error, or bypass the policy on - which the unexpected property value was encountered. - :param int priority: Priority of the policy. Lower value indicates higher - priority. - :param str name: (optional) The user-defined name for this policy. Names - must be unique within the load balancer listener the policy resides in. - :param List[LoadBalancerListenerPolicyRulePrototype] rules: (optional) The - rule prototype objects for this policy. - :param LoadBalancerListenerPolicyTargetPrototype target: (optional) - If - `action` is `forward`, specify a `LoadBalancerPoolIdentity`. - - If `action` is `redirect`, specify a - `LoadBalancerListenerPolicyRedirectURLPrototype`. - - If `action` is `https_redirect`, specify a - `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. + datapath: 'LoadBalancerLoggingDatapath' = None) -> None: """ - self.action = action - self.name = name - self.priority = priority - self.rules = rules - self.target = target - - @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPolicyPrototype': - """Initialize a LoadBalancerListenerPolicyPrototype object from a json dictionary.""" - args = {} - if 'action' in _dict: - args['action'] = _dict.get('action') - else: - raise ValueError('Required property \'action\' not present in LoadBalancerListenerPolicyPrototype JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - if 'priority' in _dict: - args['priority'] = _dict.get('priority') - else: - raise ValueError('Required property \'priority\' not present in LoadBalancerListenerPolicyPrototype JSON') - if 'rules' in _dict: - args['rules'] = [LoadBalancerListenerPolicyRulePrototype.from_dict(x) for x in _dict.get('rules')] - if 'target' in _dict: - args['target'] = _dict.get('target') + Initialize a LoadBalancerLogging object. + + :param LoadBalancerLoggingDatapath datapath: (optional) The datapath + logging configuration for this load balancer. + """ + self.datapath = datapath + + @classmethod + def from_dict(cls, _dict: Dict) -> 'LoadBalancerLogging': + """Initialize a LoadBalancerLogging object from a json dictionary.""" + args = {} + if 'datapath' in _dict: + args['datapath'] = LoadBalancerLoggingDatapath.from_dict(_dict.get('datapath')) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerListenerPolicyPrototype object from a json dictionary.""" + """Initialize a LoadBalancerLogging object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'action') and self.action is not None: - _dict['action'] = self.action - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'priority') and self.priority is not None: - _dict['priority'] = self.priority - if hasattr(self, 'rules') and self.rules is not None: - _dict['rules'] = [x.to_dict() for x in self.rules] - if hasattr(self, 'target') and self.target is not None: - if isinstance(self.target, dict): - _dict['target'] = self.target - else: - _dict['target'] = self.target.to_dict() + if hasattr(self, 'datapath') and self.datapath is not None: + _dict['datapath'] = self.datapath.to_dict() return _dict def _to_dict(self): @@ -38831,93 +42958,57 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerListenerPolicyPrototype object.""" + """Return a `str` version of this LoadBalancerLogging object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerListenerPolicyPrototype') -> bool: + def __eq__(self, other: 'LoadBalancerLogging') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerListenerPolicyPrototype') -> bool: + def __ne__(self, other: 'LoadBalancerLogging') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ActionEnum(str, Enum): - """ - The policy action. - The enumerated values for this property are expected to expand in the future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the policy on which the unexpected - property value was encountered. - """ - FORWARD = 'forward' - HTTPS_REDIRECT = 'https_redirect' - REDIRECT = 'redirect' - REJECT = 'reject' - - -class LoadBalancerListenerPolicyReference(): +class LoadBalancerLoggingDatapath(): """ - LoadBalancerListenerPolicyReference. + The datapath logging configuration for this load balancer. - :attr LoadBalancerListenerPolicyReferenceDeleted deleted: (optional) If present, - this property indicates the referenced resource has been deleted and provides - some supplementary information. - :attr str href: The listener policy's canonical URL. - :attr str id: The policy's unique identifier. + :attr bool active: Indicates whether datapath logging is active for this load + balancer. """ def __init__(self, - href: str, - id: str, - *, - deleted: 'LoadBalancerListenerPolicyReferenceDeleted' = None) -> None: + active: bool) -> None: """ - Initialize a LoadBalancerListenerPolicyReference object. + Initialize a LoadBalancerLoggingDatapath object. - :param str href: The listener policy's canonical URL. - :param str id: The policy's unique identifier. - :param LoadBalancerListenerPolicyReferenceDeleted deleted: (optional) If - present, this property indicates the referenced resource has been deleted - and provides - some supplementary information. + :param bool active: Indicates whether datapath logging is active for this + load balancer. """ - self.deleted = deleted - self.href = href - self.id = id + self.active = active @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPolicyReference': - """Initialize a LoadBalancerListenerPolicyReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerLoggingDatapath': + """Initialize a LoadBalancerLoggingDatapath object from a json dictionary.""" args = {} - if 'deleted' in _dict: - args['deleted'] = LoadBalancerListenerPolicyReferenceDeleted.from_dict(_dict.get('deleted')) - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in LoadBalancerListenerPolicyReference JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') + if 'active' in _dict: + args['active'] = _dict.get('active') else: - raise ValueError('Required property \'id\' not present in LoadBalancerListenerPolicyReference JSON') + raise ValueError('Required property \'active\' not present in LoadBalancerLoggingDatapath JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerListenerPolicyReference object from a json dictionary.""" + """Initialize a LoadBalancerLoggingDatapath object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id + if hasattr(self, 'active') and self.active is not None: + _dict['active'] = self.active return _dict def _to_dict(self): @@ -38925,56 +43016,69 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerListenerPolicyReference object.""" + """Return a `str` version of this LoadBalancerLoggingDatapath object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerListenerPolicyReference') -> bool: + def __eq__(self, other: 'LoadBalancerLoggingDatapath') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerListenerPolicyReference') -> bool: + def __ne__(self, other: 'LoadBalancerLoggingDatapath') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerListenerPolicyReferenceDeleted(): +class LoadBalancerPatch(): """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. + LoadBalancerPatch. - :attr str more_info: Link to documentation about deleted resources. + :attr LoadBalancerLogging logging: (optional) The logging configuration to use + for this load balancer. + To activate logging, the load balancer profile must support the specified + logging type. + :attr str name: (optional) The unique user-defined name for this load balancer. """ def __init__(self, - more_info: str) -> None: + *, + logging: 'LoadBalancerLogging' = None, + name: str = None) -> None: """ - Initialize a LoadBalancerListenerPolicyReferenceDeleted object. + Initialize a LoadBalancerPatch object. - :param str more_info: Link to documentation about deleted resources. + :param LoadBalancerLogging logging: (optional) The logging configuration to + use for this load balancer. + To activate logging, the load balancer profile must support the specified + logging type. + :param str name: (optional) The unique user-defined name for this load + balancer. """ - self.more_info = more_info + self.logging = logging + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPolicyReferenceDeleted': - """Initialize a LoadBalancerListenerPolicyReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerPatch': + """Initialize a LoadBalancerPatch object from a json dictionary.""" args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') - else: - raise ValueError('Required property \'more_info\' not present in LoadBalancerListenerPolicyReferenceDeleted JSON') + if 'logging' in _dict: + args['logging'] = LoadBalancerLogging.from_dict(_dict.get('logging')) + if 'name' in _dict: + args['name'] = _dict.get('name') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerListenerPolicyReferenceDeleted object from a json dictionary.""" + """Initialize a LoadBalancerPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'logging') and self.logging is not None: + _dict['logging'] = self.logging.to_dict() + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -38982,144 +43086,197 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerListenerPolicyReferenceDeleted object.""" + """Return a `str` version of this LoadBalancerPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerListenerPolicyReferenceDeleted') -> bool: + def __eq__(self, other: 'LoadBalancerPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerListenerPolicyReferenceDeleted') -> bool: + def __ne__(self, other: 'LoadBalancerPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerListenerPolicyRule(): +class LoadBalancerPool(): """ - LoadBalancerListenerPolicyRule. + LoadBalancerPool. - :attr str condition: The condition of the rule. - :attr datetime created_at: The date and time that this rule was created. - :attr str field: (optional) The field. This is applicable to `header`, `query`, - and `body` rule types. - If the rule type is `header`, this property is required. - If the rule type is `query`, this is optional. If specified and the rule - condition is not - `matches_regex`, the value must be percent-encoded. - If the rule type is `body`, this is optional. - :attr str href: The rule's canonical URL. - :attr str id: The rule's unique identifier. - :attr str provisioning_status: The provisioning status of this rule. - :attr str type: The type of the rule. - Body rules are applied to form-encoded request bodies using the `UTF-8` - character set. - :attr str value: Value to be matched for rule condition. - If the rule type is `query` and the rule condition is not `matches_regex`, the - value must be percent-encoded. + :attr str algorithm: The load balancing algorithm. + :attr datetime created_at: The date and time that this pool was created. + :attr LoadBalancerPoolHealthMonitor health_monitor: The health monitor of this + pool. + :attr str href: The pool's canonical URL. + :attr str id: The unique identifier for this load balancer pool. + :attr InstanceGroupReference instance_group: (optional) The instance group that + is managing this pool. + :attr List[LoadBalancerPoolMemberReference] members: (optional) The backend + server members of the pool. + :attr str name: The user-defined name for this load balancer pool. + :attr str protocol: The protocol used for this load balancer pool. + The enumerated values for this property are expected to expand in the future. + When processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the pool on which the unexpected + property value was encountered. + :attr str provisioning_status: The provisioning status of this pool. + :attr str proxy_protocol: The PROXY protocol setting for this pool: + - `v1`: Enabled with version 1 (human-readable header format) + - `v2`: Enabled with version 2 (binary header format) + - `disabled`: Disabled + Supported by load balancers in the `application` family (otherwise always + `disabled`). + :attr LoadBalancerPoolSessionPersistence session_persistence: (optional) The + session persistence of this pool. + The enumerated values for this property are expected to expand in the future. + When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the pool on which the unexpected + property value was encountered. """ def __init__(self, - condition: str, + algorithm: str, created_at: datetime, + health_monitor: 'LoadBalancerPoolHealthMonitor', href: str, id: str, + name: str, + protocol: str, provisioning_status: str, - type: str, - value: str, + proxy_protocol: str, *, - field: str = None) -> None: + instance_group: 'InstanceGroupReference' = None, + members: List['LoadBalancerPoolMemberReference'] = None, + session_persistence: 'LoadBalancerPoolSessionPersistence' = None) -> None: """ - Initialize a LoadBalancerListenerPolicyRule object. + Initialize a LoadBalancerPool object. - :param str condition: The condition of the rule. - :param datetime created_at: The date and time that this rule was created. - :param str href: The rule's canonical URL. - :param str id: The rule's unique identifier. - :param str provisioning_status: The provisioning status of this rule. - :param str type: The type of the rule. - Body rules are applied to form-encoded request bodies using the `UTF-8` - character set. - :param str value: Value to be matched for rule condition. - If the rule type is `query` and the rule condition is not `matches_regex`, - the value must be percent-encoded. - :param str field: (optional) The field. This is applicable to `header`, - `query`, and `body` rule types. - If the rule type is `header`, this property is required. - If the rule type is `query`, this is optional. If specified and the rule - condition is not - `matches_regex`, the value must be percent-encoded. - If the rule type is `body`, this is optional. + :param str algorithm: The load balancing algorithm. + :param datetime created_at: The date and time that this pool was created. + :param LoadBalancerPoolHealthMonitor health_monitor: The health monitor of + this pool. + :param str href: The pool's canonical URL. + :param str id: The unique identifier for this load balancer pool. + :param str name: The user-defined name for this load balancer pool. + :param str protocol: The protocol used for this load balancer pool. + The enumerated values for this property are expected to expand in the + future. When processing this property, check for and log unknown values. + Optionally halt processing and surface the error, or bypass the pool on + which the unexpected property value was encountered. + :param str provisioning_status: The provisioning status of this pool. + :param str proxy_protocol: The PROXY protocol setting for this pool: + - `v1`: Enabled with version 1 (human-readable header format) + - `v2`: Enabled with version 2 (binary header format) + - `disabled`: Disabled + Supported by load balancers in the `application` family (otherwise always + `disabled`). + :param InstanceGroupReference instance_group: (optional) The instance group + that is managing this pool. + :param List[LoadBalancerPoolMemberReference] members: (optional) The + backend server members of the pool. + :param LoadBalancerPoolSessionPersistence session_persistence: (optional) + The session persistence of this pool. + The enumerated values for this property are expected to expand in the + future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the pool on which the + unexpected + property value was encountered. """ - self.condition = condition + self.algorithm = algorithm self.created_at = created_at - self.field = field + self.health_monitor = health_monitor self.href = href self.id = id + self.instance_group = instance_group + self.members = members + self.name = name + self.protocol = protocol self.provisioning_status = provisioning_status - self.type = type - self.value = value + self.proxy_protocol = proxy_protocol + self.session_persistence = session_persistence @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPolicyRule': - """Initialize a LoadBalancerListenerPolicyRule object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerPool': + """Initialize a LoadBalancerPool object from a json dictionary.""" args = {} - if 'condition' in _dict: - args['condition'] = _dict.get('condition') + if 'algorithm' in _dict: + args['algorithm'] = _dict.get('algorithm') else: - raise ValueError('Required property \'condition\' not present in LoadBalancerListenerPolicyRule JSON') + raise ValueError('Required property \'algorithm\' not present in LoadBalancerPool JSON') if 'created_at' in _dict: args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError('Required property \'created_at\' not present in LoadBalancerListenerPolicyRule JSON') - if 'field' in _dict: - args['field'] = _dict.get('field') + raise ValueError('Required property \'created_at\' not present in LoadBalancerPool JSON') + if 'health_monitor' in _dict: + args['health_monitor'] = LoadBalancerPoolHealthMonitor.from_dict(_dict.get('health_monitor')) + else: + raise ValueError('Required property \'health_monitor\' not present in LoadBalancerPool JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in LoadBalancerListenerPolicyRule JSON') + raise ValueError('Required property \'href\' not present in LoadBalancerPool JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in LoadBalancerListenerPolicyRule JSON') + raise ValueError('Required property \'id\' not present in LoadBalancerPool JSON') + if 'instance_group' in _dict: + args['instance_group'] = InstanceGroupReference.from_dict(_dict.get('instance_group')) + if 'members' in _dict: + args['members'] = [LoadBalancerPoolMemberReference.from_dict(x) for x in _dict.get('members')] + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in LoadBalancerPool JSON') + if 'protocol' in _dict: + args['protocol'] = _dict.get('protocol') + else: + raise ValueError('Required property \'protocol\' not present in LoadBalancerPool JSON') if 'provisioning_status' in _dict: args['provisioning_status'] = _dict.get('provisioning_status') else: - raise ValueError('Required property \'provisioning_status\' not present in LoadBalancerListenerPolicyRule JSON') - if 'type' in _dict: - args['type'] = _dict.get('type') - else: - raise ValueError('Required property \'type\' not present in LoadBalancerListenerPolicyRule JSON') - if 'value' in _dict: - args['value'] = _dict.get('value') + raise ValueError('Required property \'provisioning_status\' not present in LoadBalancerPool JSON') + if 'proxy_protocol' in _dict: + args['proxy_protocol'] = _dict.get('proxy_protocol') else: - raise ValueError('Required property \'value\' not present in LoadBalancerListenerPolicyRule JSON') + raise ValueError('Required property \'proxy_protocol\' not present in LoadBalancerPool JSON') + if 'session_persistence' in _dict: + args['session_persistence'] = LoadBalancerPoolSessionPersistence.from_dict(_dict.get('session_persistence')) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerListenerPolicyRule object from a json dictionary.""" + """Initialize a LoadBalancerPool object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'condition') and self.condition is not None: - _dict['condition'] = self.condition + if hasattr(self, 'algorithm') and self.algorithm is not None: + _dict['algorithm'] = self.algorithm if hasattr(self, 'created_at') and self.created_at is not None: _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'field') and self.field is not None: - _dict['field'] = self.field + if hasattr(self, 'health_monitor') and self.health_monitor is not None: + _dict['health_monitor'] = self.health_monitor.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id + if hasattr(self, 'instance_group') and self.instance_group is not None: + _dict['instance_group'] = self.instance_group.to_dict() + if hasattr(self, 'members') and self.members is not None: + _dict['members'] = [x.to_dict() for x in self.members] + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'protocol') and self.protocol is not None: + _dict['protocol'] = self.protocol if hasattr(self, 'provisioning_status') and self.provisioning_status is not None: _dict['provisioning_status'] = self.provisioning_status - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type - if hasattr(self, 'value') and self.value is not None: - _dict['value'] = self.value + if hasattr(self, 'proxy_protocol') and self.proxy_protocol is not None: + _dict['proxy_protocol'] = self.proxy_protocol + if hasattr(self, 'session_persistence') and self.session_persistence is not None: + _dict['session_persistence'] = self.session_persistence.to_dict() return _dict def _to_dict(self): @@ -39127,31 +43284,45 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerListenerPolicyRule object.""" + """Return a `str` version of this LoadBalancerPool object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerListenerPolicyRule') -> bool: + def __eq__(self, other: 'LoadBalancerPool') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerListenerPolicyRule') -> bool: + def __ne__(self, other: 'LoadBalancerPool') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ConditionEnum(str, Enum): + class AlgorithmEnum(str, Enum): """ - The condition of the rule. + The load balancing algorithm. """ - CONTAINS = 'contains' - EQUALS = 'equals' - MATCHES_REGEX = 'matches_regex' + LEAST_CONNECTIONS = 'least_connections' + ROUND_ROBIN = 'round_robin' + WEIGHTED_ROUND_ROBIN = 'weighted_round_robin' + + + class ProtocolEnum(str, Enum): + """ + The protocol used for this load balancer pool. + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the pool on which the unexpected + property value was encountered. + """ + HTTP = 'http' + HTTPS = 'https' + TCP = 'tcp' + UDP = 'udp' class ProvisioningStatusEnum(str, Enum): """ - The provisioning status of this rule. + The provisioning status of this pool. """ ACTIVE = 'active' CREATE_PENDING = 'create_pending' @@ -39161,55 +43332,178 @@ class ProvisioningStatusEnum(str, Enum): UPDATE_PENDING = 'update_pending' - class TypeEnum(str, Enum): + class ProxyProtocolEnum(str, Enum): """ - The type of the rule. - Body rules are applied to form-encoded request bodies using the `UTF-8` character - set. + The PROXY protocol setting for this pool: + - `v1`: Enabled with version 1 (human-readable header format) + - `v2`: Enabled with version 2 (binary header format) + - `disabled`: Disabled + Supported by load balancers in the `application` family (otherwise always + `disabled`). """ - BODY = 'body' - HEADER = 'header' - HOSTNAME = 'hostname' - PATH = 'path' - QUERY = 'query' + DISABLED = 'disabled' + V1 = 'v1' + V2 = 'v2' -class LoadBalancerListenerPolicyRuleCollection(): +class LoadBalancerPoolCollection(): """ - LoadBalancerListenerPolicyRuleCollection. + LoadBalancerPoolCollection. - :attr List[LoadBalancerListenerPolicyRule] rules: Collection of rules. + :attr List[LoadBalancerPool] pools: Collection of pools. """ def __init__(self, - rules: List['LoadBalancerListenerPolicyRule']) -> None: + pools: List['LoadBalancerPool']) -> None: """ - Initialize a LoadBalancerListenerPolicyRuleCollection object. + Initialize a LoadBalancerPoolCollection object. - :param List[LoadBalancerListenerPolicyRule] rules: Collection of rules. + :param List[LoadBalancerPool] pools: Collection of pools. + """ + self.pools = pools + + @classmethod + def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolCollection': + """Initialize a LoadBalancerPoolCollection object from a json dictionary.""" + args = {} + if 'pools' in _dict: + args['pools'] = [LoadBalancerPool.from_dict(x) for x in _dict.get('pools')] + else: + raise ValueError('Required property \'pools\' not present in LoadBalancerPoolCollection JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a LoadBalancerPoolCollection object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'pools') and self.pools is not None: + _dict['pools'] = [x.to_dict() for x in self.pools] + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this LoadBalancerPoolCollection object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'LoadBalancerPoolCollection') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'LoadBalancerPoolCollection') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class LoadBalancerPoolHealthMonitor(): + """ + LoadBalancerPoolHealthMonitor. + + :attr int delay: The health check interval in seconds. Interval must be greater + than timeout value. + :attr int max_retries: The health check max retries. + :attr int port: (optional) The health check port number. If specified, this + overrides the ports specified in the server member resources. + :attr int timeout: The health check timeout in seconds. + :attr str type: The protocol type of this load balancer pool health monitor. + The enumerated values for this property are expected to expand in the future. + When processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the health monitor on which the + unexpected property value was encountered. + :attr str url_path: (optional) The health check URL path. Applicable only if the + health monitor `type` is `http` or + `https`. This value must be in the format of an [origin-form request + target](https://tools.ietf.org/html/rfc7230#section-5.3.1). + """ + + def __init__(self, + delay: int, + max_retries: int, + timeout: int, + type: str, + *, + port: int = None, + url_path: str = None) -> None: + """ + Initialize a LoadBalancerPoolHealthMonitor object. + + :param int delay: The health check interval in seconds. Interval must be + greater than timeout value. + :param int max_retries: The health check max retries. + :param int timeout: The health check timeout in seconds. + :param str type: The protocol type of this load balancer pool health + monitor. + The enumerated values for this property are expected to expand in the + future. When processing this property, check for and log unknown values. + Optionally halt processing and surface the error, or bypass the health + monitor on which the unexpected property value was encountered. + :param int port: (optional) The health check port number. If specified, + this overrides the ports specified in the server member resources. + :param str url_path: (optional) The health check URL path. Applicable only + if the health monitor `type` is `http` or + `https`. This value must be in the format of an [origin-form request + target](https://tools.ietf.org/html/rfc7230#section-5.3.1). """ - self.rules = rules + self.delay = delay + self.max_retries = max_retries + self.port = port + self.timeout = timeout + self.type = type + self.url_path = url_path @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPolicyRuleCollection': - """Initialize a LoadBalancerListenerPolicyRuleCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolHealthMonitor': + """Initialize a LoadBalancerPoolHealthMonitor object from a json dictionary.""" args = {} - if 'rules' in _dict: - args['rules'] = [LoadBalancerListenerPolicyRule.from_dict(x) for x in _dict.get('rules')] + if 'delay' in _dict: + args['delay'] = _dict.get('delay') else: - raise ValueError('Required property \'rules\' not present in LoadBalancerListenerPolicyRuleCollection JSON') + raise ValueError('Required property \'delay\' not present in LoadBalancerPoolHealthMonitor JSON') + if 'max_retries' in _dict: + args['max_retries'] = _dict.get('max_retries') + else: + raise ValueError('Required property \'max_retries\' not present in LoadBalancerPoolHealthMonitor JSON') + if 'port' in _dict: + args['port'] = _dict.get('port') + if 'timeout' in _dict: + args['timeout'] = _dict.get('timeout') + else: + raise ValueError('Required property \'timeout\' not present in LoadBalancerPoolHealthMonitor JSON') + if 'type' in _dict: + args['type'] = _dict.get('type') + else: + raise ValueError('Required property \'type\' not present in LoadBalancerPoolHealthMonitor JSON') + if 'url_path' in _dict: + args['url_path'] = _dict.get('url_path') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerListenerPolicyRuleCollection object from a json dictionary.""" + """Initialize a LoadBalancerPoolHealthMonitor object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'rules') and self.rules is not None: - _dict['rules'] = [x.to_dict() for x in self.rules] + if hasattr(self, 'delay') and self.delay is not None: + _dict['delay'] = self.delay + if hasattr(self, 'max_retries') and self.max_retries is not None: + _dict['max_retries'] = self.max_retries + if hasattr(self, 'port') and self.port is not None: + _dict['port'] = self.port + if hasattr(self, 'timeout') and self.timeout is not None: + _dict['timeout'] = self.timeout + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'url_path') and self.url_path is not None: + _dict['url_path'] = self.url_path return _dict def _to_dict(self): @@ -39217,98 +43511,128 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerListenerPolicyRuleCollection object.""" + """Return a `str` version of this LoadBalancerPoolHealthMonitor object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerListenerPolicyRuleCollection') -> bool: + def __eq__(self, other: 'LoadBalancerPoolHealthMonitor') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerListenerPolicyRuleCollection') -> bool: + def __ne__(self, other: 'LoadBalancerPoolHealthMonitor') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerListenerPolicyRulePatch(): + class TypeEnum(str, Enum): + """ + The protocol type of this load balancer pool health monitor. + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the health monitor on which the + unexpected property value was encountered. + """ + HTTP = 'http' + HTTPS = 'https' + TCP = 'tcp' + + +class LoadBalancerPoolHealthMonitorPatch(): """ - LoadBalancerListenerPolicyRulePatch. + LoadBalancerPoolHealthMonitorPatch. - :attr str condition: (optional) The condition of the rule. - :attr str field: (optional) The field. This is applicable to `header`, `query`, - and `body` rule types. - If the rule type is `header`, this property is required. - If the rule type is `query`, this is optional. If specified and the rule - condition is not - `matches_regex`, the value must be percent-encoded. - If the rule type is `body`, this is optional. - :attr str type: (optional) The type of the rule. - Body rules are applied to form-encoded request bodies using the `UTF-8` - character set. - :attr str value: (optional) Value to be matched for rule condition. - If the rule type is `query` and the rule condition is not `matches_regex`, the - value must be percent-encoded. + :attr int delay: The health check interval in seconds. Interval must be greater + than timeout value. + :attr int max_retries: The health check max retries. + :attr int port: (optional) The health check port number. If specified, this + overrides the ports specified in the server member resources. Specify `null` to + remove an existing port value. + :attr int timeout: The health check timeout in seconds. + :attr str type: The protocol type of this load balancer pool health monitor. + :attr str url_path: (optional) The health check URL path. Applicable only if the + health monitor `type` is `http` or + `https`. This value must be in the format of an [origin-form request + target](https://tools.ietf.org/html/rfc7230#section-5.3.1). """ def __init__(self, + delay: int, + max_retries: int, + timeout: int, + type: str, *, - condition: str = None, - field: str = None, - type: str = None, - value: str = None) -> None: + port: int = None, + url_path: str = None) -> None: """ - Initialize a LoadBalancerListenerPolicyRulePatch object. + Initialize a LoadBalancerPoolHealthMonitorPatch object. - :param str condition: (optional) The condition of the rule. - :param str field: (optional) The field. This is applicable to `header`, - `query`, and `body` rule types. - If the rule type is `header`, this property is required. - If the rule type is `query`, this is optional. If specified and the rule - condition is not - `matches_regex`, the value must be percent-encoded. - If the rule type is `body`, this is optional. - :param str type: (optional) The type of the rule. - Body rules are applied to form-encoded request bodies using the `UTF-8` - character set. - :param str value: (optional) Value to be matched for rule condition. - If the rule type is `query` and the rule condition is not `matches_regex`, - the value must be percent-encoded. + :param int delay: The health check interval in seconds. Interval must be + greater than timeout value. + :param int max_retries: The health check max retries. + :param int timeout: The health check timeout in seconds. + :param str type: The protocol type of this load balancer pool health + monitor. + :param int port: (optional) The health check port number. If specified, + this overrides the ports specified in the server member resources. Specify + `null` to remove an existing port value. + :param str url_path: (optional) The health check URL path. Applicable only + if the health monitor `type` is `http` or + `https`. This value must be in the format of an [origin-form request + target](https://tools.ietf.org/html/rfc7230#section-5.3.1). """ - self.condition = condition - self.field = field + self.delay = delay + self.max_retries = max_retries + self.port = port + self.timeout = timeout self.type = type - self.value = value + self.url_path = url_path @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPolicyRulePatch': - """Initialize a LoadBalancerListenerPolicyRulePatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolHealthMonitorPatch': + """Initialize a LoadBalancerPoolHealthMonitorPatch object from a json dictionary.""" args = {} - if 'condition' in _dict: - args['condition'] = _dict.get('condition') - if 'field' in _dict: - args['field'] = _dict.get('field') + if 'delay' in _dict: + args['delay'] = _dict.get('delay') + else: + raise ValueError('Required property \'delay\' not present in LoadBalancerPoolHealthMonitorPatch JSON') + if 'max_retries' in _dict: + args['max_retries'] = _dict.get('max_retries') + else: + raise ValueError('Required property \'max_retries\' not present in LoadBalancerPoolHealthMonitorPatch JSON') + if 'port' in _dict: + args['port'] = _dict.get('port') + if 'timeout' in _dict: + args['timeout'] = _dict.get('timeout') + else: + raise ValueError('Required property \'timeout\' not present in LoadBalancerPoolHealthMonitorPatch JSON') if 'type' in _dict: args['type'] = _dict.get('type') - if 'value' in _dict: - args['value'] = _dict.get('value') + else: + raise ValueError('Required property \'type\' not present in LoadBalancerPoolHealthMonitorPatch JSON') + if 'url_path' in _dict: + args['url_path'] = _dict.get('url_path') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerListenerPolicyRulePatch object from a json dictionary.""" + """Initialize a LoadBalancerPoolHealthMonitorPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'condition') and self.condition is not None: - _dict['condition'] = self.condition - if hasattr(self, 'field') and self.field is not None: - _dict['field'] = self.field + if hasattr(self, 'delay') and self.delay is not None: + _dict['delay'] = self.delay + if hasattr(self, 'max_retries') and self.max_retries is not None: + _dict['max_retries'] = self.max_retries + if hasattr(self, 'port') and self.port is not None: + _dict['port'] = self.port + if hasattr(self, 'timeout') and self.timeout is not None: + _dict['timeout'] = self.timeout if hasattr(self, 'type') and self.type is not None: _dict['type'] = self.type - if hasattr(self, 'value') and self.value is not None: - _dict['value'] = self.value + if hasattr(self, 'url_path') and self.url_path is not None: + _dict['url_path'] = self.url_path return _dict def _to_dict(self): @@ -39316,126 +43640,122 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerListenerPolicyRulePatch object.""" + """Return a `str` version of this LoadBalancerPoolHealthMonitorPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerListenerPolicyRulePatch') -> bool: + def __eq__(self, other: 'LoadBalancerPoolHealthMonitorPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerListenerPolicyRulePatch') -> bool: + def __ne__(self, other: 'LoadBalancerPoolHealthMonitorPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ConditionEnum(str, Enum): - """ - The condition of the rule. - """ - CONTAINS = 'contains' - EQUALS = 'equals' - MATCHES_REGEX = 'matches_regex' - - class TypeEnum(str, Enum): """ - The type of the rule. - Body rules are applied to form-encoded request bodies using the `UTF-8` character - set. + The protocol type of this load balancer pool health monitor. """ - BODY = 'body' - HEADER = 'header' - HOSTNAME = 'hostname' - PATH = 'path' - QUERY = 'query' + HTTP = 'http' + HTTPS = 'https' + TCP = 'tcp' -class LoadBalancerListenerPolicyRulePrototype(): +class LoadBalancerPoolHealthMonitorPrototype(): """ - LoadBalancerListenerPolicyRulePrototype. + LoadBalancerPoolHealthMonitorPrototype. - :attr str condition: The condition of the rule. - :attr str field: (optional) The field. This is applicable to `header`, `query`, - and `body` rule types. - If the rule type is `header`, this property is required. - If the rule type is `query`, this is optional. If specified and the rule - condition is not - `matches_regex`, the value must be percent-encoded. - If the rule type is `body`, this is optional. - :attr str type: The type of the rule. - Body rules are applied to form-encoded request bodies using the `UTF-8` - character set. - :attr str value: Value to be matched for rule condition. - If the rule type is `query` and the rule condition is not `matches_regex`, the - value must be percent-encoded. + :attr int delay: The health check interval in seconds. Interval must be greater + than timeout value. + :attr int max_retries: The health check max retries. + :attr int port: (optional) The health check port number. If specified, this + overrides the ports specified in the server member resources. + :attr int timeout: The health check timeout in seconds. + :attr str type: The protocol type of this load balancer pool health monitor. + :attr str url_path: (optional) The health check URL path. Applicable only if the + health monitor `type` is `http` or + `https`. This value must be in the format of an [origin-form request + target](https://tools.ietf.org/html/rfc7230#section-5.3.1). """ def __init__(self, - condition: str, + delay: int, + max_retries: int, + timeout: int, type: str, - value: str, *, - field: str = None) -> None: + port: int = None, + url_path: str = None) -> None: """ - Initialize a LoadBalancerListenerPolicyRulePrototype object. + Initialize a LoadBalancerPoolHealthMonitorPrototype object. - :param str condition: The condition of the rule. - :param str type: The type of the rule. - Body rules are applied to form-encoded request bodies using the `UTF-8` - character set. - :param str value: Value to be matched for rule condition. - If the rule type is `query` and the rule condition is not `matches_regex`, - the value must be percent-encoded. - :param str field: (optional) The field. This is applicable to `header`, - `query`, and `body` rule types. - If the rule type is `header`, this property is required. - If the rule type is `query`, this is optional. If specified and the rule - condition is not - `matches_regex`, the value must be percent-encoded. - If the rule type is `body`, this is optional. + :param int delay: The health check interval in seconds. Interval must be + greater than timeout value. + :param int max_retries: The health check max retries. + :param int timeout: The health check timeout in seconds. + :param str type: The protocol type of this load balancer pool health + monitor. + :param int port: (optional) The health check port number. If specified, + this overrides the ports specified in the server member resources. + :param str url_path: (optional) The health check URL path. Applicable only + if the health monitor `type` is `http` or + `https`. This value must be in the format of an [origin-form request + target](https://tools.ietf.org/html/rfc7230#section-5.3.1). """ - self.condition = condition - self.field = field + self.delay = delay + self.max_retries = max_retries + self.port = port + self.timeout = timeout self.type = type - self.value = value + self.url_path = url_path @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPolicyRulePrototype': - """Initialize a LoadBalancerListenerPolicyRulePrototype object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolHealthMonitorPrototype': + """Initialize a LoadBalancerPoolHealthMonitorPrototype object from a json dictionary.""" args = {} - if 'condition' in _dict: - args['condition'] = _dict.get('condition') + if 'delay' in _dict: + args['delay'] = _dict.get('delay') else: - raise ValueError('Required property \'condition\' not present in LoadBalancerListenerPolicyRulePrototype JSON') - if 'field' in _dict: - args['field'] = _dict.get('field') + raise ValueError('Required property \'delay\' not present in LoadBalancerPoolHealthMonitorPrototype JSON') + if 'max_retries' in _dict: + args['max_retries'] = _dict.get('max_retries') + else: + raise ValueError('Required property \'max_retries\' not present in LoadBalancerPoolHealthMonitorPrototype JSON') + if 'port' in _dict: + args['port'] = _dict.get('port') + if 'timeout' in _dict: + args['timeout'] = _dict.get('timeout') + else: + raise ValueError('Required property \'timeout\' not present in LoadBalancerPoolHealthMonitorPrototype JSON') if 'type' in _dict: args['type'] = _dict.get('type') else: - raise ValueError('Required property \'type\' not present in LoadBalancerListenerPolicyRulePrototype JSON') - if 'value' in _dict: - args['value'] = _dict.get('value') - else: - raise ValueError('Required property \'value\' not present in LoadBalancerListenerPolicyRulePrototype JSON') + raise ValueError('Required property \'type\' not present in LoadBalancerPoolHealthMonitorPrototype JSON') + if 'url_path' in _dict: + args['url_path'] = _dict.get('url_path') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerListenerPolicyRulePrototype object from a json dictionary.""" + """Initialize a LoadBalancerPoolHealthMonitorPrototype object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'condition') and self.condition is not None: - _dict['condition'] = self.condition - if hasattr(self, 'field') and self.field is not None: - _dict['field'] = self.field + if hasattr(self, 'delay') and self.delay is not None: + _dict['delay'] = self.delay + if hasattr(self, 'max_retries') and self.max_retries is not None: + _dict['max_retries'] = self.max_retries + if hasattr(self, 'port') and self.port is not None: + _dict['port'] = self.port + if hasattr(self, 'timeout') and self.timeout is not None: + _dict['timeout'] = self.timeout if hasattr(self, 'type') and self.type is not None: _dict['type'] = self.type - if hasattr(self, 'value') and self.value is not None: - _dict['value'] = self.value + if hasattr(self, 'url_path') and self.url_path is not None: + _dict['url_path'] = self.url_path return _dict def _to_dict(self): @@ -39443,102 +43763,79 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerListenerPolicyRulePrototype object.""" + """Return a `str` version of this LoadBalancerPoolHealthMonitorPrototype object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerListenerPolicyRulePrototype') -> bool: + def __eq__(self, other: 'LoadBalancerPoolHealthMonitorPrototype') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerListenerPolicyRulePrototype') -> bool: + def __ne__(self, other: 'LoadBalancerPoolHealthMonitorPrototype') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ConditionEnum(str, Enum): + class TypeEnum(str, Enum): """ - The condition of the rule. + The protocol type of this load balancer pool health monitor. """ - CONTAINS = 'contains' - EQUALS = 'equals' - MATCHES_REGEX = 'matches_regex' + HTTP = 'http' + HTTPS = 'https' + TCP = 'tcp' - class TypeEnum(str, Enum): - """ - The type of the rule. - Body rules are applied to form-encoded request bodies using the `UTF-8` character - set. +class LoadBalancerPoolIdentity(): + """ + Identifies a load balancer pool by a unique property. + + """ + + def __init__(self) -> None: """ - BODY = 'body' - HEADER = 'header' - HOSTNAME = 'hostname' - PATH = 'path' - QUERY = 'query' + Initialize a LoadBalancerPoolIdentity object. + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['LoadBalancerPoolIdentityById', 'LoadBalancerPoolIdentityByHref'])) + raise Exception(msg) -class LoadBalancerListenerPolicyRuleReference(): +class LoadBalancerPoolIdentityByName(): """ - LoadBalancerListenerPolicyRuleReference. + LoadBalancerPoolIdentityByName. - :attr LoadBalancerListenerPolicyRuleReferenceDeleted deleted: (optional) If - present, this property indicates the referenced resource has been deleted and - provides - some supplementary information. - :attr str href: The rule's canonical URL. - :attr str id: The rule's unique identifier. + :attr str name: The user-defined name for this load balancer pool. """ def __init__(self, - href: str, - id: str, - *, - deleted: 'LoadBalancerListenerPolicyRuleReferenceDeleted' = None) -> None: + name: str) -> None: """ - Initialize a LoadBalancerListenerPolicyRuleReference object. + Initialize a LoadBalancerPoolIdentityByName object. - :param str href: The rule's canonical URL. - :param str id: The rule's unique identifier. - :param LoadBalancerListenerPolicyRuleReferenceDeleted deleted: (optional) - If present, this property indicates the referenced resource has been - deleted and provides - some supplementary information. + :param str name: The user-defined name for this load balancer pool. """ - self.deleted = deleted - self.href = href - self.id = id + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPolicyRuleReference': - """Initialize a LoadBalancerListenerPolicyRuleReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolIdentityByName': + """Initialize a LoadBalancerPoolIdentityByName object from a json dictionary.""" args = {} - if 'deleted' in _dict: - args['deleted'] = LoadBalancerListenerPolicyRuleReferenceDeleted.from_dict(_dict.get('deleted')) - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in LoadBalancerListenerPolicyRuleReference JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') + if 'name' in _dict: + args['name'] = _dict.get('name') else: - raise ValueError('Required property \'id\' not present in LoadBalancerListenerPolicyRuleReference JSON') + raise ValueError('Required property \'name\' not present in LoadBalancerPoolIdentityByName JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerListenerPolicyRuleReference object from a json dictionary.""" + """Initialize a LoadBalancerPoolIdentityByName object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -39546,56 +43843,154 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerListenerPolicyRuleReference object.""" + """Return a `str` version of this LoadBalancerPoolIdentityByName object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerListenerPolicyRuleReference') -> bool: + def __eq__(self, other: 'LoadBalancerPoolIdentityByName') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerListenerPolicyRuleReference') -> bool: + def __ne__(self, other: 'LoadBalancerPoolIdentityByName') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerListenerPolicyRuleReferenceDeleted(): +class LoadBalancerPoolMember(): """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. + LoadBalancerPoolMember. - :attr str more_info: Link to documentation about deleted resources. + :attr datetime created_at: The date and time that this member was created. + :attr str health: Health of the server member in the pool. + :attr str href: The member's canonical URL. + :attr str id: The unique identifier for this load balancer pool member. + :attr int port: The port the member will receive load balancer traffic on. + Applies only to load balancer traffic received on a listener with a single port. + (If the traffic is received on a listener with a port range, the member will + receive the traffic on the same port the listener received it on.) + This port will also be used for health checks unless the `port` property of + `health_monitor` property is specified. + :attr str provisioning_status: The provisioning status of this member. + :attr LoadBalancerPoolMemberTarget target: The pool member target. Load + balancers in the `network` family support virtual server + instances. Load balancers in the `application` family support IP addresses. If + the load + balancer has route mode enabled, the member must be in a zone the load balancer + has a + subnet in. + :attr int weight: (optional) Weight of the server member. Applicable only if the + pool algorithm is + `weighted_round_robin`. """ def __init__(self, - more_info: str) -> None: + created_at: datetime, + health: str, + href: str, + id: str, + port: int, + provisioning_status: str, + target: 'LoadBalancerPoolMemberTarget', + *, + weight: int = None) -> None: """ - Initialize a LoadBalancerListenerPolicyRuleReferenceDeleted object. + Initialize a LoadBalancerPoolMember object. - :param str more_info: Link to documentation about deleted resources. + :param datetime created_at: The date and time that this member was created. + :param str health: Health of the server member in the pool. + :param str href: The member's canonical URL. + :param str id: The unique identifier for this load balancer pool member. + :param int port: The port the member will receive load balancer traffic on. + Applies only to load balancer traffic received on a listener with a single + port. (If the traffic is received on a listener with a port range, the + member will receive the traffic on the same port the listener received it + on.) + This port will also be used for health checks unless the `port` property of + `health_monitor` property is specified. + :param str provisioning_status: The provisioning status of this member. + :param LoadBalancerPoolMemberTarget target: The pool member target. Load + balancers in the `network` family support virtual server + instances. Load balancers in the `application` family support IP addresses. + If the load + balancer has route mode enabled, the member must be in a zone the load + balancer has a + subnet in. + :param int weight: (optional) Weight of the server member. Applicable only + if the pool algorithm is + `weighted_round_robin`. """ - self.more_info = more_info + self.created_at = created_at + self.health = health + self.href = href + self.id = id + self.port = port + self.provisioning_status = provisioning_status + self.target = target + self.weight = weight @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPolicyRuleReferenceDeleted': - """Initialize a LoadBalancerListenerPolicyRuleReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolMember': + """Initialize a LoadBalancerPoolMember object from a json dictionary.""" args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError('Required property \'more_info\' not present in LoadBalancerListenerPolicyRuleReferenceDeleted JSON') + raise ValueError('Required property \'created_at\' not present in LoadBalancerPoolMember JSON') + if 'health' in _dict: + args['health'] = _dict.get('health') + else: + raise ValueError('Required property \'health\' not present in LoadBalancerPoolMember JSON') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in LoadBalancerPoolMember JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in LoadBalancerPoolMember JSON') + if 'port' in _dict: + args['port'] = _dict.get('port') + else: + raise ValueError('Required property \'port\' not present in LoadBalancerPoolMember JSON') + if 'provisioning_status' in _dict: + args['provisioning_status'] = _dict.get('provisioning_status') + else: + raise ValueError('Required property \'provisioning_status\' not present in LoadBalancerPoolMember JSON') + if 'target' in _dict: + args['target'] = _dict.get('target') + else: + raise ValueError('Required property \'target\' not present in LoadBalancerPoolMember JSON') + if 'weight' in _dict: + args['weight'] = _dict.get('weight') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerListenerPolicyRuleReferenceDeleted object from a json dictionary.""" + """Initialize a LoadBalancerPoolMember object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'health') and self.health is not None: + _dict['health'] = self.health + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'port') and self.port is not None: + _dict['port'] = self.port + if hasattr(self, 'provisioning_status') and self.provisioning_status is not None: + _dict['provisioning_status'] = self.provisioning_status + if hasattr(self, 'target') and self.target is not None: + if isinstance(self.target, dict): + _dict['target'] = self.target + else: + _dict['target'] = self.target.to_dict() + if hasattr(self, 'weight') and self.weight is not None: + _dict['weight'] = self.weight return _dict def _to_dict(self): @@ -39603,243 +43998,76 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerListenerPolicyRuleReferenceDeleted object.""" + """Return a `str` version of this LoadBalancerPoolMember object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerListenerPolicyRuleReferenceDeleted') -> bool: + def __eq__(self, other: 'LoadBalancerPoolMember') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerListenerPolicyRuleReferenceDeleted') -> bool: + def __ne__(self, other: 'LoadBalancerPoolMember') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerListenerPolicyTarget(): - """ - - If `action` is `forward`, the response is a `LoadBalancerPoolReference` - - If `action` is `redirect`, the response is a `LoadBalancerListenerPolicyRedirectURL` - - If `action` is `https_redirect`, the response is a - `LoadBalancerListenerHTTPSRedirect`. - - """ - - def __init__(self) -> None: + class HealthEnum(str, Enum): """ - Initialize a LoadBalancerListenerPolicyTarget object. - + Health of the server member in the pool. """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['LoadBalancerListenerPolicyTargetLoadBalancerPoolReference', 'LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL', 'LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect'])) - raise Exception(msg) - -class LoadBalancerListenerPolicyTargetPatch(): - """ - - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. - - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. - - If `action` is `https_redirect`, specify a - `LoadBalancerListenerPolicyHTTPSRedirectPatch`. - - """ + FAULTED = 'faulted' + OK = 'ok' + UNKNOWN = 'unknown' - def __init__(self) -> None: - """ - Initialize a LoadBalancerListenerPolicyTargetPatch object. + class ProvisioningStatusEnum(str, Enum): """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity', 'LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch', 'LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch'])) - raise Exception(msg) - -class LoadBalancerListenerPolicyTargetPrototype(): - """ - - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. - - If `action` is `redirect`, specify a - `LoadBalancerListenerPolicyRedirectURLPrototype`. - - If `action` is `https_redirect`, specify a - `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. - - """ - - def __init__(self) -> None: + The provisioning status of this member. """ - Initialize a LoadBalancerListenerPolicyTargetPrototype object. + ACTIVE = 'active' + CREATE_PENDING = 'create_pending' + DELETE_PENDING = 'delete_pending' + FAILED = 'failed' + MAINTENANCE_PENDING = 'maintenance_pending' + UPDATE_PENDING = 'update_pending' - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity', 'LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype', 'LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype'])) - raise Exception(msg) -class LoadBalancerListenerPrototypeLoadBalancerContext(): +class LoadBalancerPoolMemberCollection(): """ - LoadBalancerListenerPrototypeLoadBalancerContext. + LoadBalancerPoolMemberCollection. - :attr bool accept_proxy_protocol: (optional) If set to `true`, this listener - will accept and forward PROXY protocol information. Supported by load balancers - in the `application` family (otherwise always `false`). Additional restrictions: - - If this listener has `https_redirect` specified, its `accept_proxy_protocol` - value must - match the `accept_proxy_protocol` value of the `https_redirect` listener. - - If this listener is the target of another listener's `https_redirect`, its - `accept_proxy_protocol` value must match that listener's - `accept_proxy_protocol` value. - :attr int connection_limit: (optional) The connection limit of the listener. - :attr LoadBalancerPoolIdentityByName default_pool: (optional) The default pool - for this listener. If specified, the pool's protocol must match the - listener's protocol, or the protocols must be compatible. At present, the - compatible - protocols are `http` and `https`. - If unspecified, this listener will be created with no default pool, but one may - be - subsequently set. - :attr int port: (optional) The listener port number, or the inclusive lower - bound of the port range. Each listener in the load balancer must have a unique - `port` and `protocol` combination. - Not supported for load balancers operating with route mode enabled. - :attr int port_max: (optional) The inclusive upper bound of the range of ports - used by this listener. Must not be less than `port_min`. - At present, only load balancers operating with route mode enabled, and public - load balancers in the `network` family support different values for `port_min` - and - `port_max`. When route mode is enabled, the value `65535` must be specified. - The specified port range must not overlap with port ranges used by other - listeners for this load balancer using the same protocol. - :attr int port_min: (optional) The inclusive lower bound of the range of ports - used by this listener. Must not be greater than `port_max`. - At present, only load balancers operating with route mode enabled, and public - load balancers in the `network` family support different values for `port_min` - and - `port_max`. When route mode is enabled, the value `1` must be specified. - The specified port range must not overlap with port ranges used by other - listeners for this load balancer using the same protocol. - :attr str protocol: The listener protocol. Load balancers in the `network` - family support `tcp` and - `udp` (if `udp_supported` is `true`). Load balancers in the `application` family - support `tcp`, `http`, and `https`. Each listener in the load balancer must have - a unique `port` and `protocol` combination. - The enumerated values for this property are expected to expand in the future. - When processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the listener on which the unexpected - property value was encountered. + :attr List[LoadBalancerPoolMember] members: Collection of members. """ def __init__(self, - protocol: str, - *, - accept_proxy_protocol: bool = None, - connection_limit: int = None, - default_pool: 'LoadBalancerPoolIdentityByName' = None, - port: int = None, - port_max: int = None, - port_min: int = None) -> None: + members: List['LoadBalancerPoolMember']) -> None: """ - Initialize a LoadBalancerListenerPrototypeLoadBalancerContext object. + Initialize a LoadBalancerPoolMemberCollection object. - :param str protocol: The listener protocol. Load balancers in the `network` - family support `tcp` and - `udp` (if `udp_supported` is `true`). Load balancers in the `application` - family support `tcp`, `http`, and `https`. Each listener in the load - balancer must have a unique `port` and `protocol` combination. - The enumerated values for this property are expected to expand in the - future. When processing this property, check for and log unknown values. - Optionally halt processing and surface the error, or bypass the listener on - which the unexpected property value was encountered. - :param bool accept_proxy_protocol: (optional) If set to `true`, this - listener will accept and forward PROXY protocol information. Supported by - load balancers in the `application` family (otherwise always `false`). - Additional restrictions: - - If this listener has `https_redirect` specified, its - `accept_proxy_protocol` value must - match the `accept_proxy_protocol` value of the `https_redirect` listener. - - If this listener is the target of another listener's `https_redirect`, - its - `accept_proxy_protocol` value must match that listener's - `accept_proxy_protocol` value. - :param int connection_limit: (optional) The connection limit of the - listener. - :param LoadBalancerPoolIdentityByName default_pool: (optional) The default - pool for this listener. If specified, the pool's protocol must match the - listener's protocol, or the protocols must be compatible. At present, the - compatible - protocols are `http` and `https`. - If unspecified, this listener will be created with no default pool, but one - may be - subsequently set. - :param int port: (optional) The listener port number, or the inclusive - lower bound of the port range. Each listener in the load balancer must have - a unique `port` and `protocol` combination. - Not supported for load balancers operating with route mode enabled. - :param int port_max: (optional) The inclusive upper bound of the range of - ports used by this listener. Must not be less than `port_min`. - At present, only load balancers operating with route mode enabled, and - public load balancers in the `network` family support different values for - `port_min` and - `port_max`. When route mode is enabled, the value `65535` must be - specified. - The specified port range must not overlap with port ranges used by other - listeners for this load balancer using the same protocol. - :param int port_min: (optional) The inclusive lower bound of the range of - ports used by this listener. Must not be greater than `port_max`. - At present, only load balancers operating with route mode enabled, and - public load balancers in the `network` family support different values for - `port_min` and - `port_max`. When route mode is enabled, the value `1` must be specified. - The specified port range must not overlap with port ranges used by other - listeners for this load balancer using the same protocol. + :param List[LoadBalancerPoolMember] members: Collection of members. """ - self.accept_proxy_protocol = accept_proxy_protocol - self.connection_limit = connection_limit - self.default_pool = default_pool - self.port = port - self.port_max = port_max - self.port_min = port_min - self.protocol = protocol + self.members = members @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerPrototypeLoadBalancerContext': - """Initialize a LoadBalancerListenerPrototypeLoadBalancerContext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolMemberCollection': + """Initialize a LoadBalancerPoolMemberCollection object from a json dictionary.""" args = {} - if 'accept_proxy_protocol' in _dict: - args['accept_proxy_protocol'] = _dict.get('accept_proxy_protocol') - if 'connection_limit' in _dict: - args['connection_limit'] = _dict.get('connection_limit') - if 'default_pool' in _dict: - args['default_pool'] = LoadBalancerPoolIdentityByName.from_dict(_dict.get('default_pool')) - if 'port' in _dict: - args['port'] = _dict.get('port') - if 'port_max' in _dict: - args['port_max'] = _dict.get('port_max') - if 'port_min' in _dict: - args['port_min'] = _dict.get('port_min') - if 'protocol' in _dict: - args['protocol'] = _dict.get('protocol') + if 'members' in _dict: + args['members'] = [LoadBalancerPoolMember.from_dict(x) for x in _dict.get('members')] else: - raise ValueError('Required property \'protocol\' not present in LoadBalancerListenerPrototypeLoadBalancerContext JSON') + raise ValueError('Required property \'members\' not present in LoadBalancerPoolMemberCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerListenerPrototypeLoadBalancerContext object from a json dictionary.""" + """Initialize a LoadBalancerPoolMemberCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'accept_proxy_protocol') and self.accept_proxy_protocol is not None: - _dict['accept_proxy_protocol'] = self.accept_proxy_protocol - if hasattr(self, 'connection_limit') and self.connection_limit is not None: - _dict['connection_limit'] = self.connection_limit - if hasattr(self, 'default_pool') and self.default_pool is not None: - _dict['default_pool'] = self.default_pool.to_dict() - if hasattr(self, 'port') and self.port is not None: - _dict['port'] = self.port - if hasattr(self, 'port_max') and self.port_max is not None: - _dict['port_max'] = self.port_max - if hasattr(self, 'port_min') and self.port_min is not None: - _dict['port_min'] = self.port_min - if hasattr(self, 'protocol') and self.protocol is not None: - _dict['protocol'] = self.protocol + if hasattr(self, 'members') and self.members is not None: + _dict['members'] = [x.to_dict() for x in self.members] return _dict def _to_dict(self): @@ -39847,96 +44075,105 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerListenerPrototypeLoadBalancerContext object.""" + """Return a `str` version of this LoadBalancerPoolMemberCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerListenerPrototypeLoadBalancerContext') -> bool: + def __eq__(self, other: 'LoadBalancerPoolMemberCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerListenerPrototypeLoadBalancerContext') -> bool: + def __ne__(self, other: 'LoadBalancerPoolMemberCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ProtocolEnum(str, Enum): - """ - The listener protocol. Load balancers in the `network` family support `tcp` and - `udp` (if `udp_supported` is `true`). Load balancers in the `application` family - support `tcp`, `http`, and `https`. Each listener in the load balancer must have a - unique `port` and `protocol` combination. - The enumerated values for this property are expected to expand in the future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the listener on which the unexpected - property value was encountered. - """ - HTTP = 'http' - HTTPS = 'https' - TCP = 'tcp' - UDP = 'udp' - - -class LoadBalancerListenerReference(): +class LoadBalancerPoolMemberPatch(): """ - LoadBalancerListenerReference. + LoadBalancerPoolMemberPatch. - :attr LoadBalancerListenerReferenceDeleted deleted: (optional) If present, this - property indicates the referenced resource has been deleted and provides - some supplementary information. - :attr str href: The listener's canonical URL. - :attr str id: The unique identifier for this load balancer listener. + :attr int port: (optional) The port the member will receive load balancer + traffic on. Applies only to load balancer traffic received on a listener with a + single port. (If the traffic is received on a listener with a port range, the + member will receive the traffic on the same port the listener received it on.) + This port will also be used for health checks unless the `port` property of + `health_monitor` property is specified. + The port must be unique across all members for all pools associated with this + pool's listener. + :attr LoadBalancerPoolMemberTargetPrototype target: (optional) The pool member + target. Load balancers in the `network` family support virtual server + instances. Load balancers in the `application` family support IP addresses. If + the load + balancer has route mode enabled, the member must be in a zone the load balancer + has a + subnet in. + :attr int weight: (optional) Weight of the server member. Applicable only if the + pool algorithm is + `weighted_round_robin`. """ def __init__(self, - href: str, - id: str, *, - deleted: 'LoadBalancerListenerReferenceDeleted' = None) -> None: + port: int = None, + target: 'LoadBalancerPoolMemberTargetPrototype' = None, + weight: int = None) -> None: """ - Initialize a LoadBalancerListenerReference object. + Initialize a LoadBalancerPoolMemberPatch object. - :param str href: The listener's canonical URL. - :param str id: The unique identifier for this load balancer listener. - :param LoadBalancerListenerReferenceDeleted deleted: (optional) If present, - this property indicates the referenced resource has been deleted and - provides - some supplementary information. + :param int port: (optional) The port the member will receive load balancer + traffic on. Applies only to load balancer traffic received on a listener + with a single port. (If the traffic is received on a listener with a port + range, the member will receive the traffic on the same port the listener + received it on.) + This port will also be used for health checks unless the `port` property of + `health_monitor` property is specified. + The port must be unique across all members for all pools associated with + this pool's listener. + :param LoadBalancerPoolMemberTargetPrototype target: (optional) The pool + member target. Load balancers in the `network` family support virtual + server + instances. Load balancers in the `application` family support IP addresses. + If the load + balancer has route mode enabled, the member must be in a zone the load + balancer has a + subnet in. + :param int weight: (optional) Weight of the server member. Applicable only + if the pool algorithm is + `weighted_round_robin`. """ - self.deleted = deleted - self.href = href - self.id = id + self.port = port + self.target = target + self.weight = weight @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerReference': - """Initialize a LoadBalancerListenerReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolMemberPatch': + """Initialize a LoadBalancerPoolMemberPatch object from a json dictionary.""" args = {} - if 'deleted' in _dict: - args['deleted'] = LoadBalancerListenerReferenceDeleted.from_dict(_dict.get('deleted')) - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in LoadBalancerListenerReference JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in LoadBalancerListenerReference JSON') + if 'port' in _dict: + args['port'] = _dict.get('port') + if 'target' in _dict: + args['target'] = _dict.get('target') + if 'weight' in _dict: + args['weight'] = _dict.get('weight') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerListenerReference object from a json dictionary.""" + """Initialize a LoadBalancerPoolMemberPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id + if hasattr(self, 'port') and self.port is not None: + _dict['port'] = self.port + if hasattr(self, 'target') and self.target is not None: + if isinstance(self.target, dict): + _dict['target'] = self.target + else: + _dict['target'] = self.target.to_dict() + if hasattr(self, 'weight') and self.weight is not None: + _dict['weight'] = self.weight return _dict def _to_dict(self): @@ -39944,56 +44181,108 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerListenerReference object.""" + """Return a `str` version of this LoadBalancerPoolMemberPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerListenerReference') -> bool: + def __eq__(self, other: 'LoadBalancerPoolMemberPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerListenerReference') -> bool: + def __ne__(self, other: 'LoadBalancerPoolMemberPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerListenerReferenceDeleted(): +class LoadBalancerPoolMemberPrototype(): """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. + LoadBalancerPoolMemberPrototype. - :attr str more_info: Link to documentation about deleted resources. + :attr int port: The port the member will receive load balancer traffic on. + Applies only to load balancer traffic received on a listener with a single port. + (If the traffic is received on a listener with a port range, the member will + receive the traffic on the same port the listener received it on.) + This port will also be used for health checks unless the `port` property of + `health_monitor` property is specified. + The port must be unique across all members for all pools associated with this + pool's listener. + :attr LoadBalancerPoolMemberTargetPrototype target: The pool member target. Load + balancers in the `network` family support virtual server + instances. Load balancers in the `application` family support IP addresses. If + the load + balancer has route mode enabled, the member must be in a zone the load balancer + has a + subnet in. + :attr int weight: (optional) Weight of the server member. Applicable only if the + pool algorithm is + `weighted_round_robin`. """ def __init__(self, - more_info: str) -> None: + port: int, + target: 'LoadBalancerPoolMemberTargetPrototype', + *, + weight: int = None) -> None: """ - Initialize a LoadBalancerListenerReferenceDeleted object. + Initialize a LoadBalancerPoolMemberPrototype object. - :param str more_info: Link to documentation about deleted resources. + :param int port: The port the member will receive load balancer traffic on. + Applies only to load balancer traffic received on a listener with a single + port. (If the traffic is received on a listener with a port range, the + member will receive the traffic on the same port the listener received it + on.) + This port will also be used for health checks unless the `port` property of + `health_monitor` property is specified. + The port must be unique across all members for all pools associated with + this pool's listener. + :param LoadBalancerPoolMemberTargetPrototype target: The pool member + target. Load balancers in the `network` family support virtual server + instances. Load balancers in the `application` family support IP addresses. + If the load + balancer has route mode enabled, the member must be in a zone the load + balancer has a + subnet in. + :param int weight: (optional) Weight of the server member. Applicable only + if the pool algorithm is + `weighted_round_robin`. """ - self.more_info = more_info + self.port = port + self.target = target + self.weight = weight @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerListenerReferenceDeleted': - """Initialize a LoadBalancerListenerReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolMemberPrototype': + """Initialize a LoadBalancerPoolMemberPrototype object from a json dictionary.""" args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') + if 'port' in _dict: + args['port'] = _dict.get('port') else: - raise ValueError('Required property \'more_info\' not present in LoadBalancerListenerReferenceDeleted JSON') + raise ValueError('Required property \'port\' not present in LoadBalancerPoolMemberPrototype JSON') + if 'target' in _dict: + args['target'] = _dict.get('target') + else: + raise ValueError('Required property \'target\' not present in LoadBalancerPoolMemberPrototype JSON') + if 'weight' in _dict: + args['weight'] = _dict.get('weight') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerListenerReferenceDeleted object from a json dictionary.""" + """Initialize a LoadBalancerPoolMemberPrototype object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'port') and self.port is not None: + _dict['port'] = self.port + if hasattr(self, 'target') and self.target is not None: + if isinstance(self.target, dict): + _dict['target'] = self.target + else: + _dict['target'] = self.target.to_dict() + if hasattr(self, 'weight') and self.weight is not None: + _dict['weight'] = self.weight return _dict def _to_dict(self): @@ -40001,56 +44290,79 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerListenerReferenceDeleted object.""" + """Return a `str` version of this LoadBalancerPoolMemberPrototype object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerListenerReferenceDeleted') -> bool: + def __eq__(self, other: 'LoadBalancerPoolMemberPrototype') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerListenerReferenceDeleted') -> bool: + def __ne__(self, other: 'LoadBalancerPoolMemberPrototype') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerLogging(): +class LoadBalancerPoolMemberReference(): """ - The logging configuration for this load balancer. + LoadBalancerPoolMemberReference. - :attr LoadBalancerLoggingDatapath datapath: (optional) The datapath logging - configuration for this load balancer. + :attr LoadBalancerPoolMemberReferenceDeleted deleted: (optional) If present, + this property indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str href: The member's canonical URL. + :attr str id: The unique identifier for this load balancer pool member. """ def __init__(self, + href: str, + id: str, *, - datapath: 'LoadBalancerLoggingDatapath' = None) -> None: + deleted: 'LoadBalancerPoolMemberReferenceDeleted' = None) -> None: """ - Initialize a LoadBalancerLogging object. + Initialize a LoadBalancerPoolMemberReference object. - :param LoadBalancerLoggingDatapath datapath: (optional) The datapath - logging configuration for this load balancer. + :param str href: The member's canonical URL. + :param str id: The unique identifier for this load balancer pool member. + :param LoadBalancerPoolMemberReferenceDeleted deleted: (optional) If + present, this property indicates the referenced resource has been deleted + and provides + some supplementary information. """ - self.datapath = datapath + self.deleted = deleted + self.href = href + self.id = id @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerLogging': - """Initialize a LoadBalancerLogging object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolMemberReference': + """Initialize a LoadBalancerPoolMemberReference object from a json dictionary.""" args = {} - if 'datapath' in _dict: - args['datapath'] = LoadBalancerLoggingDatapath.from_dict(_dict.get('datapath')) + if 'deleted' in _dict: + args['deleted'] = LoadBalancerPoolMemberReferenceDeleted.from_dict(_dict.get('deleted')) + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in LoadBalancerPoolMemberReference JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in LoadBalancerPoolMemberReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerLogging object from a json dictionary.""" + """Initialize a LoadBalancerPoolMemberReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'datapath') and self.datapath is not None: - _dict['datapath'] = self.datapath.to_dict() + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id return _dict def _to_dict(self): @@ -40058,57 +44370,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerLogging object.""" + """Return a `str` version of this LoadBalancerPoolMemberReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerLogging') -> bool: + def __eq__(self, other: 'LoadBalancerPoolMemberReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerLogging') -> bool: + def __ne__(self, other: 'LoadBalancerPoolMemberReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerLoggingDatapath(): +class LoadBalancerPoolMemberReferenceDeleted(): """ - The datapath logging configuration for this load balancer. + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. - :attr bool active: Indicates whether datapath logging is active for this load - balancer. + :attr str more_info: Link to documentation about deleted resources. """ def __init__(self, - active: bool) -> None: + more_info: str) -> None: """ - Initialize a LoadBalancerLoggingDatapath object. + Initialize a LoadBalancerPoolMemberReferenceDeleted object. - :param bool active: Indicates whether datapath logging is active for this - load balancer. + :param str more_info: Link to documentation about deleted resources. """ - self.active = active + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerLoggingDatapath': - """Initialize a LoadBalancerLoggingDatapath object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolMemberReferenceDeleted': + """Initialize a LoadBalancerPoolMemberReferenceDeleted object from a json dictionary.""" args = {} - if 'active' in _dict: - args['active'] = _dict.get('active') + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'active\' not present in LoadBalancerLoggingDatapath JSON') + raise ValueError('Required property \'more_info\' not present in LoadBalancerPoolMemberReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerLoggingDatapath object from a json dictionary.""" + """Initialize a LoadBalancerPoolMemberReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'active') and self.active is not None: - _dict['active'] = self.active + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -40116,69 +44427,158 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerLoggingDatapath object.""" + """Return a `str` version of this LoadBalancerPoolMemberReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerLoggingDatapath') -> bool: + def __eq__(self, other: 'LoadBalancerPoolMemberReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerLoggingDatapath') -> bool: + def __ne__(self, other: 'LoadBalancerPoolMemberReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerPatch(): +class LoadBalancerPoolMemberTarget(): """ - LoadBalancerPatch. + The pool member target. Load balancers in the `network` family support virtual server + instances. Load balancers in the `application` family support IP addresses. If the + load balancer has route mode enabled, the member must be in a zone the load balancer + has a subnet in. - :attr LoadBalancerLogging logging: (optional) The logging configuration to use - for this load balancer. - To activate logging, the load balancer profile must support the specified - logging type. - :attr str name: (optional) The unique user-defined name for this load balancer. + """ + + def __init__(self) -> None: + """ + Initialize a LoadBalancerPoolMemberTarget object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['LoadBalancerPoolMemberTargetInstanceReference', 'LoadBalancerPoolMemberTargetIP'])) + raise Exception(msg) + +class LoadBalancerPoolMemberTargetPrototype(): + """ + The pool member target. Load balancers in the `network` family support virtual server + instances. Load balancers in the `application` family support IP addresses. If the + load balancer has route mode enabled, the member must be in a zone the load balancer + has a subnet in. + + """ + + def __init__(self) -> None: + """ + Initialize a LoadBalancerPoolMemberTargetPrototype object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['LoadBalancerPoolMemberTargetPrototypeInstanceIdentity', 'LoadBalancerPoolMemberTargetPrototypeIP'])) + raise Exception(msg) + +class LoadBalancerPoolPatch(): + """ + LoadBalancerPoolPatch. + + :attr str algorithm: (optional) The load balancing algorithm. + :attr LoadBalancerPoolHealthMonitorPatch health_monitor: (optional) The health + monitor of this pool. + :attr str name: (optional) The user-defined name for this load balancer pool. + :attr str protocol: (optional) The protocol to use for this load balancer pool. + Load balancers in the `network` family support `tcp` and `udp` (if + `udp_supported` is `true`). Load balancers in the `application` family support + `tcp`, `http` and `https`. + If this pool is associated with a load balancer listener, the specified protocol + must be compatible with the listener's protocol. At present, the compatible + protocols are `http` and `https`. + :attr str proxy_protocol: (optional) The PROXY protocol setting for this pool: + - `v1`: Enabled with version 1 (human-readable header format) + - `v2`: Enabled with version 2 (binary header format) + - `disabled`: Disabled + Supported by load balancers in the `application` family (otherwise always + `disabled`). + :attr LoadBalancerPoolSessionPersistencePatch session_persistence: (optional) + The session persistence of this pool. """ def __init__(self, *, - logging: 'LoadBalancerLogging' = None, - name: str = None) -> None: + algorithm: str = None, + health_monitor: 'LoadBalancerPoolHealthMonitorPatch' = None, + name: str = None, + protocol: str = None, + proxy_protocol: str = None, + session_persistence: 'LoadBalancerPoolSessionPersistencePatch' = None) -> None: """ - Initialize a LoadBalancerPatch object. + Initialize a LoadBalancerPoolPatch object. - :param LoadBalancerLogging logging: (optional) The logging configuration to - use for this load balancer. - To activate logging, the load balancer profile must support the specified - logging type. - :param str name: (optional) The unique user-defined name for this load - balancer. + :param str algorithm: (optional) The load balancing algorithm. + :param LoadBalancerPoolHealthMonitorPatch health_monitor: (optional) The + health monitor of this pool. + :param str name: (optional) The user-defined name for this load balancer + pool. + :param str protocol: (optional) The protocol to use for this load balancer + pool. Load balancers in the `network` family support `tcp` and `udp` (if + `udp_supported` is `true`). Load balancers in the `application` family + support `tcp`, `http` and `https`. + If this pool is associated with a load balancer listener, the specified + protocol must be compatible with the listener's protocol. At present, the + compatible protocols are `http` and `https`. + :param str proxy_protocol: (optional) The PROXY protocol setting for this + pool: + - `v1`: Enabled with version 1 (human-readable header format) + - `v2`: Enabled with version 2 (binary header format) + - `disabled`: Disabled + Supported by load balancers in the `application` family (otherwise always + `disabled`). + :param LoadBalancerPoolSessionPersistencePatch session_persistence: + (optional) The session persistence of this pool. """ - self.logging = logging + self.algorithm = algorithm + self.health_monitor = health_monitor self.name = name + self.protocol = protocol + self.proxy_protocol = proxy_protocol + self.session_persistence = session_persistence @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerPatch': - """Initialize a LoadBalancerPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolPatch': + """Initialize a LoadBalancerPoolPatch object from a json dictionary.""" args = {} - if 'logging' in _dict: - args['logging'] = LoadBalancerLogging.from_dict(_dict.get('logging')) + if 'algorithm' in _dict: + args['algorithm'] = _dict.get('algorithm') + if 'health_monitor' in _dict: + args['health_monitor'] = LoadBalancerPoolHealthMonitorPatch.from_dict(_dict.get('health_monitor')) if 'name' in _dict: args['name'] = _dict.get('name') + if 'protocol' in _dict: + args['protocol'] = _dict.get('protocol') + if 'proxy_protocol' in _dict: + args['proxy_protocol'] = _dict.get('proxy_protocol') + if 'session_persistence' in _dict: + args['session_persistence'] = LoadBalancerPoolSessionPersistencePatch.from_dict(_dict.get('session_persistence')) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerPatch object from a json dictionary.""" + """Initialize a LoadBalancerPoolPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'logging') and self.logging is not None: - _dict['logging'] = self.logging.to_dict() + if hasattr(self, 'algorithm') and self.algorithm is not None: + _dict['algorithm'] = self.algorithm + if hasattr(self, 'health_monitor') and self.health_monitor is not None: + _dict['health_monitor'] = self.health_monitor.to_dict() if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name + if hasattr(self, 'protocol') and self.protocol is not None: + _dict['protocol'] = self.protocol + if hasattr(self, 'proxy_protocol') and self.proxy_protocol is not None: + _dict['proxy_protocol'] = self.proxy_protocol + if hasattr(self, 'session_persistence') and self.session_persistence is not None: + _dict['session_persistence'] = self.session_persistence.to_dict() return _dict def _to_dict(self): @@ -40186,168 +44586,157 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerPatch object.""" + """Return a `str` version of this LoadBalancerPoolPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerPatch') -> bool: + def __eq__(self, other: 'LoadBalancerPoolPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerPatch') -> bool: + def __ne__(self, other: 'LoadBalancerPoolPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerPool(): + class AlgorithmEnum(str, Enum): + """ + The load balancing algorithm. + """ + LEAST_CONNECTIONS = 'least_connections' + ROUND_ROBIN = 'round_robin' + WEIGHTED_ROUND_ROBIN = 'weighted_round_robin' + + + class ProtocolEnum(str, Enum): + """ + The protocol to use for this load balancer pool. Load balancers in the `network` + family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in + the `application` family support `tcp`, `http` and `https`. + If this pool is associated with a load balancer listener, the specified protocol + must be compatible with the listener's protocol. At present, the compatible + protocols are `http` and `https`. + """ + HTTP = 'http' + HTTPS = 'https' + TCP = 'tcp' + UDP = 'udp' + + + class ProxyProtocolEnum(str, Enum): + """ + The PROXY protocol setting for this pool: + - `v1`: Enabled with version 1 (human-readable header format) + - `v2`: Enabled with version 2 (binary header format) + - `disabled`: Disabled + Supported by load balancers in the `application` family (otherwise always + `disabled`). + """ + DISABLED = 'disabled' + V1 = 'v1' + V2 = 'v2' + + +class LoadBalancerPoolPrototype(): """ - LoadBalancerPool. + LoadBalancerPoolPrototype. :attr str algorithm: The load balancing algorithm. - :attr datetime created_at: The date and time that this pool was created. - :attr LoadBalancerPoolHealthMonitor health_monitor: The health monitor of this - pool. - :attr str href: The pool's canonical URL. - :attr str id: The unique identifier for this load balancer pool. - :attr InstanceGroupReference instance_group: (optional) The instance group that - is managing this pool. - :attr List[LoadBalancerPoolMemberReference] members: (optional) The backend - server members of the pool. - :attr str name: The user-defined name for this load balancer pool. - :attr str protocol: The protocol used for this load balancer pool. - The enumerated values for this property are expected to expand in the future. - When processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the pool on which the unexpected - property value was encountered. - :attr str provisioning_status: The provisioning status of this pool. - :attr str proxy_protocol: The PROXY protocol setting for this pool: + :attr LoadBalancerPoolHealthMonitorPrototype health_monitor: The health monitor + of this pool. + :attr List[LoadBalancerPoolMemberPrototype] members: (optional) The members for + this load balancer pool. For load balancers in the `network` family, the same + `port` and `target` tuple cannot be shared by a pool member of any other load + balancer in the same VPC. + :attr str name: (optional) The user-defined name for this load balancer pool. If + unspecified, the name will be a hyphenated list of randomly-selected words. + :attr str protocol: The protocol used for this load balancer pool. Load + balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is + `true`). Load balancers in the + `application` family support `tcp`, `http`, and `https`. + :attr str proxy_protocol: (optional) The PROXY protocol setting for this pool: - `v1`: Enabled with version 1 (human-readable header format) - `v2`: Enabled with version 2 (binary header format) - `disabled`: Disabled Supported by load balancers in the `application` family (otherwise always `disabled`). - :attr LoadBalancerPoolSessionPersistence session_persistence: (optional) The - session persistence of this pool. - The enumerated values for this property are expected to expand in the future. - When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the pool on which the unexpected - property value was encountered. + :attr LoadBalancerPoolSessionPersistencePrototype session_persistence: + (optional) The session persistence of this pool. """ def __init__(self, algorithm: str, - created_at: datetime, - health_monitor: 'LoadBalancerPoolHealthMonitor', - href: str, - id: str, - name: str, + health_monitor: 'LoadBalancerPoolHealthMonitorPrototype', protocol: str, - provisioning_status: str, - proxy_protocol: str, *, - instance_group: 'InstanceGroupReference' = None, - members: List['LoadBalancerPoolMemberReference'] = None, - session_persistence: 'LoadBalancerPoolSessionPersistence' = None) -> None: + members: List['LoadBalancerPoolMemberPrototype'] = None, + name: str = None, + proxy_protocol: str = None, + session_persistence: 'LoadBalancerPoolSessionPersistencePrototype' = None) -> None: """ - Initialize a LoadBalancerPool object. + Initialize a LoadBalancerPoolPrototype object. :param str algorithm: The load balancing algorithm. - :param datetime created_at: The date and time that this pool was created. - :param LoadBalancerPoolHealthMonitor health_monitor: The health monitor of - this pool. - :param str href: The pool's canonical URL. - :param str id: The unique identifier for this load balancer pool. - :param str name: The user-defined name for this load balancer pool. - :param str protocol: The protocol used for this load balancer pool. - The enumerated values for this property are expected to expand in the - future. When processing this property, check for and log unknown values. - Optionally halt processing and surface the error, or bypass the pool on - which the unexpected property value was encountered. - :param str provisioning_status: The provisioning status of this pool. - :param str proxy_protocol: The PROXY protocol setting for this pool: + :param LoadBalancerPoolHealthMonitorPrototype health_monitor: The health + monitor of this pool. + :param str protocol: The protocol used for this load balancer pool. Load + balancers in the `network` family support `tcp` and `udp` (if + `udp_supported` is `true`). Load balancers in the + `application` family support `tcp`, `http`, and `https`. + :param List[LoadBalancerPoolMemberPrototype] members: (optional) The + members for this load balancer pool. For load balancers in the `network` + family, the same `port` and `target` tuple cannot be shared by a pool + member of any other load balancer in the same VPC. + :param str name: (optional) The user-defined name for this load balancer + pool. If unspecified, the name will be a hyphenated list of + randomly-selected words. + :param str proxy_protocol: (optional) The PROXY protocol setting for this + pool: - `v1`: Enabled with version 1 (human-readable header format) - `v2`: Enabled with version 2 (binary header format) - `disabled`: Disabled Supported by load balancers in the `application` family (otherwise always `disabled`). - :param InstanceGroupReference instance_group: (optional) The instance group - that is managing this pool. - :param List[LoadBalancerPoolMemberReference] members: (optional) The - backend server members of the pool. - :param LoadBalancerPoolSessionPersistence session_persistence: (optional) - The session persistence of this pool. - The enumerated values for this property are expected to expand in the - future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the pool on which the - unexpected - property value was encountered. + :param LoadBalancerPoolSessionPersistencePrototype session_persistence: + (optional) The session persistence of this pool. """ self.algorithm = algorithm - self.created_at = created_at self.health_monitor = health_monitor - self.href = href - self.id = id - self.instance_group = instance_group self.members = members self.name = name self.protocol = protocol - self.provisioning_status = provisioning_status self.proxy_protocol = proxy_protocol self.session_persistence = session_persistence @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerPool': - """Initialize a LoadBalancerPool object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolPrototype': + """Initialize a LoadBalancerPoolPrototype object from a json dictionary.""" args = {} if 'algorithm' in _dict: args['algorithm'] = _dict.get('algorithm') else: - raise ValueError('Required property \'algorithm\' not present in LoadBalancerPool JSON') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - else: - raise ValueError('Required property \'created_at\' not present in LoadBalancerPool JSON') + raise ValueError('Required property \'algorithm\' not present in LoadBalancerPoolPrototype JSON') if 'health_monitor' in _dict: - args['health_monitor'] = LoadBalancerPoolHealthMonitor.from_dict(_dict.get('health_monitor')) - else: - raise ValueError('Required property \'health_monitor\' not present in LoadBalancerPool JSON') - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in LoadBalancerPool JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') + args['health_monitor'] = LoadBalancerPoolHealthMonitorPrototype.from_dict(_dict.get('health_monitor')) else: - raise ValueError('Required property \'id\' not present in LoadBalancerPool JSON') - if 'instance_group' in _dict: - args['instance_group'] = InstanceGroupReference.from_dict(_dict.get('instance_group')) + raise ValueError('Required property \'health_monitor\' not present in LoadBalancerPoolPrototype JSON') if 'members' in _dict: - args['members'] = [LoadBalancerPoolMemberReference.from_dict(x) for x in _dict.get('members')] + args['members'] = [LoadBalancerPoolMemberPrototype.from_dict(x) for x in _dict.get('members')] if 'name' in _dict: args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in LoadBalancerPool JSON') if 'protocol' in _dict: args['protocol'] = _dict.get('protocol') else: - raise ValueError('Required property \'protocol\' not present in LoadBalancerPool JSON') - if 'provisioning_status' in _dict: - args['provisioning_status'] = _dict.get('provisioning_status') - else: - raise ValueError('Required property \'provisioning_status\' not present in LoadBalancerPool JSON') + raise ValueError('Required property \'protocol\' not present in LoadBalancerPoolPrototype JSON') if 'proxy_protocol' in _dict: args['proxy_protocol'] = _dict.get('proxy_protocol') - else: - raise ValueError('Required property \'proxy_protocol\' not present in LoadBalancerPool JSON') if 'session_persistence' in _dict: - args['session_persistence'] = LoadBalancerPoolSessionPersistence.from_dict(_dict.get('session_persistence')) + args['session_persistence'] = LoadBalancerPoolSessionPersistencePrototype.from_dict(_dict.get('session_persistence')) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerPool object from a json dictionary.""" + """Initialize a LoadBalancerPoolPrototype object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -40355,24 +44744,14 @@ def to_dict(self) -> Dict: _dict = {} if hasattr(self, 'algorithm') and self.algorithm is not None: _dict['algorithm'] = self.algorithm - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) if hasattr(self, 'health_monitor') and self.health_monitor is not None: _dict['health_monitor'] = self.health_monitor.to_dict() - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'instance_group') and self.instance_group is not None: - _dict['instance_group'] = self.instance_group.to_dict() if hasattr(self, 'members') and self.members is not None: _dict['members'] = [x.to_dict() for x in self.members] if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name if hasattr(self, 'protocol') and self.protocol is not None: _dict['protocol'] = self.protocol - if hasattr(self, 'provisioning_status') and self.provisioning_status is not None: - _dict['provisioning_status'] = self.provisioning_status if hasattr(self, 'proxy_protocol') and self.proxy_protocol is not None: _dict['proxy_protocol'] = self.proxy_protocol if hasattr(self, 'session_persistence') and self.session_persistence is not None: @@ -40384,16 +44763,16 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerPool object.""" + """Return a `str` version of this LoadBalancerPoolPrototype object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerPool') -> bool: + def __eq__(self, other: 'LoadBalancerPoolPrototype') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerPool') -> bool: + def __ne__(self, other: 'LoadBalancerPoolPrototype') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other @@ -40408,11 +44787,10 @@ class AlgorithmEnum(str, Enum): class ProtocolEnum(str, Enum): """ - The protocol used for this load balancer pool. - The enumerated values for this property are expected to expand in the future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the pool on which the unexpected - property value was encountered. + The protocol used for this load balancer pool. Load balancers in the `network` + family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in + the + `application` family support `tcp`, `http`, and `https`. """ HTTP = 'http' HTTPS = 'https' @@ -40420,68 +44798,147 @@ class ProtocolEnum(str, Enum): UDP = 'udp' - class ProvisioningStatusEnum(str, Enum): + class ProxyProtocolEnum(str, Enum): """ - The provisioning status of this pool. + The PROXY protocol setting for this pool: + - `v1`: Enabled with version 1 (human-readable header format) + - `v2`: Enabled with version 2 (binary header format) + - `disabled`: Disabled + Supported by load balancers in the `application` family (otherwise always + `disabled`). """ - ACTIVE = 'active' - CREATE_PENDING = 'create_pending' - DELETE_PENDING = 'delete_pending' - FAILED = 'failed' - MAINTENANCE_PENDING = 'maintenance_pending' - UPDATE_PENDING = 'update_pending' + DISABLED = 'disabled' + V1 = 'v1' + V2 = 'v2' + + +class LoadBalancerPoolReference(): + """ + LoadBalancerPoolReference. + + :attr LoadBalancerPoolReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str href: The pool's canonical URL. + :attr str id: The unique identifier for this load balancer pool. + :attr str name: The user-defined name for this load balancer pool. + """ + + def __init__(self, + href: str, + id: str, + name: str, + *, + deleted: 'LoadBalancerPoolReferenceDeleted' = None) -> None: + """ + Initialize a LoadBalancerPoolReference object. + + :param str href: The pool's canonical URL. + :param str id: The unique identifier for this load balancer pool. + :param str name: The user-defined name for this load balancer pool. + :param LoadBalancerPoolReferenceDeleted deleted: (optional) If present, + this property indicates the referenced resource has been deleted and + provides + some supplementary information. + """ + self.deleted = deleted + self.href = href + self.id = id + self.name = name + + @classmethod + def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolReference': + """Initialize a LoadBalancerPoolReference object from a json dictionary.""" + args = {} + if 'deleted' in _dict: + args['deleted'] = LoadBalancerPoolReferenceDeleted.from_dict(_dict.get('deleted')) + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in LoadBalancerPoolReference JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in LoadBalancerPoolReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in LoadBalancerPoolReference JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a LoadBalancerPoolReference object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + return _dict + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() - class ProxyProtocolEnum(str, Enum): - """ - The PROXY protocol setting for this pool: - - `v1`: Enabled with version 1 (human-readable header format) - - `v2`: Enabled with version 2 (binary header format) - - `disabled`: Disabled - Supported by load balancers in the `application` family (otherwise always - `disabled`). - """ - DISABLED = 'disabled' - V1 = 'v1' - V2 = 'v2' + def __str__(self) -> str: + """Return a `str` version of this LoadBalancerPoolReference object.""" + return json.dumps(self.to_dict(), indent=2) + def __eq__(self, other: 'LoadBalancerPoolReference') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ -class LoadBalancerPoolCollection(): + def __ne__(self, other: 'LoadBalancerPoolReference') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class LoadBalancerPoolReferenceDeleted(): """ - LoadBalancerPoolCollection. + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. - :attr List[LoadBalancerPool] pools: Collection of pools. + :attr str more_info: Link to documentation about deleted resources. """ def __init__(self, - pools: List['LoadBalancerPool']) -> None: + more_info: str) -> None: """ - Initialize a LoadBalancerPoolCollection object. + Initialize a LoadBalancerPoolReferenceDeleted object. - :param List[LoadBalancerPool] pools: Collection of pools. + :param str more_info: Link to documentation about deleted resources. """ - self.pools = pools + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolCollection': - """Initialize a LoadBalancerPoolCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolReferenceDeleted': + """Initialize a LoadBalancerPoolReferenceDeleted object from a json dictionary.""" args = {} - if 'pools' in _dict: - args['pools'] = [LoadBalancerPool.from_dict(x) for x in _dict.get('pools')] + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'pools\' not present in LoadBalancerPoolCollection JSON') + raise ValueError('Required property \'more_info\' not present in LoadBalancerPoolReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerPoolCollection object from a json dictionary.""" + """Initialize a LoadBalancerPoolReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'pools') and self.pools is not None: - _dict['pools'] = [x.to_dict() for x in self.pools] + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -40489,121 +44946,70 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerPoolCollection object.""" + """Return a `str` version of this LoadBalancerPoolReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerPoolCollection') -> bool: + def __eq__(self, other: 'LoadBalancerPoolReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerPoolCollection') -> bool: + def __ne__(self, other: 'LoadBalancerPoolReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerPoolHealthMonitor(): +class LoadBalancerPoolSessionPersistence(): """ - LoadBalancerPoolHealthMonitor. + LoadBalancerPoolSessionPersistence. - :attr int delay: The health check interval in seconds. Interval must be greater - than timeout value. - :attr int max_retries: The health check max retries. - :attr int port: (optional) The health check port number. If specified, this - overrides the ports specified in the server member resources. - :attr int timeout: The health check timeout in seconds. - :attr str type: The protocol type of this load balancer pool health monitor. - The enumerated values for this property are expected to expand in the future. - When processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the health monitor on which the - unexpected property value was encountered. - :attr str url_path: (optional) The health check URL path. Applicable only if the - health monitor `type` is `http` or - `https`. This value must be in the format of an [origin-form request - target](https://tools.ietf.org/html/rfc7230#section-5.3.1). + :attr str cookie_name: (optional) The session persistence cookie name. + Applicable only for type `app_cookie`. Names starting with `IBM` are not + allowed. + :attr str type: The session persistence type. The `http_cookie` and `app_cookie` + types are applicable only to the `http` and `https` protocols. """ def __init__(self, - delay: int, - max_retries: int, - timeout: int, type: str, *, - port: int = None, - url_path: str = None) -> None: + cookie_name: str = None) -> None: """ - Initialize a LoadBalancerPoolHealthMonitor object. + Initialize a LoadBalancerPoolSessionPersistence object. - :param int delay: The health check interval in seconds. Interval must be - greater than timeout value. - :param int max_retries: The health check max retries. - :param int timeout: The health check timeout in seconds. - :param str type: The protocol type of this load balancer pool health - monitor. - The enumerated values for this property are expected to expand in the - future. When processing this property, check for and log unknown values. - Optionally halt processing and surface the error, or bypass the health - monitor on which the unexpected property value was encountered. - :param int port: (optional) The health check port number. If specified, - this overrides the ports specified in the server member resources. - :param str url_path: (optional) The health check URL path. Applicable only - if the health monitor `type` is `http` or - `https`. This value must be in the format of an [origin-form request - target](https://tools.ietf.org/html/rfc7230#section-5.3.1). + :param str type: The session persistence type. The `http_cookie` and + `app_cookie` types are applicable only to the `http` and `https` protocols. + :param str cookie_name: (optional) The session persistence cookie name. + Applicable only for type `app_cookie`. Names starting with `IBM` are not + allowed. """ - self.delay = delay - self.max_retries = max_retries - self.port = port - self.timeout = timeout + self.cookie_name = cookie_name self.type = type - self.url_path = url_path @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolHealthMonitor': - """Initialize a LoadBalancerPoolHealthMonitor object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolSessionPersistence': + """Initialize a LoadBalancerPoolSessionPersistence object from a json dictionary.""" args = {} - if 'delay' in _dict: - args['delay'] = _dict.get('delay') - else: - raise ValueError('Required property \'delay\' not present in LoadBalancerPoolHealthMonitor JSON') - if 'max_retries' in _dict: - args['max_retries'] = _dict.get('max_retries') - else: - raise ValueError('Required property \'max_retries\' not present in LoadBalancerPoolHealthMonitor JSON') - if 'port' in _dict: - args['port'] = _dict.get('port') - if 'timeout' in _dict: - args['timeout'] = _dict.get('timeout') - else: - raise ValueError('Required property \'timeout\' not present in LoadBalancerPoolHealthMonitor JSON') + if 'cookie_name' in _dict: + args['cookie_name'] = _dict.get('cookie_name') if 'type' in _dict: args['type'] = _dict.get('type') else: - raise ValueError('Required property \'type\' not present in LoadBalancerPoolHealthMonitor JSON') - if 'url_path' in _dict: - args['url_path'] = _dict.get('url_path') + raise ValueError('Required property \'type\' not present in LoadBalancerPoolSessionPersistence JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerPoolHealthMonitor object from a json dictionary.""" + """Initialize a LoadBalancerPoolSessionPersistence object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'delay') and self.delay is not None: - _dict['delay'] = self.delay - if hasattr(self, 'max_retries') and self.max_retries is not None: - _dict['max_retries'] = self.max_retries - if hasattr(self, 'port') and self.port is not None: - _dict['port'] = self.port - if hasattr(self, 'timeout') and self.timeout is not None: - _dict['timeout'] = self.timeout + if hasattr(self, 'cookie_name') and self.cookie_name is not None: + _dict['cookie_name'] = self.cookie_name if hasattr(self, 'type') and self.type is not None: _dict['type'] = self.type - if hasattr(self, 'url_path') and self.url_path is not None: - _dict['url_path'] = self.url_path return _dict def _to_dict(self): @@ -40611,128 +45017,80 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerPoolHealthMonitor object.""" + """Return a `str` version of this LoadBalancerPoolSessionPersistence object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerPoolHealthMonitor') -> bool: + def __eq__(self, other: 'LoadBalancerPoolSessionPersistence') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerPoolHealthMonitor') -> bool: + def __ne__(self, other: 'LoadBalancerPoolSessionPersistence') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other class TypeEnum(str, Enum): """ - The protocol type of this load balancer pool health monitor. - The enumerated values for this property are expected to expand in the future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the health monitor on which the - unexpected property value was encountered. + The session persistence type. The `http_cookie` and `app_cookie` types are + applicable only to the `http` and `https` protocols. """ - HTTP = 'http' - HTTPS = 'https' - TCP = 'tcp' + APP_COOKIE = 'app_cookie' + HTTP_COOKIE = 'http_cookie' + SOURCE_IP = 'source_ip' -class LoadBalancerPoolHealthMonitorPatch(): +class LoadBalancerPoolSessionPersistencePatch(): """ - LoadBalancerPoolHealthMonitorPatch. + The session persistence configuration. Specify `null` to remove any existing session + persistence configuration. - :attr int delay: The health check interval in seconds. Interval must be greater - than timeout value. - :attr int max_retries: The health check max retries. - :attr int port: (optional) The health check port number. If specified, this - overrides the ports specified in the server member resources. Specify `null` to - remove an existing port value. - :attr int timeout: The health check timeout in seconds. - :attr str type: The protocol type of this load balancer pool health monitor. - :attr str url_path: (optional) The health check URL path. Applicable only if the - health monitor `type` is `http` or - `https`. This value must be in the format of an [origin-form request - target](https://tools.ietf.org/html/rfc7230#section-5.3.1). + :attr str cookie_name: (optional) The session persistence cookie name. + Applicable only for type `app_cookie`. Names starting with `IBM` are not + allowed. + :attr str type: (optional) The session persistence type. The `http_cookie` and + `app_cookie` types are applicable only to the `http` and `https` protocols. """ def __init__(self, - delay: int, - max_retries: int, - timeout: int, - type: str, *, - port: int = None, - url_path: str = None) -> None: + cookie_name: str = None, + type: str = None) -> None: """ - Initialize a LoadBalancerPoolHealthMonitorPatch object. + Initialize a LoadBalancerPoolSessionPersistencePatch object. - :param int delay: The health check interval in seconds. Interval must be - greater than timeout value. - :param int max_retries: The health check max retries. - :param int timeout: The health check timeout in seconds. - :param str type: The protocol type of this load balancer pool health - monitor. - :param int port: (optional) The health check port number. If specified, - this overrides the ports specified in the server member resources. Specify - `null` to remove an existing port value. - :param str url_path: (optional) The health check URL path. Applicable only - if the health monitor `type` is `http` or - `https`. This value must be in the format of an [origin-form request - target](https://tools.ietf.org/html/rfc7230#section-5.3.1). + :param str cookie_name: (optional) The session persistence cookie name. + Applicable only for type `app_cookie`. Names starting with `IBM` are not + allowed. + :param str type: (optional) The session persistence type. The `http_cookie` + and `app_cookie` types are applicable only to the `http` and `https` + protocols. """ - self.delay = delay - self.max_retries = max_retries - self.port = port - self.timeout = timeout + self.cookie_name = cookie_name self.type = type - self.url_path = url_path @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolHealthMonitorPatch': - """Initialize a LoadBalancerPoolHealthMonitorPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolSessionPersistencePatch': + """Initialize a LoadBalancerPoolSessionPersistencePatch object from a json dictionary.""" args = {} - if 'delay' in _dict: - args['delay'] = _dict.get('delay') - else: - raise ValueError('Required property \'delay\' not present in LoadBalancerPoolHealthMonitorPatch JSON') - if 'max_retries' in _dict: - args['max_retries'] = _dict.get('max_retries') - else: - raise ValueError('Required property \'max_retries\' not present in LoadBalancerPoolHealthMonitorPatch JSON') - if 'port' in _dict: - args['port'] = _dict.get('port') - if 'timeout' in _dict: - args['timeout'] = _dict.get('timeout') - else: - raise ValueError('Required property \'timeout\' not present in LoadBalancerPoolHealthMonitorPatch JSON') + if 'cookie_name' in _dict: + args['cookie_name'] = _dict.get('cookie_name') if 'type' in _dict: args['type'] = _dict.get('type') - else: - raise ValueError('Required property \'type\' not present in LoadBalancerPoolHealthMonitorPatch JSON') - if 'url_path' in _dict: - args['url_path'] = _dict.get('url_path') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerPoolHealthMonitorPatch object from a json dictionary.""" + """Initialize a LoadBalancerPoolSessionPersistencePatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'delay') and self.delay is not None: - _dict['delay'] = self.delay - if hasattr(self, 'max_retries') and self.max_retries is not None: - _dict['max_retries'] = self.max_retries - if hasattr(self, 'port') and self.port is not None: - _dict['port'] = self.port - if hasattr(self, 'timeout') and self.timeout is not None: - _dict['timeout'] = self.timeout + if hasattr(self, 'cookie_name') and self.cookie_name is not None: + _dict['cookie_name'] = self.cookie_name if hasattr(self, 'type') and self.type is not None: _dict['type'] = self.type - if hasattr(self, 'url_path') and self.url_path is not None: - _dict['url_path'] = self.url_path return _dict def _to_dict(self): @@ -40740,122 +45098,80 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerPoolHealthMonitorPatch object.""" + """Return a `str` version of this LoadBalancerPoolSessionPersistencePatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerPoolHealthMonitorPatch') -> bool: + def __eq__(self, other: 'LoadBalancerPoolSessionPersistencePatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerPoolHealthMonitorPatch') -> bool: + def __ne__(self, other: 'LoadBalancerPoolSessionPersistencePatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other class TypeEnum(str, Enum): """ - The protocol type of this load balancer pool health monitor. + The session persistence type. The `http_cookie` and `app_cookie` types are + applicable only to the `http` and `https` protocols. """ - HTTP = 'http' - HTTPS = 'https' - TCP = 'tcp' + APP_COOKIE = 'app_cookie' + HTTP_COOKIE = 'http_cookie' + SOURCE_IP = 'source_ip' -class LoadBalancerPoolHealthMonitorPrototype(): +class LoadBalancerPoolSessionPersistencePrototype(): """ - LoadBalancerPoolHealthMonitorPrototype. + LoadBalancerPoolSessionPersistencePrototype. - :attr int delay: The health check interval in seconds. Interval must be greater - than timeout value. - :attr int max_retries: The health check max retries. - :attr int port: (optional) The health check port number. If specified, this - overrides the ports specified in the server member resources. - :attr int timeout: The health check timeout in seconds. - :attr str type: The protocol type of this load balancer pool health monitor. - :attr str url_path: (optional) The health check URL path. Applicable only if the - health monitor `type` is `http` or - `https`. This value must be in the format of an [origin-form request - target](https://tools.ietf.org/html/rfc7230#section-5.3.1). + :attr str cookie_name: (optional) The session persistence cookie name. + Applicable only for type `app_cookie`. Names starting with `IBM` are not + allowed. + :attr str type: The session persistence type. The `http_cookie` and `app_cookie` + types are applicable only to the `http` and `https` protocols. """ def __init__(self, - delay: int, - max_retries: int, - timeout: int, type: str, *, - port: int = None, - url_path: str = None) -> None: + cookie_name: str = None) -> None: """ - Initialize a LoadBalancerPoolHealthMonitorPrototype object. + Initialize a LoadBalancerPoolSessionPersistencePrototype object. - :param int delay: The health check interval in seconds. Interval must be - greater than timeout value. - :param int max_retries: The health check max retries. - :param int timeout: The health check timeout in seconds. - :param str type: The protocol type of this load balancer pool health - monitor. - :param int port: (optional) The health check port number. If specified, - this overrides the ports specified in the server member resources. - :param str url_path: (optional) The health check URL path. Applicable only - if the health monitor `type` is `http` or - `https`. This value must be in the format of an [origin-form request - target](https://tools.ietf.org/html/rfc7230#section-5.3.1). + :param str type: The session persistence type. The `http_cookie` and + `app_cookie` types are applicable only to the `http` and `https` protocols. + :param str cookie_name: (optional) The session persistence cookie name. + Applicable only for type `app_cookie`. Names starting with `IBM` are not + allowed. """ - self.delay = delay - self.max_retries = max_retries - self.port = port - self.timeout = timeout + self.cookie_name = cookie_name self.type = type - self.url_path = url_path @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolHealthMonitorPrototype': - """Initialize a LoadBalancerPoolHealthMonitorPrototype object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolSessionPersistencePrototype': + """Initialize a LoadBalancerPoolSessionPersistencePrototype object from a json dictionary.""" args = {} - if 'delay' in _dict: - args['delay'] = _dict.get('delay') - else: - raise ValueError('Required property \'delay\' not present in LoadBalancerPoolHealthMonitorPrototype JSON') - if 'max_retries' in _dict: - args['max_retries'] = _dict.get('max_retries') - else: - raise ValueError('Required property \'max_retries\' not present in LoadBalancerPoolHealthMonitorPrototype JSON') - if 'port' in _dict: - args['port'] = _dict.get('port') - if 'timeout' in _dict: - args['timeout'] = _dict.get('timeout') - else: - raise ValueError('Required property \'timeout\' not present in LoadBalancerPoolHealthMonitorPrototype JSON') + if 'cookie_name' in _dict: + args['cookie_name'] = _dict.get('cookie_name') if 'type' in _dict: args['type'] = _dict.get('type') else: - raise ValueError('Required property \'type\' not present in LoadBalancerPoolHealthMonitorPrototype JSON') - if 'url_path' in _dict: - args['url_path'] = _dict.get('url_path') + raise ValueError('Required property \'type\' not present in LoadBalancerPoolSessionPersistencePrototype JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerPoolHealthMonitorPrototype object from a json dictionary.""" + """Initialize a LoadBalancerPoolSessionPersistencePrototype object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'delay') and self.delay is not None: - _dict['delay'] = self.delay - if hasattr(self, 'max_retries') and self.max_retries is not None: - _dict['max_retries'] = self.max_retries - if hasattr(self, 'port') and self.port is not None: - _dict['port'] = self.port - if hasattr(self, 'timeout') and self.timeout is not None: - _dict['timeout'] = self.timeout + if hasattr(self, 'cookie_name') and self.cookie_name is not None: + _dict['cookie_name'] = self.cookie_name if hasattr(self, 'type') and self.type is not None: _dict['type'] = self.type - if hasattr(self, 'url_path') and self.url_path is not None: - _dict['url_path'] = self.url_path return _dict def _to_dict(self): @@ -40863,79 +45179,130 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerPoolHealthMonitorPrototype object.""" + """Return a `str` version of this LoadBalancerPoolSessionPersistencePrototype object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerPoolHealthMonitorPrototype') -> bool: + def __eq__(self, other: 'LoadBalancerPoolSessionPersistencePrototype') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerPoolHealthMonitorPrototype') -> bool: + def __ne__(self, other: 'LoadBalancerPoolSessionPersistencePrototype') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other class TypeEnum(str, Enum): """ - The protocol type of this load balancer pool health monitor. - """ - HTTP = 'http' - HTTPS = 'https' - TCP = 'tcp' - - -class LoadBalancerPoolIdentity(): - """ - Identifies a load balancer pool by a unique property. - - """ - - def __init__(self) -> None: + The session persistence type. The `http_cookie` and `app_cookie` types are + applicable only to the `http` and `https` protocols. """ - Initialize a LoadBalancerPoolIdentity object. + APP_COOKIE = 'app_cookie' + HTTP_COOKIE = 'http_cookie' + SOURCE_IP = 'source_ip' - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['LoadBalancerPoolIdentityById', 'LoadBalancerPoolIdentityByHref'])) - raise Exception(msg) -class LoadBalancerPoolIdentityByName(): +class LoadBalancerPrivateIpsItem(): """ - LoadBalancerPoolIdentityByName. + LoadBalancerPrivateIpsItem. - :attr str name: The user-defined name for this load balancer pool. + :attr str address: The IP address. + If the address has not yet been selected, the value will be `0.0.0.0`. + This property may add support for IPv6 addresses in the future. When processing + a value in this property, verify that the address is in an expected format. If + it is not, log an error. Optionally halt processing and surface the error, or + bypass the resource on which the unexpected IP address format was encountered. + :attr ReservedIPReferenceDeleted deleted: (optional) If present, this property + indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str href: The URL for this reserved IP. + :attr str id: The unique identifier for this reserved IP. + :attr str name: The user-defined or system-provided name for this reserved IP. + :attr str resource_type: The resource type. """ def __init__(self, - name: str) -> None: + address: str, + href: str, + id: str, + name: str, + resource_type: str, + *, + deleted: 'ReservedIPReferenceDeleted' = None) -> None: """ - Initialize a LoadBalancerPoolIdentityByName object. + Initialize a LoadBalancerPrivateIpsItem object. - :param str name: The user-defined name for this load balancer pool. + :param str address: The IP address. + If the address has not yet been selected, the value will be `0.0.0.0`. + This property may add support for IPv6 addresses in the future. When + processing a value in this property, verify that the address is in an + expected format. If it is not, log an error. Optionally halt processing and + surface the error, or bypass the resource on which the unexpected IP + address format was encountered. + :param str href: The URL for this reserved IP. + :param str id: The unique identifier for this reserved IP. + :param str name: The user-defined or system-provided name for this reserved + IP. + :param str resource_type: The resource type. + :param ReservedIPReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides + some supplementary information. """ + self.address = address + self.deleted = deleted + self.href = href + self.id = id self.name = name + self.resource_type = resource_type @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolIdentityByName': - """Initialize a LoadBalancerPoolIdentityByName object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerPrivateIpsItem': + """Initialize a LoadBalancerPrivateIpsItem object from a json dictionary.""" args = {} + if 'address' in _dict: + args['address'] = _dict.get('address') + else: + raise ValueError('Required property \'address\' not present in LoadBalancerPrivateIpsItem JSON') + if 'deleted' in _dict: + args['deleted'] = ReservedIPReferenceDeleted.from_dict(_dict.get('deleted')) + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in LoadBalancerPrivateIpsItem JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in LoadBalancerPrivateIpsItem JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in LoadBalancerPoolIdentityByName JSON') + raise ValueError('Required property \'name\' not present in LoadBalancerPrivateIpsItem JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in LoadBalancerPrivateIpsItem JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerPoolIdentityByName object from a json dictionary.""" + """Initialize a LoadBalancerPrivateIpsItem object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'address') and self.address is not None: + _dict['address'] = self.address + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type return _dict def _to_dict(self): @@ -40943,154 +45310,135 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerPoolIdentityByName object.""" + """Return a `str` version of this LoadBalancerPrivateIpsItem object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerPoolIdentityByName') -> bool: + def __eq__(self, other: 'LoadBalancerPrivateIpsItem') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerPoolIdentityByName') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other + def __ne__(self, other: 'LoadBalancerPrivateIpsItem') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + SUBNET_RESERVED_IP = 'subnet_reserved_ip' + -class LoadBalancerPoolMember(): +class LoadBalancerProfile(): """ - LoadBalancerPoolMember. + LoadBalancerProfile. - :attr datetime created_at: The date and time that this member was created. - :attr str health: Health of the server member in the pool. - :attr str href: The member's canonical URL. - :attr str id: The unique identifier for this load balancer pool member. - :attr int port: The port the member will receive load balancer traffic on. - Applies only to load balancer traffic received on a listener with a single port. - (If the traffic is received on a listener with a port range, the member will - receive the traffic on the same port the listener received it on.) - This port will also be used for health checks unless the `port` property of - `health_monitor` property is specified. - :attr str provisioning_status: The provisioning status of this member. - :attr LoadBalancerPoolMemberTarget target: The pool member target. Load - balancers in the `network` family support virtual server - instances in the same zone as the load balancer's subnet. Load balancers in the - `application` family support any IP address in the VPC. If the load balancer has - `route mode` enabled, the member must be in a zone the load balancer has a - subnet in. - :attr int weight: (optional) Weight of the server member. Applicable only if the - pool algorithm is - `weighted_round_robin`. + :attr str family: The product family this load balancer profile belongs to. + :attr str href: The URL for this load balancer profile. + :attr LoadBalancerProfileLoggingSupported logging_supported: Indicates which + logging type(s) are supported for a load balancer with this profile. + :attr str name: The globally unique name for this load balancer profile. + :attr LoadBalancerProfileRouteModeSupported route_mode_supported: + :attr LoadBalancerProfileSecurityGroupsSupported security_groups_supported: + :attr LoadBalancerProfileUDPSupported udp_supported: """ def __init__(self, - created_at: datetime, - health: str, + family: str, href: str, - id: str, - port: int, - provisioning_status: str, - target: 'LoadBalancerPoolMemberTarget', - *, - weight: int = None) -> None: + logging_supported: 'LoadBalancerProfileLoggingSupported', + name: str, + route_mode_supported: 'LoadBalancerProfileRouteModeSupported', + security_groups_supported: 'LoadBalancerProfileSecurityGroupsSupported', + udp_supported: 'LoadBalancerProfileUDPSupported') -> None: """ - Initialize a LoadBalancerPoolMember object. + Initialize a LoadBalancerProfile object. - :param datetime created_at: The date and time that this member was created. - :param str health: Health of the server member in the pool. - :param str href: The member's canonical URL. - :param str id: The unique identifier for this load balancer pool member. - :param int port: The port the member will receive load balancer traffic on. - Applies only to load balancer traffic received on a listener with a single - port. (If the traffic is received on a listener with a port range, the - member will receive the traffic on the same port the listener received it - on.) - This port will also be used for health checks unless the `port` property of - `health_monitor` property is specified. - :param str provisioning_status: The provisioning status of this member. - :param LoadBalancerPoolMemberTarget target: The pool member target. Load - balancers in the `network` family support virtual server - instances in the same zone as the load balancer's subnet. Load balancers in - the - `application` family support any IP address in the VPC. If the load - balancer has - `route mode` enabled, the member must be in a zone the load balancer has a - subnet in. - :param int weight: (optional) Weight of the server member. Applicable only - if the pool algorithm is - `weighted_round_robin`. + :param str family: The product family this load balancer profile belongs + to. + :param str href: The URL for this load balancer profile. + :param LoadBalancerProfileLoggingSupported logging_supported: Indicates + which logging type(s) are supported for a load balancer with this profile. + :param str name: The globally unique name for this load balancer profile. + :param LoadBalancerProfileRouteModeSupported route_mode_supported: + :param LoadBalancerProfileSecurityGroupsSupported + security_groups_supported: + :param LoadBalancerProfileUDPSupported udp_supported: """ - self.created_at = created_at - self.health = health + self.family = family self.href = href - self.id = id - self.port = port - self.provisioning_status = provisioning_status - self.target = target - self.weight = weight + self.logging_supported = logging_supported + self.name = name + self.route_mode_supported = route_mode_supported + self.security_groups_supported = security_groups_supported + self.udp_supported = udp_supported @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolMember': - """Initialize a LoadBalancerPoolMember object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerProfile': + """Initialize a LoadBalancerProfile object from a json dictionary.""" args = {} - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - else: - raise ValueError('Required property \'created_at\' not present in LoadBalancerPoolMember JSON') - if 'health' in _dict: - args['health'] = _dict.get('health') + if 'family' in _dict: + args['family'] = _dict.get('family') else: - raise ValueError('Required property \'health\' not present in LoadBalancerPoolMember JSON') + raise ValueError('Required property \'family\' not present in LoadBalancerProfile JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in LoadBalancerPoolMember JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') + raise ValueError('Required property \'href\' not present in LoadBalancerProfile JSON') + if 'logging_supported' in _dict: + args['logging_supported'] = LoadBalancerProfileLoggingSupported.from_dict(_dict.get('logging_supported')) else: - raise ValueError('Required property \'id\' not present in LoadBalancerPoolMember JSON') - if 'port' in _dict: - args['port'] = _dict.get('port') + raise ValueError('Required property \'logging_supported\' not present in LoadBalancerProfile JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') else: - raise ValueError('Required property \'port\' not present in LoadBalancerPoolMember JSON') - if 'provisioning_status' in _dict: - args['provisioning_status'] = _dict.get('provisioning_status') + raise ValueError('Required property \'name\' not present in LoadBalancerProfile JSON') + if 'route_mode_supported' in _dict: + args['route_mode_supported'] = _dict.get('route_mode_supported') else: - raise ValueError('Required property \'provisioning_status\' not present in LoadBalancerPoolMember JSON') - if 'target' in _dict: - args['target'] = _dict.get('target') + raise ValueError('Required property \'route_mode_supported\' not present in LoadBalancerProfile JSON') + if 'security_groups_supported' in _dict: + args['security_groups_supported'] = _dict.get('security_groups_supported') else: - raise ValueError('Required property \'target\' not present in LoadBalancerPoolMember JSON') - if 'weight' in _dict: - args['weight'] = _dict.get('weight') + raise ValueError('Required property \'security_groups_supported\' not present in LoadBalancerProfile JSON') + if 'udp_supported' in _dict: + args['udp_supported'] = _dict.get('udp_supported') + else: + raise ValueError('Required property \'udp_supported\' not present in LoadBalancerProfile JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerPoolMember object from a json dictionary.""" + """Initialize a LoadBalancerProfile object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'health') and self.health is not None: - _dict['health'] = self.health + if hasattr(self, 'family') and self.family is not None: + _dict['family'] = self.family if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'port') and self.port is not None: - _dict['port'] = self.port - if hasattr(self, 'provisioning_status') and self.provisioning_status is not None: - _dict['provisioning_status'] = self.provisioning_status - if hasattr(self, 'target') and self.target is not None: - if isinstance(self.target, dict): - _dict['target'] = self.target + if hasattr(self, 'logging_supported') and self.logging_supported is not None: + _dict['logging_supported'] = self.logging_supported.to_dict() + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'route_mode_supported') and self.route_mode_supported is not None: + if isinstance(self.route_mode_supported, dict): + _dict['route_mode_supported'] = self.route_mode_supported else: - _dict['target'] = self.target.to_dict() - if hasattr(self, 'weight') and self.weight is not None: - _dict['weight'] = self.weight + _dict['route_mode_supported'] = self.route_mode_supported.to_dict() + if hasattr(self, 'security_groups_supported') and self.security_groups_supported is not None: + if isinstance(self.security_groups_supported, dict): + _dict['security_groups_supported'] = self.security_groups_supported + else: + _dict['security_groups_supported'] = self.security_groups_supported.to_dict() + if hasattr(self, 'udp_supported') and self.udp_supported is not None: + if isinstance(self.udp_supported, dict): + _dict['udp_supported'] = self.udp_supported + else: + _dict['udp_supported'] = self.udp_supported.to_dict() return _dict def _to_dict(self): @@ -41098,76 +45446,103 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerPoolMember object.""" + """Return a `str` version of this LoadBalancerProfile object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerPoolMember') -> bool: + def __eq__(self, other: 'LoadBalancerProfile') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerPoolMember') -> bool: + def __ne__(self, other: 'LoadBalancerProfile') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class HealthEnum(str, Enum): - """ - Health of the server member in the pool. - """ - FAULTED = 'faulted' - OK = 'ok' - UNKNOWN = 'unknown' - - - class ProvisioningStatusEnum(str, Enum): - """ - The provisioning status of this member. - """ - ACTIVE = 'active' - CREATE_PENDING = 'create_pending' - DELETE_PENDING = 'delete_pending' - FAILED = 'failed' - MAINTENANCE_PENDING = 'maintenance_pending' - UPDATE_PENDING = 'update_pending' - - -class LoadBalancerPoolMemberCollection(): +class LoadBalancerProfileCollection(): """ - LoadBalancerPoolMemberCollection. + LoadBalancerProfileCollection. - :attr List[LoadBalancerPoolMember] members: Collection of members. + :attr LoadBalancerProfileCollectionFirst first: A link to the first page of + resources. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr LoadBalancerProfileCollectionNext next: (optional) A link to the next page + of resources. This property is present for all pages + except the last page. + :attr List[LoadBalancerProfile] profiles: Collection of load balancer profiles. + :attr int total_count: The total number of resources across all pages. """ def __init__(self, - members: List['LoadBalancerPoolMember']) -> None: + first: 'LoadBalancerProfileCollectionFirst', + limit: int, + profiles: List['LoadBalancerProfile'], + total_count: int, + *, + next: 'LoadBalancerProfileCollectionNext' = None) -> None: """ - Initialize a LoadBalancerPoolMemberCollection object. + Initialize a LoadBalancerProfileCollection object. - :param List[LoadBalancerPoolMember] members: Collection of members. + :param LoadBalancerProfileCollectionFirst first: A link to the first page + of resources. + :param int limit: The maximum number of resources that can be returned by + the request. + :param List[LoadBalancerProfile] profiles: Collection of load balancer + profiles. + :param int total_count: The total number of resources across all pages. + :param LoadBalancerProfileCollectionNext next: (optional) A link to the + next page of resources. This property is present for all pages + except the last page. """ - self.members = members + self.first = first + self.limit = limit + self.next = next + self.profiles = profiles + self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolMemberCollection': - """Initialize a LoadBalancerPoolMemberCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerProfileCollection': + """Initialize a LoadBalancerProfileCollection object from a json dictionary.""" args = {} - if 'members' in _dict: - args['members'] = [LoadBalancerPoolMember.from_dict(x) for x in _dict.get('members')] + if 'first' in _dict: + args['first'] = LoadBalancerProfileCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'members\' not present in LoadBalancerPoolMemberCollection JSON') + raise ValueError('Required property \'first\' not present in LoadBalancerProfileCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') + else: + raise ValueError('Required property \'limit\' not present in LoadBalancerProfileCollection JSON') + if 'next' in _dict: + args['next'] = LoadBalancerProfileCollectionNext.from_dict(_dict.get('next')) + if 'profiles' in _dict: + args['profiles'] = [LoadBalancerProfile.from_dict(x) for x in _dict.get('profiles')] + else: + raise ValueError('Required property \'profiles\' not present in LoadBalancerProfileCollection JSON') + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') + else: + raise ValueError('Required property \'total_count\' not present in LoadBalancerProfileCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerPoolMemberCollection object from a json dictionary.""" + """Initialize a LoadBalancerProfileCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'members') and self.members is not None: - _dict['members'] = [x.to_dict() for x in self.members] + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'profiles') and self.profiles is not None: + _dict['profiles'] = [x.to_dict() for x in self.profiles] + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count return _dict def _to_dict(self): @@ -41175,105 +45550,55 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerPoolMemberCollection object.""" + """Return a `str` version of this LoadBalancerProfileCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerPoolMemberCollection') -> bool: + def __eq__(self, other: 'LoadBalancerProfileCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerPoolMemberCollection') -> bool: + def __ne__(self, other: 'LoadBalancerProfileCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerPoolMemberPatch(): +class LoadBalancerProfileCollectionFirst(): """ - LoadBalancerPoolMemberPatch. + A link to the first page of resources. - :attr int port: (optional) The port the member will receive load balancer - traffic on. Applies only to load balancer traffic received on a listener with a - single port. (If the traffic is received on a listener with a port range, the - member will receive the traffic on the same port the listener received it on.) - This port will also be used for health checks unless the `port` property of - `health_monitor` property is specified. - The port must be unique across all members for all pools associated with this - pool's listener. - :attr LoadBalancerPoolMemberTargetPrototype target: (optional) The pool member - target. Load balancers in the `network` family support virtual server - instances in the same zone as the load balancer's subnet. Load balancers in the - `application` family support any IP address in the VPC. If the load balancer has - `route mode` enabled, the member must be in a zone the load balancer has a - subnet in. - :attr int weight: (optional) Weight of the server member. Applicable only if the - pool algorithm is - `weighted_round_robin`. + :attr str href: The URL for a page of resources. """ def __init__(self, - *, - port: int = None, - target: 'LoadBalancerPoolMemberTargetPrototype' = None, - weight: int = None) -> None: + href: str) -> None: """ - Initialize a LoadBalancerPoolMemberPatch object. + Initialize a LoadBalancerProfileCollectionFirst object. - :param int port: (optional) The port the member will receive load balancer - traffic on. Applies only to load balancer traffic received on a listener - with a single port. (If the traffic is received on a listener with a port - range, the member will receive the traffic on the same port the listener - received it on.) - This port will also be used for health checks unless the `port` property of - `health_monitor` property is specified. - The port must be unique across all members for all pools associated with - this pool's listener. - :param LoadBalancerPoolMemberTargetPrototype target: (optional) The pool - member target. Load balancers in the `network` family support virtual - server - instances in the same zone as the load balancer's subnet. Load balancers in - the - `application` family support any IP address in the VPC. If the load - balancer has - `route mode` enabled, the member must be in a zone the load balancer has a - subnet in. - :param int weight: (optional) Weight of the server member. Applicable only - if the pool algorithm is - `weighted_round_robin`. + :param str href: The URL for a page of resources. """ - self.port = port - self.target = target - self.weight = weight + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolMemberPatch': - """Initialize a LoadBalancerPoolMemberPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerProfileCollectionFirst': + """Initialize a LoadBalancerProfileCollectionFirst object from a json dictionary.""" args = {} - if 'port' in _dict: - args['port'] = _dict.get('port') - if 'target' in _dict: - args['target'] = _dict.get('target') - if 'weight' in _dict: - args['weight'] = _dict.get('weight') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in LoadBalancerProfileCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerPoolMemberPatch object from a json dictionary.""" + """Initialize a LoadBalancerProfileCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'port') and self.port is not None: - _dict['port'] = self.port - if hasattr(self, 'target') and self.target is not None: - if isinstance(self.target, dict): - _dict['target'] = self.target - else: - _dict['target'] = self.target.to_dict() - if hasattr(self, 'weight') and self.weight is not None: - _dict['weight'] = self.weight + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -41281,108 +45606,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerPoolMemberPatch object.""" + """Return a `str` version of this LoadBalancerProfileCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerPoolMemberPatch') -> bool: + def __eq__(self, other: 'LoadBalancerProfileCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerPoolMemberPatch') -> bool: + def __ne__(self, other: 'LoadBalancerProfileCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerPoolMemberPrototype(): +class LoadBalancerProfileCollectionNext(): """ - LoadBalancerPoolMemberPrototype. + A link to the next page of resources. This property is present for all pages except + the last page. - :attr int port: The port the member will receive load balancer traffic on. - Applies only to load balancer traffic received on a listener with a single port. - (If the traffic is received on a listener with a port range, the member will - receive the traffic on the same port the listener received it on.) - This port will also be used for health checks unless the `port` property of - `health_monitor` property is specified. - The port must be unique across all members for all pools associated with this - pool's listener. - :attr LoadBalancerPoolMemberTargetPrototype target: The pool member target. Load - balancers in the `network` family support virtual server - instances in the same zone as the load balancer's subnet. Load balancers in the - `application` family support any IP address in the VPC. If the load balancer has - `route mode` enabled, the member must be in a zone the load balancer has a - subnet in. - :attr int weight: (optional) Weight of the server member. Applicable only if the - pool algorithm is - `weighted_round_robin`. + :attr str href: The URL for a page of resources. """ def __init__(self, - port: int, - target: 'LoadBalancerPoolMemberTargetPrototype', - *, - weight: int = None) -> None: + href: str) -> None: """ - Initialize a LoadBalancerPoolMemberPrototype object. + Initialize a LoadBalancerProfileCollectionNext object. - :param int port: The port the member will receive load balancer traffic on. - Applies only to load balancer traffic received on a listener with a single - port. (If the traffic is received on a listener with a port range, the - member will receive the traffic on the same port the listener received it - on.) - This port will also be used for health checks unless the `port` property of - `health_monitor` property is specified. - The port must be unique across all members for all pools associated with - this pool's listener. - :param LoadBalancerPoolMemberTargetPrototype target: The pool member - target. Load balancers in the `network` family support virtual server - instances in the same zone as the load balancer's subnet. Load balancers in - the - `application` family support any IP address in the VPC. If the load - balancer has - `route mode` enabled, the member must be in a zone the load balancer has a - subnet in. - :param int weight: (optional) Weight of the server member. Applicable only - if the pool algorithm is - `weighted_round_robin`. + :param str href: The URL for a page of resources. """ - self.port = port - self.target = target - self.weight = weight + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolMemberPrototype': - """Initialize a LoadBalancerPoolMemberPrototype object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerProfileCollectionNext': + """Initialize a LoadBalancerProfileCollectionNext object from a json dictionary.""" args = {} - if 'port' in _dict: - args['port'] = _dict.get('port') - else: - raise ValueError('Required property \'port\' not present in LoadBalancerPoolMemberPrototype JSON') - if 'target' in _dict: - args['target'] = _dict.get('target') + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'target\' not present in LoadBalancerPoolMemberPrototype JSON') - if 'weight' in _dict: - args['weight'] = _dict.get('weight') + raise ValueError('Required property \'href\' not present in LoadBalancerProfileCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerPoolMemberPrototype object from a json dictionary.""" + """Initialize a LoadBalancerProfileCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'port') and self.port is not None: - _dict['port'] = self.port - if hasattr(self, 'target') and self.target is not None: - if isinstance(self.target, dict): - _dict['target'] = self.target - else: - _dict['target'] = self.target.to_dict() - if hasattr(self, 'weight') and self.weight is not None: - _dict['weight'] = self.weight + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -41390,79 +45663,82 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerPoolMemberPrototype object.""" + """Return a `str` version of this LoadBalancerProfileCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerPoolMemberPrototype') -> bool: + def __eq__(self, other: 'LoadBalancerProfileCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerPoolMemberPrototype') -> bool: + def __ne__(self, other: 'LoadBalancerProfileCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerPoolMemberReference(): +class LoadBalancerProfileIdentity(): """ - LoadBalancerPoolMemberReference. + Identifies a load balancer profile by a unique property. - :attr LoadBalancerPoolMemberReferenceDeleted deleted: (optional) If present, - this property indicates the referenced resource has been deleted and provides - some supplementary information. - :attr str href: The member's canonical URL. - :attr str id: The unique identifier for this load balancer pool member. + """ + + def __init__(self) -> None: + """ + Initialize a LoadBalancerProfileIdentity object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['LoadBalancerProfileIdentityByName', 'LoadBalancerProfileIdentityByHref'])) + raise Exception(msg) + +class LoadBalancerProfileLoggingSupported(): + """ + Indicates which logging type(s) are supported for a load balancer with this profile. + + :attr str type: The type for this profile field. + :attr List[str] value: The supported logging type(s) for a load balancer with + this profile. """ def __init__(self, - href: str, - id: str, - *, - deleted: 'LoadBalancerPoolMemberReferenceDeleted' = None) -> None: + type: str, + value: List[str]) -> None: """ - Initialize a LoadBalancerPoolMemberReference object. + Initialize a LoadBalancerProfileLoggingSupported object. - :param str href: The member's canonical URL. - :param str id: The unique identifier for this load balancer pool member. - :param LoadBalancerPoolMemberReferenceDeleted deleted: (optional) If - present, this property indicates the referenced resource has been deleted - and provides - some supplementary information. + :param str type: The type for this profile field. + :param List[str] value: The supported logging type(s) for a load balancer + with this profile. """ - self.deleted = deleted - self.href = href - self.id = id + self.type = type + self.value = value @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolMemberReference': - """Initialize a LoadBalancerPoolMemberReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerProfileLoggingSupported': + """Initialize a LoadBalancerProfileLoggingSupported object from a json dictionary.""" args = {} - if 'deleted' in _dict: - args['deleted'] = LoadBalancerPoolMemberReferenceDeleted.from_dict(_dict.get('deleted')) - if 'href' in _dict: - args['href'] = _dict.get('href') + if 'type' in _dict: + args['type'] = _dict.get('type') else: - raise ValueError('Required property \'href\' not present in LoadBalancerPoolMemberReference JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') + raise ValueError('Required property \'type\' not present in LoadBalancerProfileLoggingSupported JSON') + if 'value' in _dict: + args['value'] = _dict.get('value') else: - raise ValueError('Required property \'id\' not present in LoadBalancerPoolMemberReference JSON') + raise ValueError('Required property \'value\' not present in LoadBalancerProfileLoggingSupported JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerPoolMemberReference object from a json dictionary.""" + """Initialize a LoadBalancerProfileLoggingSupported object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'value') and self.value is not None: + _dict['value'] = self.value return _dict def _to_dict(self): @@ -41470,56 +45746,83 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerPoolMemberReference object.""" + """Return a `str` version of this LoadBalancerProfileLoggingSupported object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerPoolMemberReference') -> bool: + def __eq__(self, other: 'LoadBalancerProfileLoggingSupported') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerPoolMemberReference') -> bool: + def __ne__(self, other: 'LoadBalancerProfileLoggingSupported') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerPoolMemberReferenceDeleted(): + class TypeEnum(str, Enum): + """ + The type for this profile field. + """ + FIXED = 'fixed' + + +class LoadBalancerProfileReference(): """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. + LoadBalancerProfileReference. - :attr str more_info: Link to documentation about deleted resources. + :attr str family: The product family this load balancer profile belongs to. + :attr str href: The URL for this load balancer profile. + :attr str name: The globally unique name for this load balancer profile. """ def __init__(self, - more_info: str) -> None: + family: str, + href: str, + name: str) -> None: """ - Initialize a LoadBalancerPoolMemberReferenceDeleted object. + Initialize a LoadBalancerProfileReference object. - :param str more_info: Link to documentation about deleted resources. + :param str family: The product family this load balancer profile belongs + to. + :param str href: The URL for this load balancer profile. + :param str name: The globally unique name for this load balancer profile. """ - self.more_info = more_info + self.family = family + self.href = href + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolMemberReferenceDeleted': - """Initialize a LoadBalancerPoolMemberReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerProfileReference': + """Initialize a LoadBalancerProfileReference object from a json dictionary.""" args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') + if 'family' in _dict: + args['family'] = _dict.get('family') else: - raise ValueError('Required property \'more_info\' not present in LoadBalancerPoolMemberReferenceDeleted JSON') + raise ValueError('Required property \'family\' not present in LoadBalancerProfileReference JSON') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in LoadBalancerProfileReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in LoadBalancerProfileReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerPoolMemberReferenceDeleted object from a json dictionary.""" + """Initialize a LoadBalancerProfileReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'family') and self.family is not None: + _dict['family'] = self.family + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -41527,158 +45830,101 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerPoolMemberReferenceDeleted object.""" + """Return a `str` version of this LoadBalancerProfileReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerPoolMemberReferenceDeleted') -> bool: + def __eq__(self, other: 'LoadBalancerProfileReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerPoolMemberReferenceDeleted') -> bool: + def __ne__(self, other: 'LoadBalancerProfileReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerPoolMemberTarget(): +class LoadBalancerProfileRouteModeSupported(): """ - The pool member target. Load balancers in the `network` family support virtual server - instances in the same zone as the load balancer's subnet. Load balancers in the - `application` family support any IP address in the VPC. If the load balancer has - `route mode` enabled, the member must be in a zone the load balancer has a subnet in. + LoadBalancerProfileRouteModeSupported. """ def __init__(self) -> None: """ - Initialize a LoadBalancerPoolMemberTarget object. + Initialize a LoadBalancerProfileRouteModeSupported object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['LoadBalancerPoolMemberTargetInstanceReference', 'LoadBalancerPoolMemberTargetIP'])) + ", ".join(['LoadBalancerProfileRouteModeSupportedFixed', 'LoadBalancerProfileRouteModeSupportedDependent'])) raise Exception(msg) -class LoadBalancerPoolMemberTargetPrototype(): +class LoadBalancerProfileSecurityGroupsSupported(): """ - The pool member target. Load balancers in the `network` family support virtual server - instances in the same zone as the load balancer's subnet. Load balancers in the - `application` family support any IP address in the VPC. If the load balancer has - `route mode` enabled, the member must be in a zone the load balancer has a subnet in. + LoadBalancerProfileSecurityGroupsSupported. """ def __init__(self) -> None: """ - Initialize a LoadBalancerPoolMemberTargetPrototype object. + Initialize a LoadBalancerProfileSecurityGroupsSupported object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['LoadBalancerPoolMemberTargetPrototypeInstanceIdentity', 'LoadBalancerPoolMemberTargetPrototypeIP'])) + ", ".join(['LoadBalancerProfileSecurityGroupsSupportedFixed', 'LoadBalancerProfileSecurityGroupsSupportedDependent'])) raise Exception(msg) -class LoadBalancerPoolPatch(): +class LoadBalancerProfileUDPSupported(): """ - LoadBalancerPoolPatch. + LoadBalancerProfileUDPSupported. - :attr str algorithm: (optional) The load balancing algorithm. - :attr LoadBalancerPoolHealthMonitorPatch health_monitor: (optional) The health - monitor of this pool. - :attr str name: (optional) The user-defined name for this load balancer pool. - :attr str protocol: (optional) The protocol to use for this load balancer pool. - Load balancers in the `network` family support `tcp` and `udp` (if - `udp_supported` is `true`). Load balancers in the `application` family support - `tcp`, `http` and `https`. - If this pool is associated with a load balancer listener, the specified protocol - must be compatible with the listener's protocol. At present, the compatible - protocols are `http` and `https`. - :attr str proxy_protocol: (optional) The PROXY protocol setting for this pool: - - `v1`: Enabled with version 1 (human-readable header format) - - `v2`: Enabled with version 2 (binary header format) - - `disabled`: Disabled - Supported by load balancers in the `application` family (otherwise always - `disabled`). - :attr LoadBalancerPoolSessionPersistencePatch session_persistence: (optional) - The session persistence of this pool. + """ + + def __init__(self) -> None: + """ + Initialize a LoadBalancerProfileUDPSupported object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['LoadBalancerProfileUDPSupportedFixed', 'LoadBalancerProfileUDPSupportedDependent'])) + raise Exception(msg) + +class LoadBalancerReferenceDeleted(): + """ + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. + + :attr str more_info: Link to documentation about deleted resources. """ def __init__(self, - *, - algorithm: str = None, - health_monitor: 'LoadBalancerPoolHealthMonitorPatch' = None, - name: str = None, - protocol: str = None, - proxy_protocol: str = None, - session_persistence: 'LoadBalancerPoolSessionPersistencePatch' = None) -> None: + more_info: str) -> None: """ - Initialize a LoadBalancerPoolPatch object. + Initialize a LoadBalancerReferenceDeleted object. - :param str algorithm: (optional) The load balancing algorithm. - :param LoadBalancerPoolHealthMonitorPatch health_monitor: (optional) The - health monitor of this pool. - :param str name: (optional) The user-defined name for this load balancer - pool. - :param str protocol: (optional) The protocol to use for this load balancer - pool. Load balancers in the `network` family support `tcp` and `udp` (if - `udp_supported` is `true`). Load balancers in the `application` family - support `tcp`, `http` and `https`. - If this pool is associated with a load balancer listener, the specified - protocol must be compatible with the listener's protocol. At present, the - compatible protocols are `http` and `https`. - :param str proxy_protocol: (optional) The PROXY protocol setting for this - pool: - - `v1`: Enabled with version 1 (human-readable header format) - - `v2`: Enabled with version 2 (binary header format) - - `disabled`: Disabled - Supported by load balancers in the `application` family (otherwise always - `disabled`). - :param LoadBalancerPoolSessionPersistencePatch session_persistence: - (optional) The session persistence of this pool. + :param str more_info: Link to documentation about deleted resources. """ - self.algorithm = algorithm - self.health_monitor = health_monitor - self.name = name - self.protocol = protocol - self.proxy_protocol = proxy_protocol - self.session_persistence = session_persistence + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolPatch': - """Initialize a LoadBalancerPoolPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerReferenceDeleted': + """Initialize a LoadBalancerReferenceDeleted object from a json dictionary.""" args = {} - if 'algorithm' in _dict: - args['algorithm'] = _dict.get('algorithm') - if 'health_monitor' in _dict: - args['health_monitor'] = LoadBalancerPoolHealthMonitorPatch.from_dict(_dict.get('health_monitor')) - if 'name' in _dict: - args['name'] = _dict.get('name') - if 'protocol' in _dict: - args['protocol'] = _dict.get('protocol') - if 'proxy_protocol' in _dict: - args['proxy_protocol'] = _dict.get('proxy_protocol') - if 'session_persistence' in _dict: - args['session_persistence'] = LoadBalancerPoolSessionPersistencePatch.from_dict(_dict.get('session_persistence')) + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') + else: + raise ValueError('Required property \'more_info\' not present in LoadBalancerReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerPoolPatch object from a json dictionary.""" + """Initialize a LoadBalancerReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'algorithm') and self.algorithm is not None: - _dict['algorithm'] = self.algorithm - if hasattr(self, 'health_monitor') and self.health_monitor is not None: - _dict['health_monitor'] = self.health_monitor.to_dict() - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'protocol') and self.protocol is not None: - _dict['protocol'] = self.protocol - if hasattr(self, 'proxy_protocol') and self.proxy_protocol is not None: - _dict['proxy_protocol'] = self.proxy_protocol - if hasattr(self, 'session_persistence') and self.session_persistence is not None: - _dict['session_persistence'] = self.session_persistence.to_dict() + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -41686,176 +45932,91 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerPoolPatch object.""" + """Return a `str` version of this LoadBalancerReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerPoolPatch') -> bool: + def __eq__(self, other: 'LoadBalancerReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerPoolPatch') -> bool: + def __ne__(self, other: 'LoadBalancerReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class AlgorithmEnum(str, Enum): - """ - The load balancing algorithm. - """ - LEAST_CONNECTIONS = 'least_connections' - ROUND_ROBIN = 'round_robin' - WEIGHTED_ROUND_ROBIN = 'weighted_round_robin' - - - class ProtocolEnum(str, Enum): - """ - The protocol to use for this load balancer pool. Load balancers in the `network` - family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in - the `application` family support `tcp`, `http` and `https`. - If this pool is associated with a load balancer listener, the specified protocol - must be compatible with the listener's protocol. At present, the compatible - protocols are `http` and `https`. - """ - HTTP = 'http' - HTTPS = 'https' - TCP = 'tcp' - UDP = 'udp' - - - class ProxyProtocolEnum(str, Enum): - """ - The PROXY protocol setting for this pool: - - `v1`: Enabled with version 1 (human-readable header format) - - `v2`: Enabled with version 2 (binary header format) - - `disabled`: Disabled - Supported by load balancers in the `application` family (otherwise always - `disabled`). - """ - DISABLED = 'disabled' - V1 = 'v1' - V2 = 'v2' - - -class LoadBalancerPoolPrototype(): +class LoadBalancerStatistics(): """ - LoadBalancerPoolPrototype. + LoadBalancerStatistics. - :attr str algorithm: The load balancing algorithm. - :attr LoadBalancerPoolHealthMonitorPrototype health_monitor: The health monitor - of this pool. - :attr List[LoadBalancerPoolMemberPrototype] members: (optional) The members for - this load balancer pool. For load balancers in the `network` family, the same - `port` and `target` tuple cannot be shared by a pool member of any other load - balancer in the same VPC. - :attr str name: (optional) The user-defined name for this load balancer pool. If - unspecified, the name will be a hyphenated list of randomly-selected words. - :attr str protocol: The protocol used for this load balancer pool. Load - balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is - `true`). Load balancers in the - `application` family support `tcp`, `http`, and `https`. - :attr str proxy_protocol: (optional) The PROXY protocol setting for this pool: - - `v1`: Enabled with version 1 (human-readable header format) - - `v2`: Enabled with version 2 (binary header format) - - `disabled`: Disabled - Supported by load balancers in the `application` family (otherwise always - `disabled`). - :attr LoadBalancerPoolSessionPersistencePrototype session_persistence: - (optional) The session persistence of this pool. + :attr int active_connections: Number of active connections of this load + balancer. + :attr float connection_rate: Current connection rate (connections per second) of + this load balancer. + :attr int data_processed_this_month: Total number of data processed (bytes) of + this load balancer within current calendar month. + :attr float throughput: Current throughput (Mbps) of this load balancer. """ def __init__(self, - algorithm: str, - health_monitor: 'LoadBalancerPoolHealthMonitorPrototype', - protocol: str, - *, - members: List['LoadBalancerPoolMemberPrototype'] = None, - name: str = None, - proxy_protocol: str = None, - session_persistence: 'LoadBalancerPoolSessionPersistencePrototype' = None) -> None: + active_connections: int, + connection_rate: float, + data_processed_this_month: int, + throughput: float) -> None: """ - Initialize a LoadBalancerPoolPrototype object. + Initialize a LoadBalancerStatistics object. - :param str algorithm: The load balancing algorithm. - :param LoadBalancerPoolHealthMonitorPrototype health_monitor: The health - monitor of this pool. - :param str protocol: The protocol used for this load balancer pool. Load - balancers in the `network` family support `tcp` and `udp` (if - `udp_supported` is `true`). Load balancers in the - `application` family support `tcp`, `http`, and `https`. - :param List[LoadBalancerPoolMemberPrototype] members: (optional) The - members for this load balancer pool. For load balancers in the `network` - family, the same `port` and `target` tuple cannot be shared by a pool - member of any other load balancer in the same VPC. - :param str name: (optional) The user-defined name for this load balancer - pool. If unspecified, the name will be a hyphenated list of - randomly-selected words. - :param str proxy_protocol: (optional) The PROXY protocol setting for this - pool: - - `v1`: Enabled with version 1 (human-readable header format) - - `v2`: Enabled with version 2 (binary header format) - - `disabled`: Disabled - Supported by load balancers in the `application` family (otherwise always - `disabled`). - :param LoadBalancerPoolSessionPersistencePrototype session_persistence: - (optional) The session persistence of this pool. + :param int active_connections: Number of active connections of this load + balancer. + :param float connection_rate: Current connection rate (connections per + second) of this load balancer. + :param int data_processed_this_month: Total number of data processed + (bytes) of this load balancer within current calendar month. + :param float throughput: Current throughput (Mbps) of this load balancer. """ - self.algorithm = algorithm - self.health_monitor = health_monitor - self.members = members - self.name = name - self.protocol = protocol - self.proxy_protocol = proxy_protocol - self.session_persistence = session_persistence + self.active_connections = active_connections + self.connection_rate = connection_rate + self.data_processed_this_month = data_processed_this_month + self.throughput = throughput @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolPrototype': - """Initialize a LoadBalancerPoolPrototype object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LoadBalancerStatistics': + """Initialize a LoadBalancerStatistics object from a json dictionary.""" args = {} - if 'algorithm' in _dict: - args['algorithm'] = _dict.get('algorithm') + if 'active_connections' in _dict: + args['active_connections'] = _dict.get('active_connections') else: - raise ValueError('Required property \'algorithm\' not present in LoadBalancerPoolPrototype JSON') - if 'health_monitor' in _dict: - args['health_monitor'] = LoadBalancerPoolHealthMonitorPrototype.from_dict(_dict.get('health_monitor')) + raise ValueError('Required property \'active_connections\' not present in LoadBalancerStatistics JSON') + if 'connection_rate' in _dict: + args['connection_rate'] = _dict.get('connection_rate') else: - raise ValueError('Required property \'health_monitor\' not present in LoadBalancerPoolPrototype JSON') - if 'members' in _dict: - args['members'] = [LoadBalancerPoolMemberPrototype.from_dict(x) for x in _dict.get('members')] - if 'name' in _dict: - args['name'] = _dict.get('name') - if 'protocol' in _dict: - args['protocol'] = _dict.get('protocol') + raise ValueError('Required property \'connection_rate\' not present in LoadBalancerStatistics JSON') + if 'data_processed_this_month' in _dict: + args['data_processed_this_month'] = _dict.get('data_processed_this_month') else: - raise ValueError('Required property \'protocol\' not present in LoadBalancerPoolPrototype JSON') - if 'proxy_protocol' in _dict: - args['proxy_protocol'] = _dict.get('proxy_protocol') - if 'session_persistence' in _dict: - args['session_persistence'] = LoadBalancerPoolSessionPersistencePrototype.from_dict(_dict.get('session_persistence')) + raise ValueError('Required property \'data_processed_this_month\' not present in LoadBalancerStatistics JSON') + if 'throughput' in _dict: + args['throughput'] = _dict.get('throughput') + else: + raise ValueError('Required property \'throughput\' not present in LoadBalancerStatistics JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerPoolPrototype object from a json dictionary.""" + """Initialize a LoadBalancerStatistics object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'algorithm') and self.algorithm is not None: - _dict['algorithm'] = self.algorithm - if hasattr(self, 'health_monitor') and self.health_monitor is not None: - _dict['health_monitor'] = self.health_monitor.to_dict() - if hasattr(self, 'members') and self.members is not None: - _dict['members'] = [x.to_dict() for x in self.members] - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'protocol') and self.protocol is not None: - _dict['protocol'] = self.protocol - if hasattr(self, 'proxy_protocol') and self.proxy_protocol is not None: - _dict['proxy_protocol'] = self.proxy_protocol - if hasattr(self, 'session_persistence') and self.session_persistence is not None: - _dict['session_persistence'] = self.session_persistence.to_dict() + if hasattr(self, 'active_connections') and self.active_connections is not None: + _dict['active_connections'] = self.active_connections + if hasattr(self, 'connection_rate') and self.connection_rate is not None: + _dict['connection_rate'] = self.connection_rate + if hasattr(self, 'data_processed_this_month') and self.data_processed_this_month is not None: + _dict['data_processed_this_month'] = self.data_processed_this_month + if hasattr(self, 'throughput') and self.throughput is not None: + _dict['throughput'] = self.throughput return _dict def _to_dict(self): @@ -41863,125 +46024,142 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerPoolPrototype object.""" + """Return a `str` version of this LoadBalancerStatistics object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerPoolPrototype') -> bool: + def __eq__(self, other: 'LoadBalancerStatistics') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerPoolPrototype') -> bool: + def __ne__(self, other: 'LoadBalancerStatistics') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class AlgorithmEnum(str, Enum): - """ - The load balancing algorithm. - """ - LEAST_CONNECTIONS = 'least_connections' - ROUND_ROBIN = 'round_robin' - WEIGHTED_ROUND_ROBIN = 'weighted_round_robin' - - - class ProtocolEnum(str, Enum): - """ - The protocol used for this load balancer pool. Load balancers in the `network` - family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in - the - `application` family support `tcp`, `http`, and `https`. - """ - HTTP = 'http' - HTTPS = 'https' - TCP = 'tcp' - UDP = 'udp' - - - class ProxyProtocolEnum(str, Enum): - """ - The PROXY protocol setting for this pool: - - `v1`: Enabled with version 1 (human-readable header format) - - `v2`: Enabled with version 2 (binary header format) - - `disabled`: Disabled - Supported by load balancers in the `application` family (otherwise always - `disabled`). - """ - DISABLED = 'disabled' - V1 = 'v1' - V2 = 'v2' - - -class LoadBalancerPoolReference(): +class NetworkACL(): """ - LoadBalancerPoolReference. + NetworkACL. - :attr LoadBalancerPoolReferenceDeleted deleted: (optional) If present, this - property indicates the referenced resource has been deleted and provides - some supplementary information. - :attr str href: The pool's canonical URL. - :attr str id: The unique identifier for this load balancer pool. - :attr str name: The user-defined name for this load balancer pool. + :attr datetime created_at: The date and time that the network ACL was created. + :attr str crn: The CRN for this network ACL. + :attr str href: The URL for this network ACL. + :attr str id: The unique identifier for this network ACL. + :attr str name: The user-defined name for this network ACL. + :attr ResourceGroupReference resource_group: The resource group for this network + ACL. + :attr List[NetworkACLRuleItem] rules: The ordered rules for this network ACL. If + no rules exist, all traffic will be denied. + :attr List[SubnetReference] subnets: The subnets to which this network ACL is + attached. + :attr VPCReference vpc: The VPC this network ACL is a part of. """ def __init__(self, + created_at: datetime, + crn: str, href: str, id: str, name: str, - *, - deleted: 'LoadBalancerPoolReferenceDeleted' = None) -> None: + resource_group: 'ResourceGroupReference', + rules: List['NetworkACLRuleItem'], + subnets: List['SubnetReference'], + vpc: 'VPCReference') -> None: """ - Initialize a LoadBalancerPoolReference object. + Initialize a NetworkACL object. - :param str href: The pool's canonical URL. - :param str id: The unique identifier for this load balancer pool. - :param str name: The user-defined name for this load balancer pool. - :param LoadBalancerPoolReferenceDeleted deleted: (optional) If present, - this property indicates the referenced resource has been deleted and - provides - some supplementary information. + :param datetime created_at: The date and time that the network ACL was + created. + :param str crn: The CRN for this network ACL. + :param str href: The URL for this network ACL. + :param str id: The unique identifier for this network ACL. + :param str name: The user-defined name for this network ACL. + :param ResourceGroupReference resource_group: The resource group for this + network ACL. + :param List[NetworkACLRuleItem] rules: The ordered rules for this network + ACL. If no rules exist, all traffic will be denied. + :param List[SubnetReference] subnets: The subnets to which this network ACL + is attached. + :param VPCReference vpc: The VPC this network ACL is a part of. """ - self.deleted = deleted + self.created_at = created_at + self.crn = crn self.href = href self.id = id self.name = name + self.resource_group = resource_group + self.rules = rules + self.subnets = subnets + self.vpc = vpc - @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolReference': - """Initialize a LoadBalancerPoolReference object from a json dictionary.""" + @classmethod + def from_dict(cls, _dict: Dict) -> 'NetworkACL': + """Initialize a NetworkACL object from a json dictionary.""" args = {} - if 'deleted' in _dict: - args['deleted'] = LoadBalancerPoolReferenceDeleted.from_dict(_dict.get('deleted')) + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) + else: + raise ValueError('Required property \'created_at\' not present in NetworkACL JSON') + if 'crn' in _dict: + args['crn'] = _dict.get('crn') + else: + raise ValueError('Required property \'crn\' not present in NetworkACL JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in LoadBalancerPoolReference JSON') + raise ValueError('Required property \'href\' not present in NetworkACL JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in LoadBalancerPoolReference JSON') + raise ValueError('Required property \'id\' not present in NetworkACL JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in LoadBalancerPoolReference JSON') + raise ValueError('Required property \'name\' not present in NetworkACL JSON') + if 'resource_group' in _dict: + args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) + else: + raise ValueError('Required property \'resource_group\' not present in NetworkACL JSON') + if 'rules' in _dict: + args['rules'] = [NetworkACLRuleItem.from_dict(x) for x in _dict.get('rules')] + else: + raise ValueError('Required property \'rules\' not present in NetworkACL JSON') + if 'subnets' in _dict: + args['subnets'] = [SubnetReference.from_dict(x) for x in _dict.get('subnets')] + else: + raise ValueError('Required property \'subnets\' not present in NetworkACL JSON') + if 'vpc' in _dict: + args['vpc'] = VPCReference.from_dict(_dict.get('vpc')) + else: + raise ValueError('Required property \'vpc\' not present in NetworkACL JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerPoolReference object from a json dictionary.""" + """Initialize a NetworkACL object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name + if hasattr(self, 'resource_group') and self.resource_group is not None: + _dict['resource_group'] = self.resource_group.to_dict() + if hasattr(self, 'rules') and self.rules is not None: + _dict['rules'] = [x.to_dict() for x in self.rules] + if hasattr(self, 'subnets') and self.subnets is not None: + _dict['subnets'] = [x.to_dict() for x in self.subnets] + if hasattr(self, 'vpc') and self.vpc is not None: + _dict['vpc'] = self.vpc.to_dict() return _dict def _to_dict(self): @@ -41989,56 +46167,101 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerPoolReference object.""" + """Return a `str` version of this NetworkACL object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerPoolReference') -> bool: + def __eq__(self, other: 'NetworkACL') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerPoolReference') -> bool: + def __ne__(self, other: 'NetworkACL') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerPoolReferenceDeleted(): +class NetworkACLCollection(): """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. + NetworkACLCollection. - :attr str more_info: Link to documentation about deleted resources. + :attr NetworkACLCollectionFirst first: A link to the first page of resources. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr List[NetworkACL] network_acls: Collection of network ACLs. + :attr NetworkACLCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages + except the last page. + :attr int total_count: The total number of resources across all pages. """ def __init__(self, - more_info: str) -> None: + first: 'NetworkACLCollectionFirst', + limit: int, + network_acls: List['NetworkACL'], + total_count: int, + *, + next: 'NetworkACLCollectionNext' = None) -> None: """ - Initialize a LoadBalancerPoolReferenceDeleted object. + Initialize a NetworkACLCollection object. - :param str more_info: Link to documentation about deleted resources. + :param NetworkACLCollectionFirst first: A link to the first page of + resources. + :param int limit: The maximum number of resources that can be returned by + the request. + :param List[NetworkACL] network_acls: Collection of network ACLs. + :param int total_count: The total number of resources across all pages. + :param NetworkACLCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages + except the last page. """ - self.more_info = more_info + self.first = first + self.limit = limit + self.network_acls = network_acls + self.next = next + self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolReferenceDeleted': - """Initialize a LoadBalancerPoolReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'NetworkACLCollection': + """Initialize a NetworkACLCollection object from a json dictionary.""" args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') + if 'first' in _dict: + args['first'] = NetworkACLCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'more_info\' not present in LoadBalancerPoolReferenceDeleted JSON') + raise ValueError('Required property \'first\' not present in NetworkACLCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') + else: + raise ValueError('Required property \'limit\' not present in NetworkACLCollection JSON') + if 'network_acls' in _dict: + args['network_acls'] = [NetworkACL.from_dict(x) for x in _dict.get('network_acls')] + else: + raise ValueError('Required property \'network_acls\' not present in NetworkACLCollection JSON') + if 'next' in _dict: + args['next'] = NetworkACLCollectionNext.from_dict(_dict.get('next')) + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') + else: + raise ValueError('Required property \'total_count\' not present in NetworkACLCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerPoolReferenceDeleted object from a json dictionary.""" + """Initialize a NetworkACLCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'network_acls') and self.network_acls is not None: + _dict['network_acls'] = [x.to_dict() for x in self.network_acls] + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count return _dict def _to_dict(self): @@ -42046,70 +46269,55 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerPoolReferenceDeleted object.""" + """Return a `str` version of this NetworkACLCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerPoolReferenceDeleted') -> bool: + def __eq__(self, other: 'NetworkACLCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerPoolReferenceDeleted') -> bool: + def __ne__(self, other: 'NetworkACLCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerPoolSessionPersistence(): +class NetworkACLCollectionFirst(): """ - LoadBalancerPoolSessionPersistence. + A link to the first page of resources. - :attr str cookie_name: (optional) The session persistence cookie name. - Applicable only for type `app_cookie`. Names starting with `IBM` are not - allowed. - :attr str type: The session persistence type. The `http_cookie` and `app_cookie` - types are applicable only to the `http` and `https` protocols. + :attr str href: The URL for a page of resources. """ def __init__(self, - type: str, - *, - cookie_name: str = None) -> None: + href: str) -> None: """ - Initialize a LoadBalancerPoolSessionPersistence object. + Initialize a NetworkACLCollectionFirst object. - :param str type: The session persistence type. The `http_cookie` and - `app_cookie` types are applicable only to the `http` and `https` protocols. - :param str cookie_name: (optional) The session persistence cookie name. - Applicable only for type `app_cookie`. Names starting with `IBM` are not - allowed. + :param str href: The URL for a page of resources. """ - self.cookie_name = cookie_name - self.type = type + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolSessionPersistence': - """Initialize a LoadBalancerPoolSessionPersistence object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'NetworkACLCollectionFirst': + """Initialize a NetworkACLCollectionFirst object from a json dictionary.""" args = {} - if 'cookie_name' in _dict: - args['cookie_name'] = _dict.get('cookie_name') - if 'type' in _dict: - args['type'] = _dict.get('type') + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'type\' not present in LoadBalancerPoolSessionPersistence JSON') + raise ValueError('Required property \'href\' not present in NetworkACLCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerPoolSessionPersistence object from a json dictionary.""" + """Initialize a NetworkACLCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'cookie_name') and self.cookie_name is not None: - _dict['cookie_name'] = self.cookie_name - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -42117,80 +46325,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerPoolSessionPersistence object.""" + """Return a `str` version of this NetworkACLCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerPoolSessionPersistence') -> bool: + def __eq__(self, other: 'NetworkACLCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerPoolSessionPersistence') -> bool: + def __ne__(self, other: 'NetworkACLCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class TypeEnum(str, Enum): - """ - The session persistence type. The `http_cookie` and `app_cookie` types are - applicable only to the `http` and `https` protocols. - """ - APP_COOKIE = 'app_cookie' - HTTP_COOKIE = 'http_cookie' - SOURCE_IP = 'source_ip' - - -class LoadBalancerPoolSessionPersistencePatch(): +class NetworkACLCollectionNext(): """ - The session persistence configuration. Specify `null` to remove any existing session - persistence configuration. + A link to the next page of resources. This property is present for all pages except + the last page. - :attr str cookie_name: (optional) The session persistence cookie name. - Applicable only for type `app_cookie`. Names starting with `IBM` are not - allowed. - :attr str type: (optional) The session persistence type. The `http_cookie` and - `app_cookie` types are applicable only to the `http` and `https` protocols. + :attr str href: The URL for a page of resources. """ def __init__(self, - *, - cookie_name: str = None, - type: str = None) -> None: + href: str) -> None: """ - Initialize a LoadBalancerPoolSessionPersistencePatch object. + Initialize a NetworkACLCollectionNext object. - :param str cookie_name: (optional) The session persistence cookie name. - Applicable only for type `app_cookie`. Names starting with `IBM` are not - allowed. - :param str type: (optional) The session persistence type. The `http_cookie` - and `app_cookie` types are applicable only to the `http` and `https` - protocols. + :param str href: The URL for a page of resources. """ - self.cookie_name = cookie_name - self.type = type + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolSessionPersistencePatch': - """Initialize a LoadBalancerPoolSessionPersistencePatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'NetworkACLCollectionNext': + """Initialize a NetworkACLCollectionNext object from a json dictionary.""" args = {} - if 'cookie_name' in _dict: - args['cookie_name'] = _dict.get('cookie_name') - if 'type' in _dict: - args['type'] = _dict.get('type') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in NetworkACLCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerPoolSessionPersistencePatch object from a json dictionary.""" + """Initialize a NetworkACLCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'cookie_name') and self.cookie_name is not None: - _dict['cookie_name'] = self.cookie_name - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -42198,211 +46382,71 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerPoolSessionPersistencePatch object.""" + """Return a `str` version of this NetworkACLCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerPoolSessionPersistencePatch') -> bool: + def __eq__(self, other: 'NetworkACLCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerPoolSessionPersistencePatch') -> bool: + def __ne__(self, other: 'NetworkACLCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class TypeEnum(str, Enum): - """ - The session persistence type. The `http_cookie` and `app_cookie` types are - applicable only to the `http` and `https` protocols. - """ - APP_COOKIE = 'app_cookie' - HTTP_COOKIE = 'http_cookie' - SOURCE_IP = 'source_ip' - - -class LoadBalancerPoolSessionPersistencePrototype(): +class NetworkACLIdentity(): """ - LoadBalancerPoolSessionPersistencePrototype. + Identifies a network ACL by a unique property. - :attr str cookie_name: (optional) The session persistence cookie name. - Applicable only for type `app_cookie`. Names starting with `IBM` are not - allowed. - :attr str type: The session persistence type. The `http_cookie` and `app_cookie` - types are applicable only to the `http` and `https` protocols. """ - def __init__(self, - type: str, - *, - cookie_name: str = None) -> None: - """ - Initialize a LoadBalancerPoolSessionPersistencePrototype object. - - :param str type: The session persistence type. The `http_cookie` and - `app_cookie` types are applicable only to the `http` and `https` protocols. - :param str cookie_name: (optional) The session persistence cookie name. - Applicable only for type `app_cookie`. Names starting with `IBM` are not - allowed. + def __init__(self) -> None: """ - self.cookie_name = cookie_name - self.type = type - - @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerPoolSessionPersistencePrototype': - """Initialize a LoadBalancerPoolSessionPersistencePrototype object from a json dictionary.""" - args = {} - if 'cookie_name' in _dict: - args['cookie_name'] = _dict.get('cookie_name') - if 'type' in _dict: - args['type'] = _dict.get('type') - else: - raise ValueError('Required property \'type\' not present in LoadBalancerPoolSessionPersistencePrototype JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a LoadBalancerPoolSessionPersistencePrototype object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'cookie_name') and self.cookie_name is not None: - _dict['cookie_name'] = self.cookie_name - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this LoadBalancerPoolSessionPersistencePrototype object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'LoadBalancerPoolSessionPersistencePrototype') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'LoadBalancerPoolSessionPersistencePrototype') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other + Initialize a NetworkACLIdentity object. - class TypeEnum(str, Enum): - """ - The session persistence type. The `http_cookie` and `app_cookie` types are - applicable only to the `http` and `https` protocols. """ - APP_COOKIE = 'app_cookie' - HTTP_COOKIE = 'http_cookie' - SOURCE_IP = 'source_ip' - + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['NetworkACLIdentityById', 'NetworkACLIdentityByCRN', 'NetworkACLIdentityByHref'])) + raise Exception(msg) -class LoadBalancerPrivateIpsItem(): +class NetworkACLPatch(): """ - LoadBalancerPrivateIpsItem. + NetworkACLPatch. - :attr str address: The IP address. - If the address has not yet been selected, the value will be `0.0.0.0`. - This property may add support for IPv6 addresses in the future. When processing - a value in this property, verify that the address is in an expected format. If - it is not, log an error. Optionally halt processing and surface the error, or - bypass the resource on which the unexpected IP address format was encountered. - :attr ReservedIPReferenceDeleted deleted: (optional) If present, this property - indicates the referenced resource has been deleted and provides - some supplementary information. - :attr str href: The URL for this reserved IP. - :attr str id: The unique identifier for this reserved IP. - :attr str name: The user-defined or system-provided name for this reserved IP. - :attr str resource_type: The resource type. + :attr str name: (optional) The user-defined name for this network ACL. Names + must be unique within the VPC the network ACL resides in. """ def __init__(self, - address: str, - href: str, - id: str, - name: str, - resource_type: str, *, - deleted: 'ReservedIPReferenceDeleted' = None) -> None: + name: str = None) -> None: """ - Initialize a LoadBalancerPrivateIpsItem object. + Initialize a NetworkACLPatch object. - :param str address: The IP address. - If the address has not yet been selected, the value will be `0.0.0.0`. - This property may add support for IPv6 addresses in the future. When - processing a value in this property, verify that the address is in an - expected format. If it is not, log an error. Optionally halt processing and - surface the error, or bypass the resource on which the unexpected IP - address format was encountered. - :param str href: The URL for this reserved IP. - :param str id: The unique identifier for this reserved IP. - :param str name: The user-defined or system-provided name for this reserved - IP. - :param str resource_type: The resource type. - :param ReservedIPReferenceDeleted deleted: (optional) If present, this - property indicates the referenced resource has been deleted and provides - some supplementary information. + :param str name: (optional) The user-defined name for this network ACL. + Names must be unique within the VPC the network ACL resides in. """ - self.address = address - self.deleted = deleted - self.href = href - self.id = id self.name = name - self.resource_type = resource_type @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerPrivateIpsItem': - """Initialize a LoadBalancerPrivateIpsItem object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'NetworkACLPatch': + """Initialize a NetworkACLPatch object from a json dictionary.""" args = {} - if 'address' in _dict: - args['address'] = _dict.get('address') - else: - raise ValueError('Required property \'address\' not present in LoadBalancerPrivateIpsItem JSON') - if 'deleted' in _dict: - args['deleted'] = ReservedIPReferenceDeleted.from_dict(_dict.get('deleted')) - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in LoadBalancerPrivateIpsItem JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in LoadBalancerPrivateIpsItem JSON') if 'name' in _dict: args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in LoadBalancerPrivateIpsItem JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in LoadBalancerPrivateIpsItem JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerPrivateIpsItem object from a json dictionary.""" + """Initialize a NetworkACLPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'address') and self.address is not None: - _dict['address'] = self.address - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type return _dict def _to_dict(self): @@ -42410,135 +46454,132 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerPrivateIpsItem object.""" + """Return a `str` version of this NetworkACLPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerPrivateIpsItem') -> bool: + def __eq__(self, other: 'NetworkACLPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerPrivateIpsItem') -> bool: + def __ne__(self, other: 'NetworkACLPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ResourceTypeEnum(str, Enum): - """ - The resource type. +class NetworkACLPrototype(): + """ + NetworkACLPrototype. + + :attr str name: (optional) The user-defined name for this network ACL. Names + must be unique within the VPC the network ACL resides in. If unspecified, the + name will be a hyphenated list of randomly-selected words. + :attr ResourceGroupIdentity resource_group: (optional) The resource group to + use. If unspecified, the account's [default resource + group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + :attr VPCIdentity vpc: The VPC this network ACL is to be a part of. + """ + + def __init__(self, + vpc: 'VPCIdentity', + *, + name: str = None, + resource_group: 'ResourceGroupIdentity' = None) -> None: """ - SUBNET_RESERVED_IP = 'subnet_reserved_ip' + Initialize a NetworkACLPrototype object. + :param VPCIdentity vpc: The VPC this network ACL is to be a part of. + :param str name: (optional) The user-defined name for this network ACL. + Names must be unique within the VPC the network ACL resides in. If + unspecified, the name will be a hyphenated list of randomly-selected words. + :param ResourceGroupIdentity resource_group: (optional) The resource group + to use. If unspecified, the account's [default resource + group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is + used. + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['NetworkACLPrototypeNetworkACLByRules', 'NetworkACLPrototypeNetworkACLBySourceNetworkACL'])) + raise Exception(msg) -class LoadBalancerProfile(): +class NetworkACLReference(): """ - LoadBalancerProfile. + NetworkACLReference. - :attr str family: The product family this load balancer profile belongs to. - :attr str href: The URL for this load balancer profile. - :attr LoadBalancerProfileLoggingSupported logging_supported: Indicates which - logging type(s) are supported for a load balancer with this profile. - :attr str name: The globally unique name for this load balancer profile. - :attr LoadBalancerProfileRouteModeSupported route_mode_supported: - :attr LoadBalancerProfileSecurityGroupsSupported security_groups_supported: - :attr LoadBalancerProfileUDPSupported udp_supported: + :attr str crn: The CRN for this network ACL. + :attr NetworkACLReferenceDeleted deleted: (optional) If present, this property + indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str href: The URL for this network ACL. + :attr str id: The unique identifier for this network ACL. + :attr str name: The user-defined name for this network ACL. """ def __init__(self, - family: str, + crn: str, href: str, - logging_supported: 'LoadBalancerProfileLoggingSupported', - name: str, - route_mode_supported: 'LoadBalancerProfileRouteModeSupported', - security_groups_supported: 'LoadBalancerProfileSecurityGroupsSupported', - udp_supported: 'LoadBalancerProfileUDPSupported') -> None: - """ - Initialize a LoadBalancerProfile object. - - :param str family: The product family this load balancer profile belongs - to. - :param str href: The URL for this load balancer profile. - :param LoadBalancerProfileLoggingSupported logging_supported: Indicates - which logging type(s) are supported for a load balancer with this profile. - :param str name: The globally unique name for this load balancer profile. - :param LoadBalancerProfileRouteModeSupported route_mode_supported: - :param LoadBalancerProfileSecurityGroupsSupported - security_groups_supported: - :param LoadBalancerProfileUDPSupported udp_supported: + id: str, + name: str, + *, + deleted: 'NetworkACLReferenceDeleted' = None) -> None: """ - self.family = family + Initialize a NetworkACLReference object. + + :param str crn: The CRN for this network ACL. + :param str href: The URL for this network ACL. + :param str id: The unique identifier for this network ACL. + :param str name: The user-defined name for this network ACL. + :param NetworkACLReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides + some supplementary information. + """ + self.crn = crn + self.deleted = deleted self.href = href - self.logging_supported = logging_supported + self.id = id self.name = name - self.route_mode_supported = route_mode_supported - self.security_groups_supported = security_groups_supported - self.udp_supported = udp_supported @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerProfile': - """Initialize a LoadBalancerProfile object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'NetworkACLReference': + """Initialize a NetworkACLReference object from a json dictionary.""" args = {} - if 'family' in _dict: - args['family'] = _dict.get('family') + if 'crn' in _dict: + args['crn'] = _dict.get('crn') else: - raise ValueError('Required property \'family\' not present in LoadBalancerProfile JSON') + raise ValueError('Required property \'crn\' not present in NetworkACLReference JSON') + if 'deleted' in _dict: + args['deleted'] = NetworkACLReferenceDeleted.from_dict(_dict.get('deleted')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in LoadBalancerProfile JSON') - if 'logging_supported' in _dict: - args['logging_supported'] = LoadBalancerProfileLoggingSupported.from_dict(_dict.get('logging_supported')) + raise ValueError('Required property \'href\' not present in NetworkACLReference JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') else: - raise ValueError('Required property \'logging_supported\' not present in LoadBalancerProfile JSON') + raise ValueError('Required property \'id\' not present in NetworkACLReference JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in LoadBalancerProfile JSON') - if 'route_mode_supported' in _dict: - args['route_mode_supported'] = _dict.get('route_mode_supported') - else: - raise ValueError('Required property \'route_mode_supported\' not present in LoadBalancerProfile JSON') - if 'security_groups_supported' in _dict: - args['security_groups_supported'] = _dict.get('security_groups_supported') - else: - raise ValueError('Required property \'security_groups_supported\' not present in LoadBalancerProfile JSON') - if 'udp_supported' in _dict: - args['udp_supported'] = _dict.get('udp_supported') - else: - raise ValueError('Required property \'udp_supported\' not present in LoadBalancerProfile JSON') + raise ValueError('Required property \'name\' not present in NetworkACLReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerProfile object from a json dictionary.""" + """Initialize a NetworkACLReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'family') and self.family is not None: - _dict['family'] = self.family + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href - if hasattr(self, 'logging_supported') and self.logging_supported is not None: - _dict['logging_supported'] = self.logging_supported.to_dict() + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'route_mode_supported') and self.route_mode_supported is not None: - if isinstance(self.route_mode_supported, dict): - _dict['route_mode_supported'] = self.route_mode_supported - else: - _dict['route_mode_supported'] = self.route_mode_supported.to_dict() - if hasattr(self, 'security_groups_supported') and self.security_groups_supported is not None: - if isinstance(self.security_groups_supported, dict): - _dict['security_groups_supported'] = self.security_groups_supported - else: - _dict['security_groups_supported'] = self.security_groups_supported.to_dict() - if hasattr(self, 'udp_supported') and self.udp_supported is not None: - if isinstance(self.udp_supported, dict): - _dict['udp_supported'] = self.udp_supported - else: - _dict['udp_supported'] = self.udp_supported.to_dict() return _dict def _to_dict(self): @@ -42546,103 +46587,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerProfile object.""" + """Return a `str` version of this NetworkACLReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerProfile') -> bool: + def __eq__(self, other: 'NetworkACLReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerProfile') -> bool: + def __ne__(self, other: 'NetworkACLReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerProfileCollection(): +class NetworkACLReferenceDeleted(): """ - LoadBalancerProfileCollection. + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. - :attr LoadBalancerProfileCollectionFirst first: A link to the first page of - resources. - :attr int limit: The maximum number of resources that can be returned by the - request. - :attr LoadBalancerProfileCollectionNext next: (optional) A link to the next page - of resources. This property is present for all pages - except the last page. - :attr List[LoadBalancerProfile] profiles: Collection of load balancer profiles. - :attr int total_count: The total number of resources across all pages. + :attr str more_info: Link to documentation about deleted resources. """ def __init__(self, - first: 'LoadBalancerProfileCollectionFirst', - limit: int, - profiles: List['LoadBalancerProfile'], - total_count: int, - *, - next: 'LoadBalancerProfileCollectionNext' = None) -> None: + more_info: str) -> None: """ - Initialize a LoadBalancerProfileCollection object. + Initialize a NetworkACLReferenceDeleted object. - :param LoadBalancerProfileCollectionFirst first: A link to the first page - of resources. - :param int limit: The maximum number of resources that can be returned by - the request. - :param List[LoadBalancerProfile] profiles: Collection of load balancer - profiles. - :param int total_count: The total number of resources across all pages. - :param LoadBalancerProfileCollectionNext next: (optional) A link to the - next page of resources. This property is present for all pages - except the last page. + :param str more_info: Link to documentation about deleted resources. """ - self.first = first - self.limit = limit - self.next = next - self.profiles = profiles - self.total_count = total_count + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerProfileCollection': - """Initialize a LoadBalancerProfileCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'NetworkACLReferenceDeleted': + """Initialize a NetworkACLReferenceDeleted object from a json dictionary.""" args = {} - if 'first' in _dict: - args['first'] = LoadBalancerProfileCollectionFirst.from_dict(_dict.get('first')) - else: - raise ValueError('Required property \'first\' not present in LoadBalancerProfileCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') - else: - raise ValueError('Required property \'limit\' not present in LoadBalancerProfileCollection JSON') - if 'next' in _dict: - args['next'] = LoadBalancerProfileCollectionNext.from_dict(_dict.get('next')) - if 'profiles' in _dict: - args['profiles'] = [LoadBalancerProfile.from_dict(x) for x in _dict.get('profiles')] - else: - raise ValueError('Required property \'profiles\' not present in LoadBalancerProfileCollection JSON') - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'total_count\' not present in LoadBalancerProfileCollection JSON') + raise ValueError('Required property \'more_info\' not present in NetworkACLReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerProfileCollection object from a json dictionary.""" + """Initialize a NetworkACLReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'profiles') and self.profiles is not None: - _dict['profiles'] = [x.to_dict() for x in self.profiles] - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -42650,112 +46644,255 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerProfileCollection object.""" + """Return a `str` version of this NetworkACLReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerProfileCollection') -> bool: + def __eq__(self, other: 'NetworkACLReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerProfileCollection') -> bool: + def __ne__(self, other: 'NetworkACLReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerProfileCollectionFirst(): +class NetworkACLRule(): """ - A link to the first page of resources. + NetworkACLRule. - :attr str href: The URL for a page of resources. + :attr str action: Whether to allow or deny matching traffic. + :attr NetworkACLRuleReference before: (optional) The rule that this rule is + immediately before. If absent, this is the last rule. + :attr datetime created_at: The date and time that the rule was created. + :attr str destination: The destination CIDR block. The CIDR block `0.0.0.0/0` + applies to all addresses. + :attr str direction: Whether the traffic to be matched is `inbound` or + `outbound`. + :attr str href: The URL for this network ACL rule. + :attr str id: The unique identifier for this network ACL rule. + :attr str ip_version: The IP version for this rule. + :attr str name: The user-defined name for this rule. Names must be unique within + the network ACL the rule resides in. If unspecified, the name will be a + hyphenated list of randomly-selected words. + :attr str protocol: The protocol to enforce. + :attr str source: The source CIDR block. The CIDR block `0.0.0.0/0` applies to + all addresses. """ def __init__(self, - href: str) -> None: + action: str, + created_at: datetime, + destination: str, + direction: str, + href: str, + id: str, + ip_version: str, + name: str, + protocol: str, + source: str, + *, + before: 'NetworkACLRuleReference' = None) -> None: """ - Initialize a LoadBalancerProfileCollectionFirst object. + Initialize a NetworkACLRule object. - :param str href: The URL for a page of resources. + :param str action: Whether to allow or deny matching traffic. + :param datetime created_at: The date and time that the rule was created. + :param str destination: The destination CIDR block. The CIDR block + `0.0.0.0/0` applies to all addresses. + :param str direction: Whether the traffic to be matched is `inbound` or + `outbound`. + :param str href: The URL for this network ACL rule. + :param str id: The unique identifier for this network ACL rule. + :param str ip_version: The IP version for this rule. + :param str name: The user-defined name for this rule. Names must be unique + within the network ACL the rule resides in. If unspecified, the name will + be a hyphenated list of randomly-selected words. + :param str protocol: The protocol to enforce. + :param str source: The source CIDR block. The CIDR block `0.0.0.0/0` + applies to all addresses. + :param NetworkACLRuleReference before: (optional) The rule that this rule + is immediately before. If absent, this is the last rule. """ - self.href = href + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['NetworkACLRuleNetworkACLRuleProtocolTCPUDP', 'NetworkACLRuleNetworkACLRuleProtocolICMP', 'NetworkACLRuleNetworkACLRuleProtocolAll'])) + raise Exception(msg) @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerProfileCollectionFirst': - """Initialize a LoadBalancerProfileCollectionFirst object from a json dictionary.""" - args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in LoadBalancerProfileCollectionFirst JSON') - return cls(**args) + def from_dict(cls, _dict: Dict) -> 'NetworkACLRule': + """Initialize a NetworkACLRule object from a json dictionary.""" + disc_class = cls._get_class_by_discriminator(_dict) + if disc_class != cls: + return disc_class.from_dict(_dict) + msg = ("Cannot convert dictionary into an instance of base class 'NetworkACLRule'. " + + "The discriminator value should map to a valid subclass: {1}").format( + ", ".join(['NetworkACLRuleNetworkACLRuleProtocolTCPUDP', 'NetworkACLRuleNetworkACLRuleProtocolICMP', 'NetworkACLRuleNetworkACLRuleProtocolAll'])) + raise Exception(msg) @classmethod - def _from_dict(cls, _dict): - """Initialize a LoadBalancerProfileCollectionFirst object from a json dictionary.""" + def _from_dict(cls, _dict: Dict): + """Initialize a NetworkACLRule object from a json dictionary.""" return cls.from_dict(_dict) - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - return _dict + @classmethod + def _get_class_by_discriminator(cls, _dict: Dict) -> object: + mapping = {} + mapping['all'] = 'NetworkACLRuleNetworkACLRuleProtocolAll' + mapping['icmp'] = 'NetworkACLRuleNetworkACLRuleProtocolICMP' + mapping['tcp'] = 'NetworkACLRuleNetworkACLRuleProtocolTCPUDP' + mapping['udp'] = 'NetworkACLRuleNetworkACLRuleProtocolTCPUDP' + disc_value = _dict.get('protocol') + if disc_value is None: + raise ValueError('Discriminator property \'protocol\' not found in NetworkACLRule JSON') + class_name = mapping.get(disc_value, disc_value) + try: + disc_class = getattr(sys.modules[__name__], class_name) + except AttributeError: + disc_class = cls + if isinstance(disc_class, object): + return disc_class + raise TypeError('%s is not a discriminator class' % class_name) - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() + class ActionEnum(str, Enum): + """ + Whether to allow or deny matching traffic. + """ + ALLOW = 'allow' + DENY = 'deny' - def __str__(self) -> str: - """Return a `str` version of this LoadBalancerProfileCollectionFirst object.""" - return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerProfileCollectionFirst') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ + class DirectionEnum(str, Enum): + """ + Whether the traffic to be matched is `inbound` or `outbound`. + """ + INBOUND = 'inbound' + OUTBOUND = 'outbound' - def __ne__(self, other: 'LoadBalancerProfileCollectionFirst') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other -class LoadBalancerProfileCollectionNext(): + class IpVersionEnum(str, Enum): + """ + The IP version for this rule. + """ + IPV4 = 'ipv4' + IPV6 = 'ipv6' + + +class NetworkACLRuleBeforePatch(): """ - A link to the next page of resources. This property is present for all pages except - the last page. + The rule to move this rule immediately before. Specify `null` to move this rule after + all existing rules. - :attr str href: The URL for a page of resources. + """ + + def __init__(self) -> None: + """ + Initialize a NetworkACLRuleBeforePatch object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['NetworkACLRuleBeforePatchNetworkACLRuleIdentityById', 'NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref'])) + raise Exception(msg) + +class NetworkACLRuleBeforePrototype(): + """ + The rule to insert this rule immediately before. If omitted, this rule will be + inserted after all existing rules. + + """ + + def __init__(self) -> None: + """ + Initialize a NetworkACLRuleBeforePrototype object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityById', 'NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref'])) + raise Exception(msg) + +class NetworkACLRuleCollection(): + """ + NetworkACLRuleCollection. + + :attr NetworkACLRuleCollectionFirst first: A link to the first page of + resources. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr NetworkACLRuleCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages + except the last page. + :attr List[NetworkACLRuleItem] rules: Ordered collection of network ACL rules. + :attr int total_count: The total number of resources across all pages. """ def __init__(self, - href: str) -> None: + first: 'NetworkACLRuleCollectionFirst', + limit: int, + rules: List['NetworkACLRuleItem'], + total_count: int, + *, + next: 'NetworkACLRuleCollectionNext' = None) -> None: """ - Initialize a LoadBalancerProfileCollectionNext object. + Initialize a NetworkACLRuleCollection object. - :param str href: The URL for a page of resources. + :param NetworkACLRuleCollectionFirst first: A link to the first page of + resources. + :param int limit: The maximum number of resources that can be returned by + the request. + :param List[NetworkACLRuleItem] rules: Ordered collection of network ACL + rules. + :param int total_count: The total number of resources across all pages. + :param NetworkACLRuleCollectionNext next: (optional) A link to the next + page of resources. This property is present for all pages + except the last page. """ - self.href = href + self.first = first + self.limit = limit + self.next = next + self.rules = rules + self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerProfileCollectionNext': - """Initialize a LoadBalancerProfileCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'NetworkACLRuleCollection': + """Initialize a NetworkACLRuleCollection object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') + if 'first' in _dict: + args['first'] = NetworkACLRuleCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'href\' not present in LoadBalancerProfileCollectionNext JSON') + raise ValueError('Required property \'first\' not present in NetworkACLRuleCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') + else: + raise ValueError('Required property \'limit\' not present in NetworkACLRuleCollection JSON') + if 'next' in _dict: + args['next'] = NetworkACLRuleCollectionNext.from_dict(_dict.get('next')) + if 'rules' in _dict: + args['rules'] = [NetworkACLRuleItem.from_dict(x) for x in _dict.get('rules')] + else: + raise ValueError('Required property \'rules\' not present in NetworkACLRuleCollection JSON') + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') + else: + raise ValueError('Required property \'total_count\' not present in NetworkACLRuleCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerProfileCollectionNext object from a json dictionary.""" + """Initialize a NetworkACLRuleCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'rules') and self.rules is not None: + _dict['rules'] = [x.to_dict() for x in self.rules] + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count return _dict def _to_dict(self): @@ -42763,82 +46900,55 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerProfileCollectionNext object.""" + """Return a `str` version of this NetworkACLRuleCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerProfileCollectionNext') -> bool: + def __eq__(self, other: 'NetworkACLRuleCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerProfileCollectionNext') -> bool: + def __ne__(self, other: 'NetworkACLRuleCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerProfileIdentity(): - """ - Identifies a load balancer profile by a unique property. - - """ - - def __init__(self) -> None: - """ - Initialize a LoadBalancerProfileIdentity object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['LoadBalancerProfileIdentityByName', 'LoadBalancerProfileIdentityByHref'])) - raise Exception(msg) - -class LoadBalancerProfileLoggingSupported(): +class NetworkACLRuleCollectionFirst(): """ - Indicates which logging type(s) are supported for a load balancer with this profile. + A link to the first page of resources. - :attr str type: The type for this profile field. - :attr List[str] value: The supported logging type(s) for a load balancer with - this profile. + :attr str href: The URL for a page of resources. """ def __init__(self, - type: str, - value: List[str]) -> None: + href: str) -> None: """ - Initialize a LoadBalancerProfileLoggingSupported object. + Initialize a NetworkACLRuleCollectionFirst object. - :param str type: The type for this profile field. - :param List[str] value: The supported logging type(s) for a load balancer - with this profile. + :param str href: The URL for a page of resources. """ - self.type = type - self.value = value + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerProfileLoggingSupported': - """Initialize a LoadBalancerProfileLoggingSupported object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'NetworkACLRuleCollectionFirst': + """Initialize a NetworkACLRuleCollectionFirst object from a json dictionary.""" args = {} - if 'type' in _dict: - args['type'] = _dict.get('type') - else: - raise ValueError('Required property \'type\' not present in LoadBalancerProfileLoggingSupported JSON') - if 'value' in _dict: - args['value'] = _dict.get('value') + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'value\' not present in LoadBalancerProfileLoggingSupported JSON') + raise ValueError('Required property \'href\' not present in NetworkACLRuleCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerProfileLoggingSupported object from a json dictionary.""" + """Initialize a NetworkACLRuleCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type - if hasattr(self, 'value') and self.value is not None: - _dict['value'] = self.value + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -42846,83 +46956,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerProfileLoggingSupported object.""" + """Return a `str` version of this NetworkACLRuleCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerProfileLoggingSupported') -> bool: + def __eq__(self, other: 'NetworkACLRuleCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerProfileLoggingSupported') -> bool: + def __ne__(self, other: 'NetworkACLRuleCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class TypeEnum(str, Enum): - """ - The type for this profile field. - """ - FIXED = 'fixed' - - -class LoadBalancerProfileReference(): +class NetworkACLRuleCollectionNext(): """ - LoadBalancerProfileReference. + A link to the next page of resources. This property is present for all pages except + the last page. - :attr str family: The product family this load balancer profile belongs to. - :attr str href: The URL for this load balancer profile. - :attr str name: The globally unique name for this load balancer profile. + :attr str href: The URL for a page of resources. """ def __init__(self, - family: str, - href: str, - name: str) -> None: + href: str) -> None: """ - Initialize a LoadBalancerProfileReference object. + Initialize a NetworkACLRuleCollectionNext object. - :param str family: The product family this load balancer profile belongs - to. - :param str href: The URL for this load balancer profile. - :param str name: The globally unique name for this load balancer profile. + :param str href: The URL for a page of resources. """ - self.family = family self.href = href - self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerProfileReference': - """Initialize a LoadBalancerProfileReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'NetworkACLRuleCollectionNext': + """Initialize a NetworkACLRuleCollectionNext object from a json dictionary.""" args = {} - if 'family' in _dict: - args['family'] = _dict.get('family') - else: - raise ValueError('Required property \'family\' not present in LoadBalancerProfileReference JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in LoadBalancerProfileReference JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in LoadBalancerProfileReference JSON') + raise ValueError('Required property \'href\' not present in NetworkACLRuleCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerProfileReference object from a json dictionary.""" + """Initialize a NetworkACLRuleCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'family') and self.family is not None: - _dict['family'] = self.family if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name return _dict def _to_dict(self): @@ -42930,193 +47013,288 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerProfileReference object.""" + """Return a `str` version of this NetworkACLRuleCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerProfileReference') -> bool: + def __eq__(self, other: 'NetworkACLRuleCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerProfileReference') -> bool: + def __ne__(self, other: 'NetworkACLRuleCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LoadBalancerProfileRouteModeSupported(): +class NetworkACLRuleItem(): """ - LoadBalancerProfileRouteModeSupported. + NetworkACLRuleItem. + :attr str action: Whether to allow or deny matching traffic. + :attr NetworkACLRuleReference before: (optional) The rule that this rule is + immediately before. In a rule collection, this always + refers to the next item in the collection. If absent, this is the last rule. + :attr datetime created_at: The date and time that the rule was created. + :attr str destination: The destination CIDR block. The CIDR block `0.0.0.0/0` + applies to all addresses. + :attr str direction: Whether the traffic to be matched is `inbound` or + `outbound`. + :attr str href: The URL for this network ACL rule. + :attr str id: The unique identifier for this network ACL rule. + :attr str ip_version: The IP version for this rule. + :attr str name: The user-defined name for this rule. Names must be unique within + the network ACL the rule resides in. If unspecified, the name will be a + hyphenated list of randomly-selected words. + :attr str protocol: The protocol to enforce. + :attr str source: The source CIDR block. The CIDR block `0.0.0.0/0` applies to + all addresses. """ - def __init__(self) -> None: + def __init__(self, + action: str, + created_at: datetime, + destination: str, + direction: str, + href: str, + id: str, + ip_version: str, + name: str, + protocol: str, + source: str, + *, + before: 'NetworkACLRuleReference' = None) -> None: """ - Initialize a LoadBalancerProfileRouteModeSupported object. + Initialize a NetworkACLRuleItem object. + :param str action: Whether to allow or deny matching traffic. + :param datetime created_at: The date and time that the rule was created. + :param str destination: The destination CIDR block. The CIDR block + `0.0.0.0/0` applies to all addresses. + :param str direction: Whether the traffic to be matched is `inbound` or + `outbound`. + :param str href: The URL for this network ACL rule. + :param str id: The unique identifier for this network ACL rule. + :param str ip_version: The IP version for this rule. + :param str name: The user-defined name for this rule. Names must be unique + within the network ACL the rule resides in. If unspecified, the name will + be a hyphenated list of randomly-selected words. + :param str protocol: The protocol to enforce. + :param str source: The source CIDR block. The CIDR block `0.0.0.0/0` + applies to all addresses. + :param NetworkACLRuleReference before: (optional) The rule that this rule + is immediately before. In a rule collection, this always + refers to the next item in the collection. If absent, this is the last + rule. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['LoadBalancerProfileRouteModeSupportedFixed', 'LoadBalancerProfileRouteModeSupportedDependent'])) + ", ".join(['NetworkACLRuleItemNetworkACLRuleProtocolTCPUDP', 'NetworkACLRuleItemNetworkACLRuleProtocolICMP', 'NetworkACLRuleItemNetworkACLRuleProtocolAll'])) raise Exception(msg) -class LoadBalancerProfileSecurityGroupsSupported(): - """ - LoadBalancerProfileSecurityGroupsSupported. - - """ - - def __init__(self) -> None: - """ - Initialize a LoadBalancerProfileSecurityGroupsSupported object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['LoadBalancerProfileSecurityGroupsSupportedFixed', 'LoadBalancerProfileSecurityGroupsSupportedDependent'])) + @classmethod + def from_dict(cls, _dict: Dict) -> 'NetworkACLRuleItem': + """Initialize a NetworkACLRuleItem object from a json dictionary.""" + disc_class = cls._get_class_by_discriminator(_dict) + if disc_class != cls: + return disc_class.from_dict(_dict) + msg = ("Cannot convert dictionary into an instance of base class 'NetworkACLRuleItem'. " + + "The discriminator value should map to a valid subclass: {1}").format( + ", ".join(['NetworkACLRuleItemNetworkACLRuleProtocolTCPUDP', 'NetworkACLRuleItemNetworkACLRuleProtocolICMP', 'NetworkACLRuleItemNetworkACLRuleProtocolAll'])) raise Exception(msg) -class LoadBalancerProfileUDPSupported(): - """ - LoadBalancerProfileUDPSupported. + @classmethod + def _from_dict(cls, _dict: Dict): + """Initialize a NetworkACLRuleItem object from a json dictionary.""" + return cls.from_dict(_dict) - """ + @classmethod + def _get_class_by_discriminator(cls, _dict: Dict) -> object: + mapping = {} + mapping['all'] = 'NetworkACLRuleItemNetworkACLRuleProtocolAll' + mapping['icmp'] = 'NetworkACLRuleItemNetworkACLRuleProtocolICMP' + mapping['tcp'] = 'NetworkACLRuleItemNetworkACLRuleProtocolTCPUDP' + mapping['udp'] = 'NetworkACLRuleItemNetworkACLRuleProtocolTCPUDP' + disc_value = _dict.get('protocol') + if disc_value is None: + raise ValueError('Discriminator property \'protocol\' not found in NetworkACLRuleItem JSON') + class_name = mapping.get(disc_value, disc_value) + try: + disc_class = getattr(sys.modules[__name__], class_name) + except AttributeError: + disc_class = cls + if isinstance(disc_class, object): + return disc_class + raise TypeError('%s is not a discriminator class' % class_name) - def __init__(self) -> None: + class ActionEnum(str, Enum): """ - Initialize a LoadBalancerProfileUDPSupported object. - + Whether to allow or deny matching traffic. """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['LoadBalancerProfileUDPSupportedFixed', 'LoadBalancerProfileUDPSupportedDependent'])) - raise Exception(msg) - -class LoadBalancerReferenceDeleted(): - """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. + ALLOW = 'allow' + DENY = 'deny' - :attr str more_info: Link to documentation about deleted resources. - """ - def __init__(self, - more_info: str) -> None: + class DirectionEnum(str, Enum): """ - Initialize a LoadBalancerReferenceDeleted object. - - :param str more_info: Link to documentation about deleted resources. + Whether the traffic to be matched is `inbound` or `outbound`. """ - self.more_info = more_info - - @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerReferenceDeleted': - """Initialize a LoadBalancerReferenceDeleted object from a json dictionary.""" - args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') - else: - raise ValueError('Required property \'more_info\' not present in LoadBalancerReferenceDeleted JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a LoadBalancerReferenceDeleted object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() + INBOUND = 'inbound' + OUTBOUND = 'outbound' - def __str__(self) -> str: - """Return a `str` version of this LoadBalancerReferenceDeleted object.""" - return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerReferenceDeleted') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ + class IpVersionEnum(str, Enum): + """ + The IP version for this rule. + """ + IPV4 = 'ipv4' + IPV6 = 'ipv6' - def __ne__(self, other: 'LoadBalancerReferenceDeleted') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other -class LoadBalancerStatistics(): +class NetworkACLRulePatch(): """ - LoadBalancerStatistics. + NetworkACLRulePatch. - :attr int active_connections: Number of active connections of this load - balancer. - :attr float connection_rate: Current connection rate (connections per second) of - this load balancer. - :attr int data_processed_this_month: Total number of data processed (bytes) of - this load balancer within current calendar month. - :attr float throughput: Current throughput (Mbps) of this load balancer. + :attr str action: (optional) Whether to allow or deny matching traffic. + :attr NetworkACLRuleBeforePatch before: (optional) The rule to move this rule + immediately before. Specify `null` to move this rule after + all existing rules. + :attr int code: (optional) The ICMP traffic code to allow. + :attr str destination: (optional) The destination IP address or CIDR block. The + CIDR block `0.0.0.0/0` applies to all addresses. + :attr int destination_port_max: (optional) The inclusive upper bound of TCP/UDP + destination port range. + :attr int destination_port_min: (optional) The inclusive lower bound of TCP/UDP + destination port range. + :attr str direction: (optional) Whether the traffic to be matched is `inbound` + or `outbound`. + :attr str name: (optional) The user-defined name for this rule. Names must be + unique within the network ACL the rule resides in. + :attr str source: (optional) The source IP address or CIDR block. The CIDR + block `0.0.0.0/0` applies to all addresses. + :attr int source_port_max: (optional) The inclusive upper bound of TCP/UDP + source port range. + :attr int source_port_min: (optional) The inclusive lower bound of TCP/UDP + source port range. + :attr int type: (optional) The ICMP traffic type to allow. """ def __init__(self, - active_connections: int, - connection_rate: float, - data_processed_this_month: int, - throughput: float) -> None: + *, + action: str = None, + before: 'NetworkACLRuleBeforePatch' = None, + code: int = None, + destination: str = None, + destination_port_max: int = None, + destination_port_min: int = None, + direction: str = None, + name: str = None, + source: str = None, + source_port_max: int = None, + source_port_min: int = None, + type: int = None) -> None: """ - Initialize a LoadBalancerStatistics object. + Initialize a NetworkACLRulePatch object. - :param int active_connections: Number of active connections of this load - balancer. - :param float connection_rate: Current connection rate (connections per - second) of this load balancer. - :param int data_processed_this_month: Total number of data processed - (bytes) of this load balancer within current calendar month. - :param float throughput: Current throughput (Mbps) of this load balancer. + :param str action: (optional) Whether to allow or deny matching traffic. + :param NetworkACLRuleBeforePatch before: (optional) The rule to move this + rule immediately before. Specify `null` to move this rule after + all existing rules. + :param int code: (optional) The ICMP traffic code to allow. + :param str destination: (optional) The destination IP address or CIDR + block. The CIDR block `0.0.0.0/0` applies to all addresses. + :param int destination_port_max: (optional) The inclusive upper bound of + TCP/UDP destination port range. + :param int destination_port_min: (optional) The inclusive lower bound of + TCP/UDP destination port range. + :param str direction: (optional) Whether the traffic to be matched is + `inbound` or `outbound`. + :param str name: (optional) The user-defined name for this rule. Names must + be unique within the network ACL the rule resides in. + :param str source: (optional) The source IP address or CIDR block. The + CIDR block `0.0.0.0/0` applies to all addresses. + :param int source_port_max: (optional) The inclusive upper bound of TCP/UDP + source port range. + :param int source_port_min: (optional) The inclusive lower bound of TCP/UDP + source port range. + :param int type: (optional) The ICMP traffic type to allow. """ - self.active_connections = active_connections - self.connection_rate = connection_rate - self.data_processed_this_month = data_processed_this_month - self.throughput = throughput + self.action = action + self.before = before + self.code = code + self.destination = destination + self.destination_port_max = destination_port_max + self.destination_port_min = destination_port_min + self.direction = direction + self.name = name + self.source = source + self.source_port_max = source_port_max + self.source_port_min = source_port_min + self.type = type @classmethod - def from_dict(cls, _dict: Dict) -> 'LoadBalancerStatistics': - """Initialize a LoadBalancerStatistics object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'NetworkACLRulePatch': + """Initialize a NetworkACLRulePatch object from a json dictionary.""" args = {} - if 'active_connections' in _dict: - args['active_connections'] = _dict.get('active_connections') - else: - raise ValueError('Required property \'active_connections\' not present in LoadBalancerStatistics JSON') - if 'connection_rate' in _dict: - args['connection_rate'] = _dict.get('connection_rate') - else: - raise ValueError('Required property \'connection_rate\' not present in LoadBalancerStatistics JSON') - if 'data_processed_this_month' in _dict: - args['data_processed_this_month'] = _dict.get('data_processed_this_month') - else: - raise ValueError('Required property \'data_processed_this_month\' not present in LoadBalancerStatistics JSON') - if 'throughput' in _dict: - args['throughput'] = _dict.get('throughput') - else: - raise ValueError('Required property \'throughput\' not present in LoadBalancerStatistics JSON') + if 'action' in _dict: + args['action'] = _dict.get('action') + if 'before' in _dict: + args['before'] = _dict.get('before') + if 'code' in _dict: + args['code'] = _dict.get('code') + if 'destination' in _dict: + args['destination'] = _dict.get('destination') + if 'destination_port_max' in _dict: + args['destination_port_max'] = _dict.get('destination_port_max') + if 'destination_port_min' in _dict: + args['destination_port_min'] = _dict.get('destination_port_min') + if 'direction' in _dict: + args['direction'] = _dict.get('direction') + if 'name' in _dict: + args['name'] = _dict.get('name') + if 'source' in _dict: + args['source'] = _dict.get('source') + if 'source_port_max' in _dict: + args['source_port_max'] = _dict.get('source_port_max') + if 'source_port_min' in _dict: + args['source_port_min'] = _dict.get('source_port_min') + if 'type' in _dict: + args['type'] = _dict.get('type') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LoadBalancerStatistics object from a json dictionary.""" + """Initialize a NetworkACLRulePatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'active_connections') and self.active_connections is not None: - _dict['active_connections'] = self.active_connections - if hasattr(self, 'connection_rate') and self.connection_rate is not None: - _dict['connection_rate'] = self.connection_rate - if hasattr(self, 'data_processed_this_month') and self.data_processed_this_month is not None: - _dict['data_processed_this_month'] = self.data_processed_this_month - if hasattr(self, 'throughput') and self.throughput is not None: - _dict['throughput'] = self.throughput + if hasattr(self, 'action') and self.action is not None: + _dict['action'] = self.action + if hasattr(self, 'before') and self.before is not None: + if isinstance(self.before, dict): + _dict['before'] = self.before + else: + _dict['before'] = self.before.to_dict() + if hasattr(self, 'code') and self.code is not None: + _dict['code'] = self.code + if hasattr(self, 'destination') and self.destination is not None: + _dict['destination'] = self.destination + if hasattr(self, 'destination_port_max') and self.destination_port_max is not None: + _dict['destination_port_max'] = self.destination_port_max + if hasattr(self, 'destination_port_min') and self.destination_port_min is not None: + _dict['destination_port_min'] = self.destination_port_min + if hasattr(self, 'direction') and self.direction is not None: + _dict['direction'] = self.direction + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'source') and self.source is not None: + _dict['source'] = self.source + if hasattr(self, 'source_port_max') and self.source_port_max is not None: + _dict['source_port_max'] = self.source_port_max + if hasattr(self, 'source_port_min') and self.source_port_min is not None: + _dict['source_port_min'] = self.source_port_min + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type return _dict def _to_dict(self): @@ -43124,300 +47302,301 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LoadBalancerStatistics object.""" + """Return a `str` version of this NetworkACLRulePatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LoadBalancerStatistics') -> bool: + def __eq__(self, other: 'NetworkACLRulePatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'LoadBalancerStatistics') -> bool: + def __ne__(self, other: 'NetworkACLRulePatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class NetworkACL(): - """ - NetworkACL. + class ActionEnum(str, Enum): + """ + Whether to allow or deny matching traffic. + """ + ALLOW = 'allow' + DENY = 'deny' - :attr datetime created_at: The date and time that the network ACL was created. - :attr str crn: The CRN for this network ACL. - :attr str href: The URL for this network ACL. - :attr str id: The unique identifier for this network ACL. - :attr str name: The user-defined name for this network ACL. - :attr ResourceGroupReference resource_group: The resource group for this network - ACL. - :attr List[NetworkACLRuleItem] rules: The ordered rules for this network ACL. If - no rules exist, all traffic will be denied. - :attr List[SubnetReference] subnets: The subnets to which this network ACL is - attached. - :attr VPCReference vpc: The VPC this network ACL is a part of. - """ - def __init__(self, - created_at: datetime, - crn: str, - href: str, - id: str, - name: str, - resource_group: 'ResourceGroupReference', - rules: List['NetworkACLRuleItem'], - subnets: List['SubnetReference'], - vpc: 'VPCReference') -> None: + class DirectionEnum(str, Enum): """ - Initialize a NetworkACL object. - - :param datetime created_at: The date and time that the network ACL was - created. - :param str crn: The CRN for this network ACL. - :param str href: The URL for this network ACL. - :param str id: The unique identifier for this network ACL. - :param str name: The user-defined name for this network ACL. - :param ResourceGroupReference resource_group: The resource group for this - network ACL. - :param List[NetworkACLRuleItem] rules: The ordered rules for this network - ACL. If no rules exist, all traffic will be denied. - :param List[SubnetReference] subnets: The subnets to which this network ACL - is attached. - :param VPCReference vpc: The VPC this network ACL is a part of. + Whether the traffic to be matched is `inbound` or `outbound`. """ - self.created_at = created_at - self.crn = crn - self.href = href - self.id = id - self.name = name - self.resource_group = resource_group - self.rules = rules - self.subnets = subnets - self.vpc = vpc + INBOUND = 'inbound' + OUTBOUND = 'outbound' - @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkACL': - """Initialize a NetworkACL object from a json dictionary.""" - args = {} - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - else: - raise ValueError('Required property \'created_at\' not present in NetworkACL JSON') - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in NetworkACL JSON') - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in NetworkACL JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in NetworkACL JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in NetworkACL JSON') - if 'resource_group' in _dict: - args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) - else: - raise ValueError('Required property \'resource_group\' not present in NetworkACL JSON') - if 'rules' in _dict: - args['rules'] = [NetworkACLRuleItem.from_dict(x) for x in _dict.get('rules')] - else: - raise ValueError('Required property \'rules\' not present in NetworkACL JSON') - if 'subnets' in _dict: - args['subnets'] = [SubnetReference.from_dict(x) for x in _dict.get('subnets')] - else: - raise ValueError('Required property \'subnets\' not present in NetworkACL JSON') - if 'vpc' in _dict: - args['vpc'] = VPCReference.from_dict(_dict.get('vpc')) - else: - raise ValueError('Required property \'vpc\' not present in NetworkACL JSON') - return cls(**args) + +class NetworkACLRulePrototype(): + """ + NetworkACLRulePrototype. + + :attr str action: Whether to allow or deny matching traffic. + :attr NetworkACLRuleBeforePrototype before: (optional) The rule to insert this + rule immediately before. If omitted, this rule will be + inserted after all existing rules. + :attr str destination: The destination IP address or CIDR block. The CIDR block + `0.0.0.0/0` applies to all addresses. + :attr str direction: Whether the traffic to be matched is `inbound` or + `outbound`. + :attr str name: (optional) The user-defined name for this rule. Names must be + unique within the network ACL the rule resides in. If unspecified, the name will + be a hyphenated list of randomly-selected words. + :attr str protocol: The protocol to enforce. + :attr str source: The source IP address or CIDR block. The CIDR block + `0.0.0.0/0` applies to all addresses. + """ + + def __init__(self, + action: str, + destination: str, + direction: str, + protocol: str, + source: str, + *, + before: 'NetworkACLRuleBeforePrototype' = None, + name: str = None) -> None: + """ + Initialize a NetworkACLRulePrototype object. + + :param str action: Whether to allow or deny matching traffic. + :param str destination: The destination IP address or CIDR block. The CIDR + block `0.0.0.0/0` applies to all addresses. + :param str direction: Whether the traffic to be matched is `inbound` or + `outbound`. + :param str protocol: The protocol to enforce. + :param str source: The source IP address or CIDR block. The CIDR block + `0.0.0.0/0` applies to all addresses. + :param NetworkACLRuleBeforePrototype before: (optional) The rule to insert + this rule immediately before. If omitted, this rule will be + inserted after all existing rules. + :param str name: (optional) The user-defined name for this rule. Names must + be unique within the network ACL the rule resides in. If unspecified, the + name will be a hyphenated list of randomly-selected words. + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['NetworkACLRulePrototypeNetworkACLRuleProtocolTCPUDP', 'NetworkACLRulePrototypeNetworkACLRuleProtocolICMP', 'NetworkACLRulePrototypeNetworkACLRuleProtocolAll'])) + raise Exception(msg) @classmethod - def _from_dict(cls, _dict): - """Initialize a NetworkACL object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'NetworkACLRulePrototype': + """Initialize a NetworkACLRulePrototype object from a json dictionary.""" + disc_class = cls._get_class_by_discriminator(_dict) + if disc_class != cls: + return disc_class.from_dict(_dict) + msg = ("Cannot convert dictionary into an instance of base class 'NetworkACLRulePrototype'. " + + "The discriminator value should map to a valid subclass: {1}").format( + ", ".join(['NetworkACLRulePrototypeNetworkACLRuleProtocolTCPUDP', 'NetworkACLRulePrototypeNetworkACLRuleProtocolICMP', 'NetworkACLRulePrototypeNetworkACLRuleProtocolAll'])) + raise Exception(msg) + + @classmethod + def _from_dict(cls, _dict: Dict): + """Initialize a NetworkACLRulePrototype object from a json dictionary.""" return cls.from_dict(_dict) - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'resource_group') and self.resource_group is not None: - _dict['resource_group'] = self.resource_group.to_dict() - if hasattr(self, 'rules') and self.rules is not None: - _dict['rules'] = [x.to_dict() for x in self.rules] - if hasattr(self, 'subnets') and self.subnets is not None: - _dict['subnets'] = [x.to_dict() for x in self.subnets] - if hasattr(self, 'vpc') and self.vpc is not None: - _dict['vpc'] = self.vpc.to_dict() - return _dict + @classmethod + def _get_class_by_discriminator(cls, _dict: Dict) -> object: + mapping = {} + mapping['all'] = 'NetworkACLRulePrototypeNetworkACLRuleProtocolAll' + mapping['icmp'] = 'NetworkACLRulePrototypeNetworkACLRuleProtocolICMP' + mapping['tcp'] = 'NetworkACLRulePrototypeNetworkACLRuleProtocolTCPUDP' + mapping['udp'] = 'NetworkACLRulePrototypeNetworkACLRuleProtocolTCPUDP' + disc_value = _dict.get('protocol') + if disc_value is None: + raise ValueError('Discriminator property \'protocol\' not found in NetworkACLRulePrototype JSON') + class_name = mapping.get(disc_value, disc_value) + try: + disc_class = getattr(sys.modules[__name__], class_name) + except AttributeError: + disc_class = cls + if isinstance(disc_class, object): + return disc_class + raise TypeError('%s is not a discriminator class' % class_name) - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() + class ActionEnum(str, Enum): + """ + Whether to allow or deny matching traffic. + """ + ALLOW = 'allow' + DENY = 'deny' - def __str__(self) -> str: - """Return a `str` version of this NetworkACL object.""" - return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'NetworkACL') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ + class DirectionEnum(str, Enum): + """ + Whether the traffic to be matched is `inbound` or `outbound`. + """ + INBOUND = 'inbound' + OUTBOUND = 'outbound' - def __ne__(self, other: 'NetworkACL') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other -class NetworkACLCollection(): +class NetworkACLRulePrototypeNetworkACLContext(): """ - NetworkACLCollection. + NetworkACLRulePrototypeNetworkACLContext. - :attr NetworkACLCollectionFirst first: A link to the first page of resources. - :attr int limit: The maximum number of resources that can be returned by the - request. - :attr List[NetworkACL] network_acls: Collection of network ACLs. - :attr NetworkACLCollectionNext next: (optional) A link to the next page of - resources. This property is present for all pages - except the last page. - :attr int total_count: The total number of resources across all pages. + :attr str action: Whether to allow or deny matching traffic. + :attr str destination: The destination IP address or CIDR block. The CIDR block + `0.0.0.0/0` applies to all addresses. + :attr str direction: Whether the traffic to be matched is `inbound` or + `outbound`. + :attr str name: (optional) The user-defined name for this rule. Names must be + unique within the network ACL the rule resides in. If unspecified, the name will + be a hyphenated list of randomly-selected words. + :attr str protocol: The protocol to enforce. + :attr str source: The source IP address or CIDR block. The CIDR block + `0.0.0.0/0` applies to all addresses. """ def __init__(self, - first: 'NetworkACLCollectionFirst', - limit: int, - network_acls: List['NetworkACL'], - total_count: int, + action: str, + destination: str, + direction: str, + protocol: str, + source: str, *, - next: 'NetworkACLCollectionNext' = None) -> None: + name: str = None) -> None: """ - Initialize a NetworkACLCollection object. + Initialize a NetworkACLRulePrototypeNetworkACLContext object. - :param NetworkACLCollectionFirst first: A link to the first page of - resources. - :param int limit: The maximum number of resources that can be returned by - the request. - :param List[NetworkACL] network_acls: Collection of network ACLs. - :param int total_count: The total number of resources across all pages. - :param NetworkACLCollectionNext next: (optional) A link to the next page of - resources. This property is present for all pages - except the last page. + :param str action: Whether to allow or deny matching traffic. + :param str destination: The destination IP address or CIDR block. The CIDR + block `0.0.0.0/0` applies to all addresses. + :param str direction: Whether the traffic to be matched is `inbound` or + `outbound`. + :param str protocol: The protocol to enforce. + :param str source: The source IP address or CIDR block. The CIDR block + `0.0.0.0/0` applies to all addresses. + :param str name: (optional) The user-defined name for this rule. Names must + be unique within the network ACL the rule resides in. If unspecified, the + name will be a hyphenated list of randomly-selected words. """ - self.first = first - self.limit = limit - self.network_acls = network_acls - self.next = next - self.total_count = total_count + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTCPUDP', 'NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolICMP', 'NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAll'])) + raise Exception(msg) @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkACLCollection': - """Initialize a NetworkACLCollection object from a json dictionary.""" - args = {} - if 'first' in _dict: - args['first'] = NetworkACLCollectionFirst.from_dict(_dict.get('first')) - else: - raise ValueError('Required property \'first\' not present in NetworkACLCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') - else: - raise ValueError('Required property \'limit\' not present in NetworkACLCollection JSON') - if 'network_acls' in _dict: - args['network_acls'] = [NetworkACL.from_dict(x) for x in _dict.get('network_acls')] - else: - raise ValueError('Required property \'network_acls\' not present in NetworkACLCollection JSON') - if 'next' in _dict: - args['next'] = NetworkACLCollectionNext.from_dict(_dict.get('next')) - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') - else: - raise ValueError('Required property \'total_count\' not present in NetworkACLCollection JSON') - return cls(**args) + def from_dict(cls, _dict: Dict) -> 'NetworkACLRulePrototypeNetworkACLContext': + """Initialize a NetworkACLRulePrototypeNetworkACLContext object from a json dictionary.""" + disc_class = cls._get_class_by_discriminator(_dict) + if disc_class != cls: + return disc_class.from_dict(_dict) + msg = ("Cannot convert dictionary into an instance of base class 'NetworkACLRulePrototypeNetworkACLContext'. " + + "The discriminator value should map to a valid subclass: {1}").format( + ", ".join(['NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTCPUDP', 'NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolICMP', 'NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAll'])) + raise Exception(msg) @classmethod - def _from_dict(cls, _dict): - """Initialize a NetworkACLCollection object from a json dictionary.""" + def _from_dict(cls, _dict: Dict): + """Initialize a NetworkACLRulePrototypeNetworkACLContext object from a json dictionary.""" return cls.from_dict(_dict) - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'network_acls') and self.network_acls is not None: - _dict['network_acls'] = [x.to_dict() for x in self.network_acls] - if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count - return _dict + @classmethod + def _get_class_by_discriminator(cls, _dict: Dict) -> object: + mapping = {} + mapping['all'] = 'NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAll' + mapping['icmp'] = 'NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolICMP' + mapping['tcp'] = 'NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTCPUDP' + mapping['udp'] = 'NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTCPUDP' + disc_value = _dict.get('protocol') + if disc_value is None: + raise ValueError('Discriminator property \'protocol\' not found in NetworkACLRulePrototypeNetworkACLContext JSON') + class_name = mapping.get(disc_value, disc_value) + try: + disc_class = getattr(sys.modules[__name__], class_name) + except AttributeError: + disc_class = cls + if isinstance(disc_class, object): + return disc_class + raise TypeError('%s is not a discriminator class' % class_name) - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() + class ActionEnum(str, Enum): + """ + Whether to allow or deny matching traffic. + """ + ALLOW = 'allow' + DENY = 'deny' - def __str__(self) -> str: - """Return a `str` version of this NetworkACLCollection object.""" - return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'NetworkACLCollection') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ + class DirectionEnum(str, Enum): + """ + Whether the traffic to be matched is `inbound` or `outbound`. + """ + INBOUND = 'inbound' + OUTBOUND = 'outbound' - def __ne__(self, other: 'NetworkACLCollection') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other -class NetworkACLCollectionFirst(): +class NetworkACLRuleReference(): """ - A link to the first page of resources. + NetworkACLRuleReference. - :attr str href: The URL for a page of resources. + :attr NetworkACLRuleReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str href: The URL for this network ACL rule. + :attr str id: The unique identifier for this network ACL rule. + :attr str name: The user-defined name for this network ACL rule. """ def __init__(self, - href: str) -> None: + href: str, + id: str, + name: str, + *, + deleted: 'NetworkACLRuleReferenceDeleted' = None) -> None: """ - Initialize a NetworkACLCollectionFirst object. + Initialize a NetworkACLRuleReference object. - :param str href: The URL for a page of resources. + :param str href: The URL for this network ACL rule. + :param str id: The unique identifier for this network ACL rule. + :param str name: The user-defined name for this network ACL rule. + :param NetworkACLRuleReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides + some supplementary information. """ + self.deleted = deleted self.href = href + self.id = id + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkACLCollectionFirst': - """Initialize a NetworkACLCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'NetworkACLRuleReference': + """Initialize a NetworkACLRuleReference object from a json dictionary.""" args = {} + if 'deleted' in _dict: + args['deleted'] = NetworkACLRuleReferenceDeleted.from_dict(_dict.get('deleted')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in NetworkACLCollectionFirst JSON') + raise ValueError('Required property \'href\' not present in NetworkACLRuleReference JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in NetworkACLRuleReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in NetworkACLRuleReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a NetworkACLCollectionFirst object from a json dictionary.""" + """Initialize a NetworkACLRuleReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -43425,56 +47604,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this NetworkACLCollectionFirst object.""" + """Return a `str` version of this NetworkACLRuleReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'NetworkACLCollectionFirst') -> bool: + def __eq__(self, other: 'NetworkACLRuleReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'NetworkACLCollectionFirst') -> bool: + def __ne__(self, other: 'NetworkACLRuleReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class NetworkACLCollectionNext(): +class NetworkACLRuleReferenceDeleted(): """ - A link to the next page of resources. This property is present for all pages except - the last page. + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. - :attr str href: The URL for a page of resources. + :attr str more_info: Link to documentation about deleted resources. """ def __init__(self, - href: str) -> None: + more_info: str) -> None: """ - Initialize a NetworkACLCollectionNext object. + Initialize a NetworkACLRuleReferenceDeleted object. - :param str href: The URL for a page of resources. + :param str more_info: Link to documentation about deleted resources. """ - self.href = href + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkACLCollectionNext': - """Initialize a NetworkACLCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'NetworkACLRuleReferenceDeleted': + """Initialize a NetworkACLRuleReferenceDeleted object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'href\' not present in NetworkACLCollectionNext JSON') + raise ValueError('Required property \'more_info\' not present in NetworkACLRuleReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a NetworkACLCollectionNext object from a json dictionary.""" + """Initialize a NetworkACLRuleReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -43482,71 +47661,185 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this NetworkACLCollectionNext object.""" + """Return a `str` version of this NetworkACLRuleReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'NetworkACLCollectionNext') -> bool: + def __eq__(self, other: 'NetworkACLRuleReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'NetworkACLCollectionNext') -> bool: + def __ne__(self, other: 'NetworkACLRuleReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class NetworkACLIdentity(): - """ - Identifies a network ACL by a unique property. - - """ - - def __init__(self) -> None: - """ - Initialize a NetworkACLIdentity object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['NetworkACLIdentityById', 'NetworkACLIdentityByCRN', 'NetworkACLIdentityByHref'])) - raise Exception(msg) - -class NetworkACLPatch(): +class NetworkInterface(): """ - NetworkACLPatch. + NetworkInterface. - :attr str name: (optional) The user-defined name for this network ACL. Names - must be unique within the VPC the network ACL resides in. + :attr bool allow_ip_spoofing: Indicates whether source IP spoofing is allowed on + this interface. If false, source IP spoofing is prevented on this interface. If + true, source IP spoofing is allowed on this interface. + :attr datetime created_at: The date and time that the network interface was + created. + :attr List[FloatingIPReference] floating_ips: (optional) The floating IPs + associated with this network interface. + :attr str href: The URL for this network interface. + :attr str id: The unique identifier for this network interface. + :attr str name: The user-defined name for this network interface. + :attr int port_speed: The network interface port speed in Mbps. + :attr ReservedIPReference primary_ip: + :attr str resource_type: The resource type. + :attr List[SecurityGroupReference] security_groups: The security groups + targeting this network interface. + :attr str status: The status of the network interface. + :attr SubnetReference subnet: The associated subnet. + :attr str type: The type of this network interface as it relates to an instance. """ def __init__(self, + allow_ip_spoofing: bool, + created_at: datetime, + href: str, + id: str, + name: str, + port_speed: int, + primary_ip: 'ReservedIPReference', + resource_type: str, + security_groups: List['SecurityGroupReference'], + status: str, + subnet: 'SubnetReference', + type: str, *, - name: str = None) -> None: + floating_ips: List['FloatingIPReference'] = None) -> None: """ - Initialize a NetworkACLPatch object. + Initialize a NetworkInterface object. - :param str name: (optional) The user-defined name for this network ACL. - Names must be unique within the VPC the network ACL resides in. + :param bool allow_ip_spoofing: Indicates whether source IP spoofing is + allowed on this interface. If false, source IP spoofing is prevented on + this interface. If true, source IP spoofing is allowed on this interface. + :param datetime created_at: The date and time that the network interface + was created. + :param str href: The URL for this network interface. + :param str id: The unique identifier for this network interface. + :param str name: The user-defined name for this network interface. + :param int port_speed: The network interface port speed in Mbps. + :param ReservedIPReference primary_ip: + :param str resource_type: The resource type. + :param List[SecurityGroupReference] security_groups: The security groups + targeting this network interface. + :param str status: The status of the network interface. + :param SubnetReference subnet: The associated subnet. + :param str type: The type of this network interface as it relates to an + instance. + :param List[FloatingIPReference] floating_ips: (optional) The floating IPs + associated with this network interface. """ + self.allow_ip_spoofing = allow_ip_spoofing + self.created_at = created_at + self.floating_ips = floating_ips + self.href = href + self.id = id self.name = name + self.port_speed = port_speed + self.primary_ip = primary_ip + self.resource_type = resource_type + self.security_groups = security_groups + self.status = status + self.subnet = subnet + self.type = type @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkACLPatch': - """Initialize a NetworkACLPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'NetworkInterface': + """Initialize a NetworkInterface object from a json dictionary.""" args = {} + if 'allow_ip_spoofing' in _dict: + args['allow_ip_spoofing'] = _dict.get('allow_ip_spoofing') + else: + raise ValueError('Required property \'allow_ip_spoofing\' not present in NetworkInterface JSON') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) + else: + raise ValueError('Required property \'created_at\' not present in NetworkInterface JSON') + if 'floating_ips' in _dict: + args['floating_ips'] = [FloatingIPReference.from_dict(x) for x in _dict.get('floating_ips')] + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in NetworkInterface JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in NetworkInterface JSON') if 'name' in _dict: args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in NetworkInterface JSON') + if 'port_speed' in _dict: + args['port_speed'] = _dict.get('port_speed') + else: + raise ValueError('Required property \'port_speed\' not present in NetworkInterface JSON') + if 'primary_ip' in _dict: + args['primary_ip'] = ReservedIPReference.from_dict(_dict.get('primary_ip')) + else: + raise ValueError('Required property \'primary_ip\' not present in NetworkInterface JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in NetworkInterface JSON') + if 'security_groups' in _dict: + args['security_groups'] = [SecurityGroupReference.from_dict(x) for x in _dict.get('security_groups')] + else: + raise ValueError('Required property \'security_groups\' not present in NetworkInterface JSON') + if 'status' in _dict: + args['status'] = _dict.get('status') + else: + raise ValueError('Required property \'status\' not present in NetworkInterface JSON') + if 'subnet' in _dict: + args['subnet'] = SubnetReference.from_dict(_dict.get('subnet')) + else: + raise ValueError('Required property \'subnet\' not present in NetworkInterface JSON') + if 'type' in _dict: + args['type'] = _dict.get('type') + else: + raise ValueError('Required property \'type\' not present in NetworkInterface JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a NetworkACLPatch object from a json dictionary.""" + """Initialize a NetworkInterface object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'allow_ip_spoofing') and self.allow_ip_spoofing is not None: + _dict['allow_ip_spoofing'] = self.allow_ip_spoofing + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'floating_ips') and self.floating_ips is not None: + _dict['floating_ips'] = [x.to_dict() for x in self.floating_ips] + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name + if hasattr(self, 'port_speed') and self.port_speed is not None: + _dict['port_speed'] = self.port_speed + if hasattr(self, 'primary_ip') and self.primary_ip is not None: + _dict['primary_ip'] = self.primary_ip.to_dict() + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + if hasattr(self, 'security_groups') and self.security_groups is not None: + _dict['security_groups'] = [x.to_dict() for x in self.security_groups] + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'subnet') and self.subnet is not None: + _dict['subnet'] = self.subnet.to_dict() + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type return _dict def _to_dict(self): @@ -43554,124 +47847,131 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this NetworkACLPatch object.""" + """Return a `str` version of this NetworkInterface object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'NetworkACLPatch') -> bool: + def __eq__(self, other: 'NetworkInterface') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'NetworkACLPatch') -> bool: + def __ne__(self, other: 'NetworkInterface') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class NetworkACLPrototype(): - """ - NetworkACLPrototype. + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + NETWORK_INTERFACE = 'network_interface' - :attr str name: (optional) The user-defined name for this network ACL. Names - must be unique within the VPC the network ACL resides in. If unspecified, the - name will be a hyphenated list of randomly-selected words. - :attr ResourceGroupIdentity resource_group: (optional) The resource group to - use. If unspecified, the account's [default resource - group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - :attr VPCIdentity vpc: The VPC this network ACL is to be a part of. - """ - def __init__(self, - vpc: 'VPCIdentity', - *, - name: str = None, - resource_group: 'ResourceGroupIdentity' = None) -> None: + class StatusEnum(str, Enum): """ - Initialize a NetworkACLPrototype object. + The status of the network interface. + """ + AVAILABLE = 'available' + DELETING = 'deleting' + FAILED = 'failed' + PENDING = 'pending' - :param VPCIdentity vpc: The VPC this network ACL is to be a part of. - :param str name: (optional) The user-defined name for this network ACL. - Names must be unique within the VPC the network ACL resides in. If - unspecified, the name will be a hyphenated list of randomly-selected words. - :param ResourceGroupIdentity resource_group: (optional) The resource group - to use. If unspecified, the account's [default resource - group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is - used. + + class TypeEnum(str, Enum): """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['NetworkACLPrototypeNetworkACLByRules', 'NetworkACLPrototypeNetworkACLBySourceNetworkACL'])) - raise Exception(msg) + The type of this network interface as it relates to an instance. + """ + PRIMARY = 'primary' + SECONDARY = 'secondary' -class NetworkACLReference(): + +class NetworkInterfaceBareMetalServerContextReference(): """ - NetworkACLReference. + NetworkInterfaceBareMetalServerContextReference. - :attr str crn: The CRN for this network ACL. - :attr NetworkACLReferenceDeleted deleted: (optional) If present, this property - indicates the referenced resource has been deleted and provides + :attr NetworkInterfaceBareMetalServerContextReferenceDeleted deleted: (optional) + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. - :attr str href: The URL for this network ACL. - :attr str id: The unique identifier for this network ACL. - :attr str name: The user-defined name for this network ACL. + :attr str href: The URL for this network interface. + :attr str id: The unique identifier for this network interface. + :attr str name: The user-defined name for this network interface. + :attr ReservedIPReference primary_ip: + :attr str resource_type: The resource type. + :attr SubnetReference subnet: The associated subnet. """ def __init__(self, - crn: str, href: str, id: str, name: str, + primary_ip: 'ReservedIPReference', + resource_type: str, + subnet: 'SubnetReference', *, - deleted: 'NetworkACLReferenceDeleted' = None) -> None: + deleted: 'NetworkInterfaceBareMetalServerContextReferenceDeleted' = None) -> None: """ - Initialize a NetworkACLReference object. + Initialize a NetworkInterfaceBareMetalServerContextReference object. - :param str crn: The CRN for this network ACL. - :param str href: The URL for this network ACL. - :param str id: The unique identifier for this network ACL. - :param str name: The user-defined name for this network ACL. - :param NetworkACLReferenceDeleted deleted: (optional) If present, this - property indicates the referenced resource has been deleted and provides + :param str href: The URL for this network interface. + :param str id: The unique identifier for this network interface. + :param str name: The user-defined name for this network interface. + :param ReservedIPReference primary_ip: + :param str resource_type: The resource type. + :param SubnetReference subnet: The associated subnet. + :param NetworkInterfaceBareMetalServerContextReferenceDeleted deleted: + (optional) If present, this property indicates the referenced resource has + been deleted and provides some supplementary information. """ - self.crn = crn self.deleted = deleted self.href = href self.id = id self.name = name + self.primary_ip = primary_ip + self.resource_type = resource_type + self.subnet = subnet @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkACLReference': - """Initialize a NetworkACLReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'NetworkInterfaceBareMetalServerContextReference': + """Initialize a NetworkInterfaceBareMetalServerContextReference object from a json dictionary.""" args = {} - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in NetworkACLReference JSON') if 'deleted' in _dict: - args['deleted'] = NetworkACLReferenceDeleted.from_dict(_dict.get('deleted')) + args['deleted'] = NetworkInterfaceBareMetalServerContextReferenceDeleted.from_dict(_dict.get('deleted')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in NetworkACLReference JSON') + raise ValueError('Required property \'href\' not present in NetworkInterfaceBareMetalServerContextReference JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in NetworkACLReference JSON') + raise ValueError('Required property \'id\' not present in NetworkInterfaceBareMetalServerContextReference JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in NetworkACLReference JSON') + raise ValueError('Required property \'name\' not present in NetworkInterfaceBareMetalServerContextReference JSON') + if 'primary_ip' in _dict: + args['primary_ip'] = ReservedIPReference.from_dict(_dict.get('primary_ip')) + else: + raise ValueError('Required property \'primary_ip\' not present in NetworkInterfaceBareMetalServerContextReference JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in NetworkInterfaceBareMetalServerContextReference JSON') + if 'subnet' in _dict: + args['subnet'] = SubnetReference.from_dict(_dict.get('subnet')) + else: + raise ValueError('Required property \'subnet\' not present in NetworkInterfaceBareMetalServerContextReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a NetworkACLReference object from a json dictionary.""" + """Initialize a NetworkInterfaceBareMetalServerContextReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn if hasattr(self, 'deleted') and self.deleted is not None: _dict['deleted'] = self.deleted.to_dict() if hasattr(self, 'href') and self.href is not None: @@ -43680,6 +47980,12 @@ def to_dict(self) -> Dict: _dict['id'] = self.id if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name + if hasattr(self, 'primary_ip') and self.primary_ip is not None: + _dict['primary_ip'] = self.primary_ip.to_dict() + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + if hasattr(self, 'subnet') and self.subnet is not None: + _dict['subnet'] = self.subnet.to_dict() return _dict def _to_dict(self): @@ -43687,20 +47993,27 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this NetworkACLReference object.""" + """Return a `str` version of this NetworkInterfaceBareMetalServerContextReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'NetworkACLReference') -> bool: + def __eq__(self, other: 'NetworkInterfaceBareMetalServerContextReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'NetworkACLReference') -> bool: + def __ne__(self, other: 'NetworkInterfaceBareMetalServerContextReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class NetworkACLReferenceDeleted(): + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + NETWORK_INTERFACE = 'network_interface' + + +class NetworkInterfaceBareMetalServerContextReferenceDeleted(): """ If present, this property indicates the referenced resource has been deleted and provides some supplementary information. @@ -43711,25 +48024,25 @@ class NetworkACLReferenceDeleted(): def __init__(self, more_info: str) -> None: """ - Initialize a NetworkACLReferenceDeleted object. + Initialize a NetworkInterfaceBareMetalServerContextReferenceDeleted object. :param str more_info: Link to documentation about deleted resources. """ self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkACLReferenceDeleted': - """Initialize a NetworkACLReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'NetworkInterfaceBareMetalServerContextReferenceDeleted': + """Initialize a NetworkInterfaceBareMetalServerContextReferenceDeleted object from a json dictionary.""" args = {} if 'more_info' in _dict: args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'more_info\' not present in NetworkACLReferenceDeleted JSON') + raise ValueError('Required property \'more_info\' not present in NetworkInterfaceBareMetalServerContextReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a NetworkACLReferenceDeleted object from a json dictionary.""" + """Initialize a NetworkInterfaceBareMetalServerContextReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -43744,255 +48057,135 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this NetworkACLReferenceDeleted object.""" + """Return a `str` version of this NetworkInterfaceBareMetalServerContextReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'NetworkACLReferenceDeleted') -> bool: + def __eq__(self, other: 'NetworkInterfaceBareMetalServerContextReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'NetworkACLReferenceDeleted') -> bool: + def __ne__(self, other: 'NetworkInterfaceBareMetalServerContextReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class NetworkACLRule(): - """ - NetworkACLRule. - - :attr str action: Whether to allow or deny matching traffic. - :attr NetworkACLRuleReference before: (optional) The rule that this rule is - immediately before. If absent, this is the last rule. - :attr datetime created_at: The date and time that the rule was created. - :attr str destination: The destination CIDR block. The CIDR block `0.0.0.0/0` - applies to all addresses. - :attr str direction: Whether the traffic to be matched is `inbound` or - `outbound`. - :attr str href: The URL for this network ACL rule. - :attr str id: The unique identifier for this network ACL rule. - :attr str ip_version: The IP version for this rule. - :attr str name: The user-defined name for this rule. Names must be unique within - the network ACL the rule resides in. If unspecified, the name will be a - hyphenated list of randomly-selected words. - :attr str protocol: The protocol to enforce. - :attr str source: The source CIDR block. The CIDR block `0.0.0.0/0` applies to - all addresses. - """ - - def __init__(self, - action: str, - created_at: datetime, - destination: str, - direction: str, - href: str, - id: str, - ip_version: str, - name: str, - protocol: str, - source: str, - *, - before: 'NetworkACLRuleReference' = None) -> None: - """ - Initialize a NetworkACLRule object. - - :param str action: Whether to allow or deny matching traffic. - :param datetime created_at: The date and time that the rule was created. - :param str destination: The destination CIDR block. The CIDR block - `0.0.0.0/0` applies to all addresses. - :param str direction: Whether the traffic to be matched is `inbound` or - `outbound`. - :param str href: The URL for this network ACL rule. - :param str id: The unique identifier for this network ACL rule. - :param str ip_version: The IP version for this rule. - :param str name: The user-defined name for this rule. Names must be unique - within the network ACL the rule resides in. If unspecified, the name will - be a hyphenated list of randomly-selected words. - :param str protocol: The protocol to enforce. - :param str source: The source CIDR block. The CIDR block `0.0.0.0/0` - applies to all addresses. - :param NetworkACLRuleReference before: (optional) The rule that this rule - is immediately before. If absent, this is the last rule. - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['NetworkACLRuleNetworkACLRuleProtocolTCPUDP', 'NetworkACLRuleNetworkACLRuleProtocolICMP', 'NetworkACLRuleNetworkACLRuleProtocolAll'])) - raise Exception(msg) - - @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkACLRule': - """Initialize a NetworkACLRule object from a json dictionary.""" - disc_class = cls._get_class_by_discriminator(_dict) - if disc_class != cls: - return disc_class.from_dict(_dict) - msg = ("Cannot convert dictionary into an instance of base class 'NetworkACLRule'. " + - "The discriminator value should map to a valid subclass: {1}").format( - ", ".join(['NetworkACLRuleNetworkACLRuleProtocolTCPUDP', 'NetworkACLRuleNetworkACLRuleProtocolICMP', 'NetworkACLRuleNetworkACLRuleProtocolAll'])) - raise Exception(msg) - - @classmethod - def _from_dict(cls, _dict: Dict): - """Initialize a NetworkACLRule object from a json dictionary.""" - return cls.from_dict(_dict) - - @classmethod - def _get_class_by_discriminator(cls, _dict: Dict) -> object: - mapping = {} - mapping['all'] = 'NetworkACLRuleNetworkACLRuleProtocolAll' - mapping['icmp'] = 'NetworkACLRuleNetworkACLRuleProtocolICMP' - mapping['tcp'] = 'NetworkACLRuleNetworkACLRuleProtocolTCPUDP' - mapping['udp'] = 'NetworkACLRuleNetworkACLRuleProtocolTCPUDP' - disc_value = _dict.get('protocol') - if disc_value is None: - raise ValueError('Discriminator property \'protocol\' not found in NetworkACLRule JSON') - class_name = mapping.get(disc_value, disc_value) - try: - disc_class = getattr(sys.modules[__name__], class_name) - except AttributeError: - disc_class = cls - if isinstance(disc_class, object): - return disc_class - raise TypeError('%s is not a discriminator class' % class_name) - - class ActionEnum(str, Enum): - """ - Whether to allow or deny matching traffic. - """ - ALLOW = 'allow' - DENY = 'deny' - - - class DirectionEnum(str, Enum): - """ - Whether the traffic to be matched is `inbound` or `outbound`. - """ - INBOUND = 'inbound' - OUTBOUND = 'outbound' - - - class IpVersionEnum(str, Enum): - """ - The IP version for this rule. - """ - IPV4 = 'ipv4' - IPV6 = 'ipv6' - - -class NetworkACLRuleBeforePatch(): - """ - The rule to move this rule immediately before. Specify `null` to move this rule after - all existing rules. - - """ - - def __init__(self) -> None: - """ - Initialize a NetworkACLRuleBeforePatch object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['NetworkACLRuleBeforePatchNetworkACLRuleIdentityById', 'NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref'])) - raise Exception(msg) - -class NetworkACLRuleBeforePrototype(): +class NetworkInterfaceIPPrototype(): """ - The rule to insert this rule immediately before. If omitted, this rule will be - inserted after all existing rules. + NetworkInterfaceIPPrototype. """ def __init__(self) -> None: """ - Initialize a NetworkACLRuleBeforePrototype object. + Initialize a NetworkInterfaceIPPrototype object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityById', 'NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref'])) + ", ".join(['NetworkInterfaceIPPrototypeReservedIPIdentity', 'NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext'])) raise Exception(msg) -class NetworkACLRuleCollection(): +class NetworkInterfaceInstanceContextReference(): """ - NetworkACLRuleCollection. + NetworkInterfaceInstanceContextReference. - :attr NetworkACLRuleCollectionFirst first: A link to the first page of - resources. - :attr int limit: The maximum number of resources that can be returned by the - request. - :attr NetworkACLRuleCollectionNext next: (optional) A link to the next page of - resources. This property is present for all pages - except the last page. - :attr List[NetworkACLRuleItem] rules: Ordered collection of network ACL rules. - :attr int total_count: The total number of resources across all pages. + :attr NetworkInterfaceInstanceContextReferenceDeleted deleted: (optional) If + present, this property indicates the referenced resource has been deleted and + provides + some supplementary information. + :attr str href: The URL for this network interface. + :attr str id: The unique identifier for this network interface. + :attr str name: The user-defined name for this network interface. + :attr ReservedIPReference primary_ip: + :attr str resource_type: The resource type. + :attr SubnetReference subnet: The associated subnet. """ def __init__(self, - first: 'NetworkACLRuleCollectionFirst', - limit: int, - rules: List['NetworkACLRuleItem'], - total_count: int, + href: str, + id: str, + name: str, + primary_ip: 'ReservedIPReference', + resource_type: str, + subnet: 'SubnetReference', *, - next: 'NetworkACLRuleCollectionNext' = None) -> None: + deleted: 'NetworkInterfaceInstanceContextReferenceDeleted' = None) -> None: """ - Initialize a NetworkACLRuleCollection object. + Initialize a NetworkInterfaceInstanceContextReference object. - :param NetworkACLRuleCollectionFirst first: A link to the first page of - resources. - :param int limit: The maximum number of resources that can be returned by - the request. - :param List[NetworkACLRuleItem] rules: Ordered collection of network ACL - rules. - :param int total_count: The total number of resources across all pages. - :param NetworkACLRuleCollectionNext next: (optional) A link to the next - page of resources. This property is present for all pages - except the last page. + :param str href: The URL for this network interface. + :param str id: The unique identifier for this network interface. + :param str name: The user-defined name for this network interface. + :param ReservedIPReference primary_ip: + :param str resource_type: The resource type. + :param SubnetReference subnet: The associated subnet. + :param NetworkInterfaceInstanceContextReferenceDeleted deleted: (optional) + If present, this property indicates the referenced resource has been + deleted and provides + some supplementary information. """ - self.first = first - self.limit = limit - self.next = next - self.rules = rules - self.total_count = total_count + self.deleted = deleted + self.href = href + self.id = id + self.name = name + self.primary_ip = primary_ip + self.resource_type = resource_type + self.subnet = subnet @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkACLRuleCollection': - """Initialize a NetworkACLRuleCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'NetworkInterfaceInstanceContextReference': + """Initialize a NetworkInterfaceInstanceContextReference object from a json dictionary.""" args = {} - if 'first' in _dict: - args['first'] = NetworkACLRuleCollectionFirst.from_dict(_dict.get('first')) + if 'deleted' in _dict: + args['deleted'] = NetworkInterfaceInstanceContextReferenceDeleted.from_dict(_dict.get('deleted')) + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'first\' not present in NetworkACLRuleCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') + raise ValueError('Required property \'href\' not present in NetworkInterfaceInstanceContextReference JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') else: - raise ValueError('Required property \'limit\' not present in NetworkACLRuleCollection JSON') - if 'next' in _dict: - args['next'] = NetworkACLRuleCollectionNext.from_dict(_dict.get('next')) - if 'rules' in _dict: - args['rules'] = [NetworkACLRuleItem.from_dict(x) for x in _dict.get('rules')] + raise ValueError('Required property \'id\' not present in NetworkInterfaceInstanceContextReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') else: - raise ValueError('Required property \'rules\' not present in NetworkACLRuleCollection JSON') - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') + raise ValueError('Required property \'name\' not present in NetworkInterfaceInstanceContextReference JSON') + if 'primary_ip' in _dict: + args['primary_ip'] = ReservedIPReference.from_dict(_dict.get('primary_ip')) else: - raise ValueError('Required property \'total_count\' not present in NetworkACLRuleCollection JSON') + raise ValueError('Required property \'primary_ip\' not present in NetworkInterfaceInstanceContextReference JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in NetworkInterfaceInstanceContextReference JSON') + if 'subnet' in _dict: + args['subnet'] = SubnetReference.from_dict(_dict.get('subnet')) + else: + raise ValueError('Required property \'subnet\' not present in NetworkInterfaceInstanceContextReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a NetworkACLRuleCollection object from a json dictionary.""" + """Initialize a NetworkInterfaceInstanceContextReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'rules') and self.rules is not None: - _dict['rules'] = [x.to_dict() for x in self.rules] - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'primary_ip') and self.primary_ip is not None: + _dict['primary_ip'] = self.primary_ip.to_dict() + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + if hasattr(self, 'subnet') and self.subnet is not None: + _dict['subnet'] = self.subnet.to_dict() return _dict def _to_dict(self): @@ -44000,55 +48193,63 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this NetworkACLRuleCollection object.""" + """Return a `str` version of this NetworkInterfaceInstanceContextReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'NetworkACLRuleCollection') -> bool: + def __eq__(self, other: 'NetworkInterfaceInstanceContextReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'NetworkACLRuleCollection') -> bool: + def __ne__(self, other: 'NetworkInterfaceInstanceContextReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class NetworkACLRuleCollectionFirst(): + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + NETWORK_INTERFACE = 'network_interface' + + +class NetworkInterfaceInstanceContextReferenceDeleted(): """ - A link to the first page of resources. + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. - :attr str href: The URL for a page of resources. + :attr str more_info: Link to documentation about deleted resources. """ def __init__(self, - href: str) -> None: + more_info: str) -> None: """ - Initialize a NetworkACLRuleCollectionFirst object. + Initialize a NetworkInterfaceInstanceContextReferenceDeleted object. - :param str href: The URL for a page of resources. + :param str more_info: Link to documentation about deleted resources. """ - self.href = href + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkACLRuleCollectionFirst': - """Initialize a NetworkACLRuleCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'NetworkInterfaceInstanceContextReferenceDeleted': + """Initialize a NetworkInterfaceInstanceContextReferenceDeleted object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'href\' not present in NetworkACLRuleCollectionFirst JSON') + raise ValueError('Required property \'more_info\' not present in NetworkInterfaceInstanceContextReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a NetworkACLRuleCollectionFirst object from a json dictionary.""" + """Initialize a NetworkInterfaceInstanceContextReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -44056,56 +48257,69 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this NetworkACLRuleCollectionFirst object.""" + """Return a `str` version of this NetworkInterfaceInstanceContextReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'NetworkACLRuleCollectionFirst') -> bool: + def __eq__(self, other: 'NetworkInterfaceInstanceContextReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'NetworkACLRuleCollectionFirst') -> bool: + def __ne__(self, other: 'NetworkInterfaceInstanceContextReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class NetworkACLRuleCollectionNext(): +class NetworkInterfacePatch(): """ - A link to the next page of resources. This property is present for all pages except - the last page. + NetworkInterfacePatch. - :attr str href: The URL for a page of resources. + :attr bool allow_ip_spoofing: (optional) Indicates whether source IP spoofing is + allowed on this interface. If false, source IP spoofing is prevented on this + interface. If true, source IP spoofing is allowed on this interface. + :attr str name: (optional) The user-defined name for network interface. Names + must be unique within the instance the network interface resides in. """ def __init__(self, - href: str) -> None: + *, + allow_ip_spoofing: bool = None, + name: str = None) -> None: """ - Initialize a NetworkACLRuleCollectionNext object. + Initialize a NetworkInterfacePatch object. - :param str href: The URL for a page of resources. + :param bool allow_ip_spoofing: (optional) Indicates whether source IP + spoofing is allowed on this interface. If false, source IP spoofing is + prevented on this interface. If true, source IP spoofing is allowed on this + interface. + :param str name: (optional) The user-defined name for network interface. + Names must be unique within the instance the network interface resides in. """ - self.href = href + self.allow_ip_spoofing = allow_ip_spoofing + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkACLRuleCollectionNext': - """Initialize a NetworkACLRuleCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'NetworkInterfacePatch': + """Initialize a NetworkInterfacePatch object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in NetworkACLRuleCollectionNext JSON') + if 'allow_ip_spoofing' in _dict: + args['allow_ip_spoofing'] = _dict.get('allow_ip_spoofing') + if 'name' in _dict: + args['name'] = _dict.get('name') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a NetworkACLRuleCollectionNext object from a json dictionary.""" + """Initialize a NetworkInterfacePatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'allow_ip_spoofing') and self.allow_ip_spoofing is not None: + _dict['allow_ip_spoofing'] = self.allow_ip_spoofing + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -44113,288 +48327,128 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this NetworkACLRuleCollectionNext object.""" + """Return a `str` version of this NetworkInterfacePatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'NetworkACLRuleCollectionNext') -> bool: + def __eq__(self, other: 'NetworkInterfacePatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'NetworkACLRuleCollectionNext') -> bool: + def __ne__(self, other: 'NetworkInterfacePatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class NetworkACLRuleItem(): - """ - NetworkACLRuleItem. - - :attr str action: Whether to allow or deny matching traffic. - :attr NetworkACLRuleReference before: (optional) The rule that this rule is - immediately before. In a rule collection, this always - refers to the next item in the collection. If absent, this is the last rule. - :attr datetime created_at: The date and time that the rule was created. - :attr str destination: The destination CIDR block. The CIDR block `0.0.0.0/0` - applies to all addresses. - :attr str direction: Whether the traffic to be matched is `inbound` or - `outbound`. - :attr str href: The URL for this network ACL rule. - :attr str id: The unique identifier for this network ACL rule. - :attr str ip_version: The IP version for this rule. - :attr str name: The user-defined name for this rule. Names must be unique within - the network ACL the rule resides in. If unspecified, the name will be a - hyphenated list of randomly-selected words. - :attr str protocol: The protocol to enforce. - :attr str source: The source CIDR block. The CIDR block `0.0.0.0/0` applies to - all addresses. - """ - - def __init__(self, - action: str, - created_at: datetime, - destination: str, - direction: str, - href: str, - id: str, - ip_version: str, - name: str, - protocol: str, - source: str, - *, - before: 'NetworkACLRuleReference' = None) -> None: - """ - Initialize a NetworkACLRuleItem object. - - :param str action: Whether to allow or deny matching traffic. - :param datetime created_at: The date and time that the rule was created. - :param str destination: The destination CIDR block. The CIDR block - `0.0.0.0/0` applies to all addresses. - :param str direction: Whether the traffic to be matched is `inbound` or - `outbound`. - :param str href: The URL for this network ACL rule. - :param str id: The unique identifier for this network ACL rule. - :param str ip_version: The IP version for this rule. - :param str name: The user-defined name for this rule. Names must be unique - within the network ACL the rule resides in. If unspecified, the name will - be a hyphenated list of randomly-selected words. - :param str protocol: The protocol to enforce. - :param str source: The source CIDR block. The CIDR block `0.0.0.0/0` - applies to all addresses. - :param NetworkACLRuleReference before: (optional) The rule that this rule - is immediately before. In a rule collection, this always - refers to the next item in the collection. If absent, this is the last - rule. - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['NetworkACLRuleItemNetworkACLRuleProtocolTCPUDP', 'NetworkACLRuleItemNetworkACLRuleProtocolICMP', 'NetworkACLRuleItemNetworkACLRuleProtocolAll'])) - raise Exception(msg) - - @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkACLRuleItem': - """Initialize a NetworkACLRuleItem object from a json dictionary.""" - disc_class = cls._get_class_by_discriminator(_dict) - if disc_class != cls: - return disc_class.from_dict(_dict) - msg = ("Cannot convert dictionary into an instance of base class 'NetworkACLRuleItem'. " + - "The discriminator value should map to a valid subclass: {1}").format( - ", ".join(['NetworkACLRuleItemNetworkACLRuleProtocolTCPUDP', 'NetworkACLRuleItemNetworkACLRuleProtocolICMP', 'NetworkACLRuleItemNetworkACLRuleProtocolAll'])) - raise Exception(msg) - - @classmethod - def _from_dict(cls, _dict: Dict): - """Initialize a NetworkACLRuleItem object from a json dictionary.""" - return cls.from_dict(_dict) - - @classmethod - def _get_class_by_discriminator(cls, _dict: Dict) -> object: - mapping = {} - mapping['all'] = 'NetworkACLRuleItemNetworkACLRuleProtocolAll' - mapping['icmp'] = 'NetworkACLRuleItemNetworkACLRuleProtocolICMP' - mapping['tcp'] = 'NetworkACLRuleItemNetworkACLRuleProtocolTCPUDP' - mapping['udp'] = 'NetworkACLRuleItemNetworkACLRuleProtocolTCPUDP' - disc_value = _dict.get('protocol') - if disc_value is None: - raise ValueError('Discriminator property \'protocol\' not found in NetworkACLRuleItem JSON') - class_name = mapping.get(disc_value, disc_value) - try: - disc_class = getattr(sys.modules[__name__], class_name) - except AttributeError: - disc_class = cls - if isinstance(disc_class, object): - return disc_class - raise TypeError('%s is not a discriminator class' % class_name) - - class ActionEnum(str, Enum): - """ - Whether to allow or deny matching traffic. - """ - ALLOW = 'allow' - DENY = 'deny' - - - class DirectionEnum(str, Enum): - """ - Whether the traffic to be matched is `inbound` or `outbound`. - """ - INBOUND = 'inbound' - OUTBOUND = 'outbound' - - - class IpVersionEnum(str, Enum): - """ - The IP version for this rule. - """ - IPV4 = 'ipv4' - IPV6 = 'ipv6' - - -class NetworkACLRulePatch(): +class NetworkInterfacePrototype(): """ - NetworkACLRulePatch. + NetworkInterfacePrototype. - :attr str action: (optional) Whether to allow or deny matching traffic. - :attr NetworkACLRuleBeforePatch before: (optional) The rule to move this rule - immediately before. Specify `null` to move this rule after - all existing rules. - :attr int code: (optional) The ICMP traffic code to allow. - :attr str destination: (optional) The destination IP address or CIDR block. The - CIDR block `0.0.0.0/0` applies to all addresses. - :attr int destination_port_max: (optional) The inclusive upper bound of TCP/UDP - destination port range. - :attr int destination_port_min: (optional) The inclusive lower bound of TCP/UDP - destination port range. - :attr str direction: (optional) Whether the traffic to be matched is `inbound` - or `outbound`. - :attr str name: (optional) The user-defined name for this rule. Names must be - unique within the network ACL the rule resides in. - :attr str source: (optional) The source IP address or CIDR block. The CIDR - block `0.0.0.0/0` applies to all addresses. - :attr int source_port_max: (optional) The inclusive upper bound of TCP/UDP - source port range. - :attr int source_port_min: (optional) The inclusive lower bound of TCP/UDP - source port range. - :attr int type: (optional) The ICMP traffic type to allow. + :attr bool allow_ip_spoofing: (optional) Indicates whether source IP spoofing is + allowed on this interface. If false, source IP spoofing is prevented on this + interface. If true, source IP spoofing is allowed on this interface. + :attr str name: (optional) The user-defined name for network interface. Names + must be unique within the instance the network interface resides in. If + unspecified, the name will be a hyphenated list of randomly-selected words. + :attr NetworkInterfaceIPPrototype primary_ip: (optional) The primary IP address + to bind to the network interface. This can be specified using + an existing reserved IP, or a prototype object for a new reserved IP. + If an existing reserved IP or a prototype object with an address is specified, + it must + be available on the network interface's subnet. Otherwise, an available address + on the + subnet will be automatically selected and reserved. + :attr List[SecurityGroupIdentity] security_groups: (optional) The security + groups to use for this network interface. If unspecified, the VPC's default + security group is used. + :attr SubnetIdentity subnet: The associated subnet. """ def __init__(self, + subnet: 'SubnetIdentity', *, - action: str = None, - before: 'NetworkACLRuleBeforePatch' = None, - code: int = None, - destination: str = None, - destination_port_max: int = None, - destination_port_min: int = None, - direction: str = None, + allow_ip_spoofing: bool = None, name: str = None, - source: str = None, - source_port_max: int = None, - source_port_min: int = None, - type: int = None) -> None: + primary_ip: 'NetworkInterfaceIPPrototype' = None, + security_groups: List['SecurityGroupIdentity'] = None) -> None: """ - Initialize a NetworkACLRulePatch object. + Initialize a NetworkInterfacePrototype object. - :param str action: (optional) Whether to allow or deny matching traffic. - :param NetworkACLRuleBeforePatch before: (optional) The rule to move this - rule immediately before. Specify `null` to move this rule after - all existing rules. - :param int code: (optional) The ICMP traffic code to allow. - :param str destination: (optional) The destination IP address or CIDR - block. The CIDR block `0.0.0.0/0` applies to all addresses. - :param int destination_port_max: (optional) The inclusive upper bound of - TCP/UDP destination port range. - :param int destination_port_min: (optional) The inclusive lower bound of - TCP/UDP destination port range. - :param str direction: (optional) Whether the traffic to be matched is - `inbound` or `outbound`. - :param str name: (optional) The user-defined name for this rule. Names must - be unique within the network ACL the rule resides in. - :param str source: (optional) The source IP address or CIDR block. The - CIDR block `0.0.0.0/0` applies to all addresses. - :param int source_port_max: (optional) The inclusive upper bound of TCP/UDP - source port range. - :param int source_port_min: (optional) The inclusive lower bound of TCP/UDP - source port range. - :param int type: (optional) The ICMP traffic type to allow. + :param SubnetIdentity subnet: The associated subnet. + :param bool allow_ip_spoofing: (optional) Indicates whether source IP + spoofing is allowed on this interface. If false, source IP spoofing is + prevented on this interface. If true, source IP spoofing is allowed on this + interface. + :param str name: (optional) The user-defined name for network interface. + Names must be unique within the instance the network interface resides in. + If unspecified, the name will be a hyphenated list of randomly-selected + words. + :param NetworkInterfaceIPPrototype primary_ip: (optional) The primary IP + address to bind to the network interface. This can be specified using + an existing reserved IP, or a prototype object for a new reserved IP. + If an existing reserved IP or a prototype object with an address is + specified, it must + be available on the network interface's subnet. Otherwise, an available + address on the + subnet will be automatically selected and reserved. + :param List[SecurityGroupIdentity] security_groups: (optional) The security + groups to use for this network interface. If unspecified, the VPC's default + security group is used. """ - self.action = action - self.before = before - self.code = code - self.destination = destination - self.destination_port_max = destination_port_max - self.destination_port_min = destination_port_min - self.direction = direction + self.allow_ip_spoofing = allow_ip_spoofing self.name = name - self.source = source - self.source_port_max = source_port_max - self.source_port_min = source_port_min - self.type = type + self.primary_ip = primary_ip + self.security_groups = security_groups + self.subnet = subnet @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkACLRulePatch': - """Initialize a NetworkACLRulePatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'NetworkInterfacePrototype': + """Initialize a NetworkInterfacePrototype object from a json dictionary.""" args = {} - if 'action' in _dict: - args['action'] = _dict.get('action') - if 'before' in _dict: - args['before'] = _dict.get('before') - if 'code' in _dict: - args['code'] = _dict.get('code') - if 'destination' in _dict: - args['destination'] = _dict.get('destination') - if 'destination_port_max' in _dict: - args['destination_port_max'] = _dict.get('destination_port_max') - if 'destination_port_min' in _dict: - args['destination_port_min'] = _dict.get('destination_port_min') - if 'direction' in _dict: - args['direction'] = _dict.get('direction') + if 'allow_ip_spoofing' in _dict: + args['allow_ip_spoofing'] = _dict.get('allow_ip_spoofing') if 'name' in _dict: args['name'] = _dict.get('name') - if 'source' in _dict: - args['source'] = _dict.get('source') - if 'source_port_max' in _dict: - args['source_port_max'] = _dict.get('source_port_max') - if 'source_port_min' in _dict: - args['source_port_min'] = _dict.get('source_port_min') - if 'type' in _dict: - args['type'] = _dict.get('type') + if 'primary_ip' in _dict: + args['primary_ip'] = _dict.get('primary_ip') + if 'security_groups' in _dict: + args['security_groups'] = _dict.get('security_groups') + if 'subnet' in _dict: + args['subnet'] = _dict.get('subnet') + else: + raise ValueError('Required property \'subnet\' not present in NetworkInterfacePrototype JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a NetworkACLRulePatch object from a json dictionary.""" + """Initialize a NetworkInterfacePrototype object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'action') and self.action is not None: - _dict['action'] = self.action - if hasattr(self, 'before') and self.before is not None: - if isinstance(self.before, dict): - _dict['before'] = self.before - else: - _dict['before'] = self.before.to_dict() - if hasattr(self, 'code') and self.code is not None: - _dict['code'] = self.code - if hasattr(self, 'destination') and self.destination is not None: - _dict['destination'] = self.destination - if hasattr(self, 'destination_port_max') and self.destination_port_max is not None: - _dict['destination_port_max'] = self.destination_port_max - if hasattr(self, 'destination_port_min') and self.destination_port_min is not None: - _dict['destination_port_min'] = self.destination_port_min - if hasattr(self, 'direction') and self.direction is not None: - _dict['direction'] = self.direction + if hasattr(self, 'allow_ip_spoofing') and self.allow_ip_spoofing is not None: + _dict['allow_ip_spoofing'] = self.allow_ip_spoofing if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'source') and self.source is not None: - _dict['source'] = self.source - if hasattr(self, 'source_port_max') and self.source_port_max is not None: - _dict['source_port_max'] = self.source_port_max - if hasattr(self, 'source_port_min') and self.source_port_min is not None: - _dict['source_port_min'] = self.source_port_min - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type + if hasattr(self, 'primary_ip') and self.primary_ip is not None: + if isinstance(self.primary_ip, dict): + _dict['primary_ip'] = self.primary_ip + else: + _dict['primary_ip'] = self.primary_ip.to_dict() + if hasattr(self, 'security_groups') and self.security_groups is not None: + security_groups_list = [] + for x in self.security_groups: + if isinstance(x, dict): + security_groups_list.append(x) + else: + security_groups_list.append(x.to_dict()) + _dict['security_groups'] = security_groups_list + if hasattr(self, 'subnet') and self.subnet is not None: + if isinstance(self.subnet, dict): + _dict['subnet'] = self.subnet + else: + _dict['subnet'] = self.subnet.to_dict() return _dict def _to_dict(self): @@ -44402,301 +48456,113 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this NetworkACLRulePatch object.""" + """Return a `str` version of this NetworkInterfacePrototype object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'NetworkACLRulePatch') -> bool: + def __eq__(self, other: 'NetworkInterfacePrototype') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'NetworkACLRulePatch') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - - class ActionEnum(str, Enum): - """ - Whether to allow or deny matching traffic. - """ - ALLOW = 'allow' - DENY = 'deny' - - - class DirectionEnum(str, Enum): - """ - Whether the traffic to be matched is `inbound` or `outbound`. - """ - INBOUND = 'inbound' - OUTBOUND = 'outbound' - - -class NetworkACLRulePrototype(): - """ - NetworkACLRulePrototype. - - :attr str action: Whether to allow or deny matching traffic. - :attr NetworkACLRuleBeforePrototype before: (optional) The rule to insert this - rule immediately before. If omitted, this rule will be - inserted after all existing rules. - :attr str destination: The destination IP address or CIDR block. The CIDR block - `0.0.0.0/0` applies to all addresses. - :attr str direction: Whether the traffic to be matched is `inbound` or - `outbound`. - :attr str name: (optional) The user-defined name for this rule. Names must be - unique within the network ACL the rule resides in. If unspecified, the name will - be a hyphenated list of randomly-selected words. - :attr str protocol: The protocol to enforce. - :attr str source: The source IP address or CIDR block. The CIDR block - `0.0.0.0/0` applies to all addresses. - """ - - def __init__(self, - action: str, - destination: str, - direction: str, - protocol: str, - source: str, - *, - before: 'NetworkACLRuleBeforePrototype' = None, - name: str = None) -> None: - """ - Initialize a NetworkACLRulePrototype object. - - :param str action: Whether to allow or deny matching traffic. - :param str destination: The destination IP address or CIDR block. The CIDR - block `0.0.0.0/0` applies to all addresses. - :param str direction: Whether the traffic to be matched is `inbound` or - `outbound`. - :param str protocol: The protocol to enforce. - :param str source: The source IP address or CIDR block. The CIDR block - `0.0.0.0/0` applies to all addresses. - :param NetworkACLRuleBeforePrototype before: (optional) The rule to insert - this rule immediately before. If omitted, this rule will be - inserted after all existing rules. - :param str name: (optional) The user-defined name for this rule. Names must - be unique within the network ACL the rule resides in. If unspecified, the - name will be a hyphenated list of randomly-selected words. - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['NetworkACLRulePrototypeNetworkACLRuleProtocolTCPUDP', 'NetworkACLRulePrototypeNetworkACLRuleProtocolICMP', 'NetworkACLRulePrototypeNetworkACLRuleProtocolAll'])) - raise Exception(msg) - - @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkACLRulePrototype': - """Initialize a NetworkACLRulePrototype object from a json dictionary.""" - disc_class = cls._get_class_by_discriminator(_dict) - if disc_class != cls: - return disc_class.from_dict(_dict) - msg = ("Cannot convert dictionary into an instance of base class 'NetworkACLRulePrototype'. " + - "The discriminator value should map to a valid subclass: {1}").format( - ", ".join(['NetworkACLRulePrototypeNetworkACLRuleProtocolTCPUDP', 'NetworkACLRulePrototypeNetworkACLRuleProtocolICMP', 'NetworkACLRulePrototypeNetworkACLRuleProtocolAll'])) - raise Exception(msg) - - @classmethod - def _from_dict(cls, _dict: Dict): - """Initialize a NetworkACLRulePrototype object from a json dictionary.""" - return cls.from_dict(_dict) - - @classmethod - def _get_class_by_discriminator(cls, _dict: Dict) -> object: - mapping = {} - mapping['all'] = 'NetworkACLRulePrototypeNetworkACLRuleProtocolAll' - mapping['icmp'] = 'NetworkACLRulePrototypeNetworkACLRuleProtocolICMP' - mapping['tcp'] = 'NetworkACLRulePrototypeNetworkACLRuleProtocolTCPUDP' - mapping['udp'] = 'NetworkACLRulePrototypeNetworkACLRuleProtocolTCPUDP' - disc_value = _dict.get('protocol') - if disc_value is None: - raise ValueError('Discriminator property \'protocol\' not found in NetworkACLRulePrototype JSON') - class_name = mapping.get(disc_value, disc_value) - try: - disc_class = getattr(sys.modules[__name__], class_name) - except AttributeError: - disc_class = cls - if isinstance(disc_class, object): - return disc_class - raise TypeError('%s is not a discriminator class' % class_name) - - class ActionEnum(str, Enum): - """ - Whether to allow or deny matching traffic. - """ - ALLOW = 'allow' - DENY = 'deny' - - - class DirectionEnum(str, Enum): - """ - Whether the traffic to be matched is `inbound` or `outbound`. - """ - INBOUND = 'inbound' - OUTBOUND = 'outbound' - + def __ne__(self, other: 'NetworkInterfacePrototype') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other -class NetworkACLRulePrototypeNetworkACLContext(): +class NetworkInterfaceReferenceDeleted(): """ - NetworkACLRulePrototypeNetworkACLContext. + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. - :attr str action: Whether to allow or deny matching traffic. - :attr str destination: The destination IP address or CIDR block. The CIDR block - `0.0.0.0/0` applies to all addresses. - :attr str direction: Whether the traffic to be matched is `inbound` or - `outbound`. - :attr str name: (optional) The user-defined name for this rule. Names must be - unique within the network ACL the rule resides in. If unspecified, the name will - be a hyphenated list of randomly-selected words. - :attr str protocol: The protocol to enforce. - :attr str source: The source IP address or CIDR block. The CIDR block - `0.0.0.0/0` applies to all addresses. + :attr str more_info: Link to documentation about deleted resources. """ def __init__(self, - action: str, - destination: str, - direction: str, - protocol: str, - source: str, - *, - name: str = None) -> None: + more_info: str) -> None: """ - Initialize a NetworkACLRulePrototypeNetworkACLContext object. + Initialize a NetworkInterfaceReferenceDeleted object. - :param str action: Whether to allow or deny matching traffic. - :param str destination: The destination IP address or CIDR block. The CIDR - block `0.0.0.0/0` applies to all addresses. - :param str direction: Whether the traffic to be matched is `inbound` or - `outbound`. - :param str protocol: The protocol to enforce. - :param str source: The source IP address or CIDR block. The CIDR block - `0.0.0.0/0` applies to all addresses. - :param str name: (optional) The user-defined name for this rule. Names must - be unique within the network ACL the rule resides in. If unspecified, the - name will be a hyphenated list of randomly-selected words. + :param str more_info: Link to documentation about deleted resources. """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTCPUDP', 'NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolICMP', 'NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAll'])) - raise Exception(msg) + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkACLRulePrototypeNetworkACLContext': - """Initialize a NetworkACLRulePrototypeNetworkACLContext object from a json dictionary.""" - disc_class = cls._get_class_by_discriminator(_dict) - if disc_class != cls: - return disc_class.from_dict(_dict) - msg = ("Cannot convert dictionary into an instance of base class 'NetworkACLRulePrototypeNetworkACLContext'. " + - "The discriminator value should map to a valid subclass: {1}").format( - ", ".join(['NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTCPUDP', 'NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolICMP', 'NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAll'])) - raise Exception(msg) + def from_dict(cls, _dict: Dict) -> 'NetworkInterfaceReferenceDeleted': + """Initialize a NetworkInterfaceReferenceDeleted object from a json dictionary.""" + args = {} + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') + else: + raise ValueError('Required property \'more_info\' not present in NetworkInterfaceReferenceDeleted JSON') + return cls(**args) @classmethod - def _from_dict(cls, _dict: Dict): - """Initialize a NetworkACLRulePrototypeNetworkACLContext object from a json dictionary.""" + def _from_dict(cls, _dict): + """Initialize a NetworkInterfaceReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) - @classmethod - def _get_class_by_discriminator(cls, _dict: Dict) -> object: - mapping = {} - mapping['all'] = 'NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAll' - mapping['icmp'] = 'NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolICMP' - mapping['tcp'] = 'NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTCPUDP' - mapping['udp'] = 'NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTCPUDP' - disc_value = _dict.get('protocol') - if disc_value is None: - raise ValueError('Discriminator property \'protocol\' not found in NetworkACLRulePrototypeNetworkACLContext JSON') - class_name = mapping.get(disc_value, disc_value) - try: - disc_class = getattr(sys.modules[__name__], class_name) - except AttributeError: - disc_class = cls - if isinstance(disc_class, object): - return disc_class - raise TypeError('%s is not a discriminator class' % class_name) + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info + return _dict - class ActionEnum(str, Enum): - """ - Whether to allow or deny matching traffic. - """ - ALLOW = 'allow' - DENY = 'deny' + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + def __str__(self) -> str: + """Return a `str` version of this NetworkInterfaceReferenceDeleted object.""" + return json.dumps(self.to_dict(), indent=2) - class DirectionEnum(str, Enum): - """ - Whether the traffic to be matched is `inbound` or `outbound`. - """ - INBOUND = 'inbound' - OUTBOUND = 'outbound' + def __eq__(self, other: 'NetworkInterfaceReferenceDeleted') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + def __ne__(self, other: 'NetworkInterfaceReferenceDeleted') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other -class NetworkACLRuleReference(): +class NetworkInterfaceReferenceTargetContextDeleted(): """ - NetworkACLRuleReference. + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. - :attr NetworkACLRuleReferenceDeleted deleted: (optional) If present, this - property indicates the referenced resource has been deleted and provides - some supplementary information. - :attr str href: The URL for this network ACL rule. - :attr str id: The unique identifier for this network ACL rule. - :attr str name: The user-defined name for this network ACL rule. + :attr str more_info: Link to documentation about deleted resources. """ def __init__(self, - href: str, - id: str, - name: str, - *, - deleted: 'NetworkACLRuleReferenceDeleted' = None) -> None: + more_info: str) -> None: """ - Initialize a NetworkACLRuleReference object. + Initialize a NetworkInterfaceReferenceTargetContextDeleted object. - :param str href: The URL for this network ACL rule. - :param str id: The unique identifier for this network ACL rule. - :param str name: The user-defined name for this network ACL rule. - :param NetworkACLRuleReferenceDeleted deleted: (optional) If present, this - property indicates the referenced resource has been deleted and provides - some supplementary information. + :param str more_info: Link to documentation about deleted resources. """ - self.deleted = deleted - self.href = href - self.id = id - self.name = name + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkACLRuleReference': - """Initialize a NetworkACLRuleReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'NetworkInterfaceReferenceTargetContextDeleted': + """Initialize a NetworkInterfaceReferenceTargetContextDeleted object from a json dictionary.""" args = {} - if 'deleted' in _dict: - args['deleted'] = NetworkACLRuleReferenceDeleted.from_dict(_dict.get('deleted')) - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in NetworkACLRuleReference JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in NetworkACLRuleReference JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'name\' not present in NetworkACLRuleReference JSON') + raise ValueError('Required property \'more_info\' not present in NetworkInterfaceReferenceTargetContextDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a NetworkACLRuleReference object from a json dictionary.""" + """Initialize a NetworkInterfaceReferenceTargetContextDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -44704,56 +48570,57 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this NetworkACLRuleReference object.""" + """Return a `str` version of this NetworkInterfaceReferenceTargetContextDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'NetworkACLRuleReference') -> bool: + def __eq__(self, other: 'NetworkInterfaceReferenceTargetContextDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'NetworkACLRuleReference') -> bool: + def __ne__(self, other: 'NetworkInterfaceReferenceTargetContextDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class NetworkACLRuleReferenceDeleted(): +class NetworkInterfaceUnpaginatedCollection(): """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. + NetworkInterfaceUnpaginatedCollection. - :attr str more_info: Link to documentation about deleted resources. + :attr List[NetworkInterface] network_interfaces: Collection of network + interfaces. """ def __init__(self, - more_info: str) -> None: + network_interfaces: List['NetworkInterface']) -> None: """ - Initialize a NetworkACLRuleReferenceDeleted object. + Initialize a NetworkInterfaceUnpaginatedCollection object. - :param str more_info: Link to documentation about deleted resources. + :param List[NetworkInterface] network_interfaces: Collection of network + interfaces. """ - self.more_info = more_info + self.network_interfaces = network_interfaces @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkACLRuleReferenceDeleted': - """Initialize a NetworkACLRuleReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'NetworkInterfaceUnpaginatedCollection': + """Initialize a NetworkInterfaceUnpaginatedCollection object from a json dictionary.""" args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') + if 'network_interfaces' in _dict: + args['network_interfaces'] = [NetworkInterface.from_dict(x) for x in _dict.get('network_interfaces')] else: - raise ValueError('Required property \'more_info\' not present in NetworkACLRuleReferenceDeleted JSON') + raise ValueError('Required property \'network_interfaces\' not present in NetworkInterfaceUnpaginatedCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a NetworkACLRuleReferenceDeleted object from a json dictionary.""" + """Initialize a NetworkInterfaceUnpaginatedCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'network_interfaces') and self.network_interfaces is not None: + _dict['network_interfaces'] = [x.to_dict() for x in self.network_interfaces] return _dict def _to_dict(self): @@ -44761,185 +48628,223 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this NetworkACLRuleReferenceDeleted object.""" + """Return a `str` version of this NetworkInterfaceUnpaginatedCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'NetworkACLRuleReferenceDeleted') -> bool: + def __eq__(self, other: 'NetworkInterfaceUnpaginatedCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'NetworkACLRuleReferenceDeleted') -> bool: + def __ne__(self, other: 'NetworkInterfaceUnpaginatedCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class NetworkInterface(): +class OperatingSystem(): """ - NetworkInterface. + OperatingSystem. - :attr bool allow_ip_spoofing: Indicates whether source IP spoofing is allowed on - this interface. If false, source IP spoofing is prevented on this interface. If - true, source IP spoofing is allowed on this interface. - :attr datetime created_at: The date and time that the network interface was - created. - :attr List[FloatingIPReference] floating_ips: (optional) The floating IPs - associated with this network interface. - :attr str href: The URL for this network interface. - :attr str id: The unique identifier for this network interface. - :attr str name: The user-defined name for this network interface. - :attr int port_speed: The network interface port speed in Mbps. - :attr ReservedIPReference primary_ip: - :attr str resource_type: The resource type. - :attr List[SecurityGroupReference] security_groups: The security groups - targeting this network interface. - :attr str status: The status of the network interface. - :attr SubnetReference subnet: The associated subnet. - :attr str type: The type of this network interface as it relates to an instance. + :attr str architecture: The operating system architecture. + :attr bool dedicated_host_only: Images with this operating system can only be + used on dedicated hosts or dedicated host groups. + :attr str display_name: A unique, display-friendly name for the operating + system. + :attr str family: The software family for this operating system. + :attr str href: The URL for this operating system. + :attr str name: The globally unique name for this operating system. + :attr str vendor: The vendor of the operating system. + :attr str version: The major release version of this operating system. """ def __init__(self, - allow_ip_spoofing: bool, - created_at: datetime, + architecture: str, + dedicated_host_only: bool, + display_name: str, + family: str, href: str, - id: str, name: str, - port_speed: int, - primary_ip: 'ReservedIPReference', - resource_type: str, - security_groups: List['SecurityGroupReference'], - status: str, - subnet: 'SubnetReference', - type: str, - *, - floating_ips: List['FloatingIPReference'] = None) -> None: + vendor: str, + version: str) -> None: """ - Initialize a NetworkInterface object. + Initialize a OperatingSystem object. - :param bool allow_ip_spoofing: Indicates whether source IP spoofing is - allowed on this interface. If false, source IP spoofing is prevented on - this interface. If true, source IP spoofing is allowed on this interface. - :param datetime created_at: The date and time that the network interface - was created. - :param str href: The URL for this network interface. - :param str id: The unique identifier for this network interface. - :param str name: The user-defined name for this network interface. - :param int port_speed: The network interface port speed in Mbps. - :param ReservedIPReference primary_ip: - :param str resource_type: The resource type. - :param List[SecurityGroupReference] security_groups: The security groups - targeting this network interface. - :param str status: The status of the network interface. - :param SubnetReference subnet: The associated subnet. - :param str type: The type of this network interface as it relates to an - instance. - :param List[FloatingIPReference] floating_ips: (optional) The floating IPs - associated with this network interface. + :param str architecture: The operating system architecture. + :param bool dedicated_host_only: Images with this operating system can only + be used on dedicated hosts or dedicated host groups. + :param str display_name: A unique, display-friendly name for the operating + system. + :param str family: The software family for this operating system. + :param str href: The URL for this operating system. + :param str name: The globally unique name for this operating system. + :param str vendor: The vendor of the operating system. + :param str version: The major release version of this operating system. """ - self.allow_ip_spoofing = allow_ip_spoofing - self.created_at = created_at - self.floating_ips = floating_ips + self.architecture = architecture + self.dedicated_host_only = dedicated_host_only + self.display_name = display_name + self.family = family self.href = href - self.id = id self.name = name - self.port_speed = port_speed - self.primary_ip = primary_ip - self.resource_type = resource_type - self.security_groups = security_groups - self.status = status - self.subnet = subnet - self.type = type + self.vendor = vendor + self.version = version @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkInterface': - """Initialize a NetworkInterface object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'OperatingSystem': + """Initialize a OperatingSystem object from a json dictionary.""" args = {} - if 'allow_ip_spoofing' in _dict: - args['allow_ip_spoofing'] = _dict.get('allow_ip_spoofing') + if 'architecture' in _dict: + args['architecture'] = _dict.get('architecture') else: - raise ValueError('Required property \'allow_ip_spoofing\' not present in NetworkInterface JSON') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) + raise ValueError('Required property \'architecture\' not present in OperatingSystem JSON') + if 'dedicated_host_only' in _dict: + args['dedicated_host_only'] = _dict.get('dedicated_host_only') else: - raise ValueError('Required property \'created_at\' not present in NetworkInterface JSON') - if 'floating_ips' in _dict: - args['floating_ips'] = [FloatingIPReference.from_dict(x) for x in _dict.get('floating_ips')] + raise ValueError('Required property \'dedicated_host_only\' not present in OperatingSystem JSON') + if 'display_name' in _dict: + args['display_name'] = _dict.get('display_name') + else: + raise ValueError('Required property \'display_name\' not present in OperatingSystem JSON') + if 'family' in _dict: + args['family'] = _dict.get('family') + else: + raise ValueError('Required property \'family\' not present in OperatingSystem JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in NetworkInterface JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in NetworkInterface JSON') + raise ValueError('Required property \'href\' not present in OperatingSystem JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in NetworkInterface JSON') - if 'port_speed' in _dict: - args['port_speed'] = _dict.get('port_speed') - else: - raise ValueError('Required property \'port_speed\' not present in NetworkInterface JSON') - if 'primary_ip' in _dict: - args['primary_ip'] = ReservedIPReference.from_dict(_dict.get('primary_ip')) - else: - raise ValueError('Required property \'primary_ip\' not present in NetworkInterface JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in NetworkInterface JSON') - if 'security_groups' in _dict: - args['security_groups'] = [SecurityGroupReference.from_dict(x) for x in _dict.get('security_groups')] - else: - raise ValueError('Required property \'security_groups\' not present in NetworkInterface JSON') - if 'status' in _dict: - args['status'] = _dict.get('status') - else: - raise ValueError('Required property \'status\' not present in NetworkInterface JSON') - if 'subnet' in _dict: - args['subnet'] = SubnetReference.from_dict(_dict.get('subnet')) + raise ValueError('Required property \'name\' not present in OperatingSystem JSON') + if 'vendor' in _dict: + args['vendor'] = _dict.get('vendor') else: - raise ValueError('Required property \'subnet\' not present in NetworkInterface JSON') - if 'type' in _dict: - args['type'] = _dict.get('type') + raise ValueError('Required property \'vendor\' not present in OperatingSystem JSON') + if 'version' in _dict: + args['version'] = _dict.get('version') else: - raise ValueError('Required property \'type\' not present in NetworkInterface JSON') + raise ValueError('Required property \'version\' not present in OperatingSystem JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a NetworkInterface object from a json dictionary.""" + """Initialize a OperatingSystem object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'allow_ip_spoofing') and self.allow_ip_spoofing is not None: - _dict['allow_ip_spoofing'] = self.allow_ip_spoofing - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'floating_ips') and self.floating_ips is not None: - _dict['floating_ips'] = [x.to_dict() for x in self.floating_ips] + if hasattr(self, 'architecture') and self.architecture is not None: + _dict['architecture'] = self.architecture + if hasattr(self, 'dedicated_host_only') and self.dedicated_host_only is not None: + _dict['dedicated_host_only'] = self.dedicated_host_only + if hasattr(self, 'display_name') and self.display_name is not None: + _dict['display_name'] = self.display_name + if hasattr(self, 'family') and self.family is not None: + _dict['family'] = self.family if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'port_speed') and self.port_speed is not None: - _dict['port_speed'] = self.port_speed - if hasattr(self, 'primary_ip') and self.primary_ip is not None: - _dict['primary_ip'] = self.primary_ip.to_dict() - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type - if hasattr(self, 'security_groups') and self.security_groups is not None: - _dict['security_groups'] = [x.to_dict() for x in self.security_groups] - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status - if hasattr(self, 'subnet') and self.subnet is not None: - _dict['subnet'] = self.subnet.to_dict() - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type + if hasattr(self, 'vendor') and self.vendor is not None: + _dict['vendor'] = self.vendor + if hasattr(self, 'version') and self.version is not None: + _dict['version'] = self.version + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this OperatingSystem object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'OperatingSystem') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'OperatingSystem') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class OperatingSystemCollection(): + """ + OperatingSystemCollection. + + :attr OperatingSystemCollectionFirst first: A link to the first page of + resources. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr OperatingSystemCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages + except the last page. + :attr List[OperatingSystem] operating_systems: Collection of operating systems. + """ + + def __init__(self, + first: 'OperatingSystemCollectionFirst', + limit: int, + operating_systems: List['OperatingSystem'], + *, + next: 'OperatingSystemCollectionNext' = None) -> None: + """ + Initialize a OperatingSystemCollection object. + + :param OperatingSystemCollectionFirst first: A link to the first page of + resources. + :param int limit: The maximum number of resources that can be returned by + the request. + :param List[OperatingSystem] operating_systems: Collection of operating + systems. + :param OperatingSystemCollectionNext next: (optional) A link to the next + page of resources. This property is present for all pages + except the last page. + """ + self.first = first + self.limit = limit + self.next = next + self.operating_systems = operating_systems + + @classmethod + def from_dict(cls, _dict: Dict) -> 'OperatingSystemCollection': + """Initialize a OperatingSystemCollection object from a json dictionary.""" + args = {} + if 'first' in _dict: + args['first'] = OperatingSystemCollectionFirst.from_dict(_dict.get('first')) + else: + raise ValueError('Required property \'first\' not present in OperatingSystemCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') + else: + raise ValueError('Required property \'limit\' not present in OperatingSystemCollection JSON') + if 'next' in _dict: + args['next'] = OperatingSystemCollectionNext.from_dict(_dict.get('next')) + if 'operating_systems' in _dict: + args['operating_systems'] = [OperatingSystem.from_dict(x) for x in _dict.get('operating_systems')] + else: + raise ValueError('Required property \'operating_systems\' not present in OperatingSystemCollection JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a OperatingSystemCollection object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'operating_systems') and self.operating_systems is not None: + _dict['operating_systems'] = [x.to_dict() for x in self.operating_systems] return _dict def _to_dict(self): @@ -44947,145 +48852,55 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this NetworkInterface object.""" + """Return a `str` version of this OperatingSystemCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'NetworkInterface') -> bool: + def __eq__(self, other: 'OperatingSystemCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'NetworkInterface') -> bool: + def __ne__(self, other: 'OperatingSystemCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ResourceTypeEnum(str, Enum): - """ - The resource type. - """ - NETWORK_INTERFACE = 'network_interface' - - - class StatusEnum(str, Enum): - """ - The status of the network interface. - """ - AVAILABLE = 'available' - DELETING = 'deleting' - FAILED = 'failed' - PENDING = 'pending' - - - class TypeEnum(str, Enum): - """ - The type of this network interface as it relates to an instance. - """ - PRIMARY = 'primary' - SECONDARY = 'secondary' - - -class NetworkInterfaceBareMetalServerContextReference(): +class OperatingSystemCollectionFirst(): """ - NetworkInterfaceBareMetalServerContextReference. + A link to the first page of resources. - :attr NetworkInterfaceBareMetalServerContextReferenceDeleted deleted: (optional) - If present, this property indicates the referenced resource has been deleted and - provides - some supplementary information. - :attr str href: The URL for this network interface. - :attr str id: The unique identifier for this network interface. - :attr str name: The user-defined name for this network interface. - :attr ReservedIPReference primary_ip: - :attr str resource_type: The resource type. - :attr SubnetReference subnet: The associated subnet. + :attr str href: The URL for a page of resources. """ def __init__(self, - href: str, - id: str, - name: str, - primary_ip: 'ReservedIPReference', - resource_type: str, - subnet: 'SubnetReference', - *, - deleted: 'NetworkInterfaceBareMetalServerContextReferenceDeleted' = None) -> None: + href: str) -> None: """ - Initialize a NetworkInterfaceBareMetalServerContextReference object. + Initialize a OperatingSystemCollectionFirst object. - :param str href: The URL for this network interface. - :param str id: The unique identifier for this network interface. - :param str name: The user-defined name for this network interface. - :param ReservedIPReference primary_ip: - :param str resource_type: The resource type. - :param SubnetReference subnet: The associated subnet. - :param NetworkInterfaceBareMetalServerContextReferenceDeleted deleted: - (optional) If present, this property indicates the referenced resource has - been deleted and provides - some supplementary information. + :param str href: The URL for a page of resources. """ - self.deleted = deleted self.href = href - self.id = id - self.name = name - self.primary_ip = primary_ip - self.resource_type = resource_type - self.subnet = subnet @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkInterfaceBareMetalServerContextReference': - """Initialize a NetworkInterfaceBareMetalServerContextReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'OperatingSystemCollectionFirst': + """Initialize a OperatingSystemCollectionFirst object from a json dictionary.""" args = {} - if 'deleted' in _dict: - args['deleted'] = NetworkInterfaceBareMetalServerContextReferenceDeleted.from_dict(_dict.get('deleted')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in NetworkInterfaceBareMetalServerContextReference JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in NetworkInterfaceBareMetalServerContextReference JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in NetworkInterfaceBareMetalServerContextReference JSON') - if 'primary_ip' in _dict: - args['primary_ip'] = ReservedIPReference.from_dict(_dict.get('primary_ip')) - else: - raise ValueError('Required property \'primary_ip\' not present in NetworkInterfaceBareMetalServerContextReference JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in NetworkInterfaceBareMetalServerContextReference JSON') - if 'subnet' in _dict: - args['subnet'] = SubnetReference.from_dict(_dict.get('subnet')) - else: - raise ValueError('Required property \'subnet\' not present in NetworkInterfaceBareMetalServerContextReference JSON') + raise ValueError('Required property \'href\' not present in OperatingSystemCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a NetworkInterfaceBareMetalServerContextReference object from a json dictionary.""" + """Initialize a OperatingSystemCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'primary_ip') and self.primary_ip is not None: - _dict['primary_ip'] = self.primary_ip.to_dict() - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type - if hasattr(self, 'subnet') and self.subnet is not None: - _dict['subnet'] = self.subnet.to_dict() return _dict def _to_dict(self): @@ -45093,63 +48908,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this NetworkInterfaceBareMetalServerContextReference object.""" + """Return a `str` version of this OperatingSystemCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'NetworkInterfaceBareMetalServerContextReference') -> bool: + def __eq__(self, other: 'OperatingSystemCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'NetworkInterfaceBareMetalServerContextReference') -> bool: + def __ne__(self, other: 'OperatingSystemCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ResourceTypeEnum(str, Enum): - """ - The resource type. - """ - NETWORK_INTERFACE = 'network_interface' - - -class NetworkInterfaceBareMetalServerContextReferenceDeleted(): +class OperatingSystemCollectionNext(): """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. + A link to the next page of resources. This property is present for all pages except + the last page. - :attr str more_info: Link to documentation about deleted resources. + :attr str href: The URL for a page of resources. """ def __init__(self, - more_info: str) -> None: + href: str) -> None: """ - Initialize a NetworkInterfaceBareMetalServerContextReferenceDeleted object. + Initialize a OperatingSystemCollectionNext object. - :param str more_info: Link to documentation about deleted resources. + :param str href: The URL for a page of resources. """ - self.more_info = more_info + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkInterfaceBareMetalServerContextReferenceDeleted': - """Initialize a NetworkInterfaceBareMetalServerContextReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'OperatingSystemCollectionNext': + """Initialize a OperatingSystemCollectionNext object from a json dictionary.""" args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'more_info\' not present in NetworkInterfaceBareMetalServerContextReferenceDeleted JSON') + raise ValueError('Required property \'href\' not present in OperatingSystemCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a NetworkInterfaceBareMetalServerContextReferenceDeleted object from a json dictionary.""" + """Initialize a OperatingSystemCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -45157,135 +48965,80 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this NetworkInterfaceBareMetalServerContextReferenceDeleted object.""" + """Return a `str` version of this OperatingSystemCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'NetworkInterfaceBareMetalServerContextReferenceDeleted') -> bool: + def __eq__(self, other: 'OperatingSystemCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'NetworkInterfaceBareMetalServerContextReferenceDeleted') -> bool: + def __ne__(self, other: 'OperatingSystemCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class NetworkInterfaceIPPrototype(): +class OperatingSystemIdentity(): """ - NetworkInterfaceIPPrototype. + Identifies an operating system by a unique property. """ def __init__(self) -> None: """ - Initialize a NetworkInterfaceIPPrototype object. + Initialize a OperatingSystemIdentity object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['NetworkInterfaceIPPrototypeReservedIPIdentity', 'NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext'])) + ", ".join(['OperatingSystemIdentityByName', 'OperatingSystemIdentityByHref'])) raise Exception(msg) -class NetworkInterfaceInstanceContextReference(): +class OperatingSystemReference(): """ - NetworkInterfaceInstanceContextReference. + OperatingSystemReference. - :attr NetworkInterfaceInstanceContextReferenceDeleted deleted: (optional) If - present, this property indicates the referenced resource has been deleted and - provides - some supplementary information. - :attr str href: The URL for this network interface. - :attr str id: The unique identifier for this network interface. - :attr str name: The user-defined name for this network interface. - :attr ReservedIPReference primary_ip: - :attr str resource_type: The resource type. - :attr SubnetReference subnet: The associated subnet. + :attr str href: The URL for this operating system. + :attr str name: The globally unique name for this operating system. """ def __init__(self, href: str, - id: str, - name: str, - primary_ip: 'ReservedIPReference', - resource_type: str, - subnet: 'SubnetReference', - *, - deleted: 'NetworkInterfaceInstanceContextReferenceDeleted' = None) -> None: + name: str) -> None: """ - Initialize a NetworkInterfaceInstanceContextReference object. + Initialize a OperatingSystemReference object. - :param str href: The URL for this network interface. - :param str id: The unique identifier for this network interface. - :param str name: The user-defined name for this network interface. - :param ReservedIPReference primary_ip: - :param str resource_type: The resource type. - :param SubnetReference subnet: The associated subnet. - :param NetworkInterfaceInstanceContextReferenceDeleted deleted: (optional) - If present, this property indicates the referenced resource has been - deleted and provides - some supplementary information. + :param str href: The URL for this operating system. + :param str name: The globally unique name for this operating system. """ - self.deleted = deleted self.href = href - self.id = id self.name = name - self.primary_ip = primary_ip - self.resource_type = resource_type - self.subnet = subnet @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkInterfaceInstanceContextReference': - """Initialize a NetworkInterfaceInstanceContextReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'OperatingSystemReference': + """Initialize a OperatingSystemReference object from a json dictionary.""" args = {} - if 'deleted' in _dict: - args['deleted'] = NetworkInterfaceInstanceContextReferenceDeleted.from_dict(_dict.get('deleted')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in NetworkInterfaceInstanceContextReference JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in NetworkInterfaceInstanceContextReference JSON') + raise ValueError('Required property \'href\' not present in OperatingSystemReference JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in NetworkInterfaceInstanceContextReference JSON') - if 'primary_ip' in _dict: - args['primary_ip'] = ReservedIPReference.from_dict(_dict.get('primary_ip')) - else: - raise ValueError('Required property \'primary_ip\' not present in NetworkInterfaceInstanceContextReference JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in NetworkInterfaceInstanceContextReference JSON') - if 'subnet' in _dict: - args['subnet'] = SubnetReference.from_dict(_dict.get('subnet')) - else: - raise ValueError('Required property \'subnet\' not present in NetworkInterfaceInstanceContextReference JSON') + raise ValueError('Required property \'name\' not present in OperatingSystemReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a NetworkInterfaceInstanceContextReference object from a json dictionary.""" + """Initialize a OperatingSystemReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'primary_ip') and self.primary_ip is not None: - _dict['primary_ip'] = self.primary_ip.to_dict() - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type - if hasattr(self, 'subnet') and self.subnet is not None: - _dict['subnet'] = self.subnet.to_dict() return _dict def _to_dict(self): @@ -45293,63 +49046,151 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this NetworkInterfaceInstanceContextReference object.""" + """Return a `str` version of this OperatingSystemReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'NetworkInterfaceInstanceContextReference') -> bool: + def __eq__(self, other: 'OperatingSystemReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'NetworkInterfaceInstanceContextReference') -> bool: + def __ne__(self, other: 'OperatingSystemReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ResourceTypeEnum(str, Enum): - """ - The resource type. - """ - NETWORK_INTERFACE = 'network_interface' - - -class NetworkInterfaceInstanceContextReferenceDeleted(): +class PlacementGroup(): """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. + PlacementGroup. - :attr str more_info: Link to documentation about deleted resources. + :attr datetime created_at: The date and time that the placement group was + created. + :attr str crn: The CRN for this placement group. + :attr str href: The URL for this placement group. + :attr str id: The unique identifier for this placement group. + :attr str lifecycle_state: The lifecycle state of the placement group. + :attr str name: The user-defined name for this placement group. + :attr ResourceGroupReference resource_group: The resource group for this + placement group. + :attr str resource_type: The resource type. + :attr str strategy: The strategy for this placement group + - `host_spread`: place on different compute hosts + - `power_spread`: place on compute hosts that use different power sources + The enumerated values for this property may expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the placement group on which the + unexpected strategy was encountered. """ def __init__(self, - more_info: str) -> None: + created_at: datetime, + crn: str, + href: str, + id: str, + lifecycle_state: str, + name: str, + resource_group: 'ResourceGroupReference', + resource_type: str, + strategy: str) -> None: """ - Initialize a NetworkInterfaceInstanceContextReferenceDeleted object. + Initialize a PlacementGroup object. - :param str more_info: Link to documentation about deleted resources. + :param datetime created_at: The date and time that the placement group was + created. + :param str crn: The CRN for this placement group. + :param str href: The URL for this placement group. + :param str id: The unique identifier for this placement group. + :param str lifecycle_state: The lifecycle state of the placement group. + :param str name: The user-defined name for this placement group. + :param ResourceGroupReference resource_group: The resource group for this + placement group. + :param str resource_type: The resource type. + :param str strategy: The strategy for this placement group + - `host_spread`: place on different compute hosts + - `power_spread`: place on compute hosts that use different power sources + The enumerated values for this property may expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the placement group on which + the unexpected strategy was encountered. """ - self.more_info = more_info + self.created_at = created_at + self.crn = crn + self.href = href + self.id = id + self.lifecycle_state = lifecycle_state + self.name = name + self.resource_group = resource_group + self.resource_type = resource_type + self.strategy = strategy @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkInterfaceInstanceContextReferenceDeleted': - """Initialize a NetworkInterfaceInstanceContextReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'PlacementGroup': + """Initialize a PlacementGroup object from a json dictionary.""" args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError('Required property \'more_info\' not present in NetworkInterfaceInstanceContextReferenceDeleted JSON') + raise ValueError('Required property \'created_at\' not present in PlacementGroup JSON') + if 'crn' in _dict: + args['crn'] = _dict.get('crn') + else: + raise ValueError('Required property \'crn\' not present in PlacementGroup JSON') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in PlacementGroup JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in PlacementGroup JSON') + if 'lifecycle_state' in _dict: + args['lifecycle_state'] = _dict.get('lifecycle_state') + else: + raise ValueError('Required property \'lifecycle_state\' not present in PlacementGroup JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in PlacementGroup JSON') + if 'resource_group' in _dict: + args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) + else: + raise ValueError('Required property \'resource_group\' not present in PlacementGroup JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in PlacementGroup JSON') + if 'strategy' in _dict: + args['strategy'] = _dict.get('strategy') + else: + raise ValueError('Required property \'strategy\' not present in PlacementGroup JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a NetworkInterfaceInstanceContextReferenceDeleted object from a json dictionary.""" + """Initialize a PlacementGroup object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'lifecycle_state') and self.lifecycle_state is not None: + _dict['lifecycle_state'] = self.lifecycle_state + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'resource_group') and self.resource_group is not None: + _dict['resource_group'] = self.resource_group.to_dict() + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + if hasattr(self, 'strategy') and self.strategy is not None: + _dict['strategy'] = self.strategy return _dict def _to_dict(self): @@ -45357,69 +49198,137 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this NetworkInterfaceInstanceContextReferenceDeleted object.""" + """Return a `str` version of this PlacementGroup object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'NetworkInterfaceInstanceContextReferenceDeleted') -> bool: + def __eq__(self, other: 'PlacementGroup') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'NetworkInterfaceInstanceContextReferenceDeleted') -> bool: + def __ne__(self, other: 'PlacementGroup') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class NetworkInterfacePatch(): + class LifecycleStateEnum(str, Enum): + """ + The lifecycle state of the placement group. + """ + DELETING = 'deleting' + FAILED = 'failed' + PENDING = 'pending' + STABLE = 'stable' + SUSPENDED = 'suspended' + UPDATING = 'updating' + WAITING = 'waiting' + + + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + PLACEMENT_GROUP = 'placement_group' + + + class StrategyEnum(str, Enum): + """ + The strategy for this placement group + - `host_spread`: place on different compute hosts + - `power_spread`: place on compute hosts that use different power sources + The enumerated values for this property may expand in the future. When processing + this property, check for and log unknown values. Optionally halt processing and + surface the error, or bypass the placement group on which the unexpected strategy + was encountered. + """ + HOST_SPREAD = 'host_spread' + POWER_SPREAD = 'power_spread' + + +class PlacementGroupCollection(): """ - NetworkInterfacePatch. + PlacementGroupCollection. - :attr bool allow_ip_spoofing: (optional) Indicates whether source IP spoofing is - allowed on this interface. If false, source IP spoofing is prevented on this - interface. If true, source IP spoofing is allowed on this interface. - :attr str name: (optional) The user-defined name for network interface. Names - must be unique within the instance the network interface resides in. + :attr PlacementGroupCollectionFirst first: A link to the first page of + resources. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr PlacementGroupCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages + except the last page. + :attr List[PlacementGroup] placement_groups: Collection of placement groups. + :attr int total_count: The total number of resources across all pages. """ def __init__(self, + first: 'PlacementGroupCollectionFirst', + limit: int, + placement_groups: List['PlacementGroup'], + total_count: int, *, - allow_ip_spoofing: bool = None, - name: str = None) -> None: + next: 'PlacementGroupCollectionNext' = None) -> None: """ - Initialize a NetworkInterfacePatch object. + Initialize a PlacementGroupCollection object. - :param bool allow_ip_spoofing: (optional) Indicates whether source IP - spoofing is allowed on this interface. If false, source IP spoofing is - prevented on this interface. If true, source IP spoofing is allowed on this - interface. - :param str name: (optional) The user-defined name for network interface. - Names must be unique within the instance the network interface resides in. + :param PlacementGroupCollectionFirst first: A link to the first page of + resources. + :param int limit: The maximum number of resources that can be returned by + the request. + :param List[PlacementGroup] placement_groups: Collection of placement + groups. + :param int total_count: The total number of resources across all pages. + :param PlacementGroupCollectionNext next: (optional) A link to the next + page of resources. This property is present for all pages + except the last page. """ - self.allow_ip_spoofing = allow_ip_spoofing - self.name = name + self.first = first + self.limit = limit + self.next = next + self.placement_groups = placement_groups + self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkInterfacePatch': - """Initialize a NetworkInterfacePatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'PlacementGroupCollection': + """Initialize a PlacementGroupCollection object from a json dictionary.""" args = {} - if 'allow_ip_spoofing' in _dict: - args['allow_ip_spoofing'] = _dict.get('allow_ip_spoofing') - if 'name' in _dict: - args['name'] = _dict.get('name') + if 'first' in _dict: + args['first'] = PlacementGroupCollectionFirst.from_dict(_dict.get('first')) + else: + raise ValueError('Required property \'first\' not present in PlacementGroupCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') + else: + raise ValueError('Required property \'limit\' not present in PlacementGroupCollection JSON') + if 'next' in _dict: + args['next'] = PlacementGroupCollectionNext.from_dict(_dict.get('next')) + if 'placement_groups' in _dict: + args['placement_groups'] = [PlacementGroup.from_dict(x) for x in _dict.get('placement_groups')] + else: + raise ValueError('Required property \'placement_groups\' not present in PlacementGroupCollection JSON') + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') + else: + raise ValueError('Required property \'total_count\' not present in PlacementGroupCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a NetworkInterfacePatch object from a json dictionary.""" + """Initialize a PlacementGroupCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'allow_ip_spoofing') and self.allow_ip_spoofing is not None: - _dict['allow_ip_spoofing'] = self.allow_ip_spoofing - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'placement_groups') and self.placement_groups is not None: + _dict['placement_groups'] = [x.to_dict() for x in self.placement_groups] + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count return _dict def _to_dict(self): @@ -45427,128 +49336,55 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this NetworkInterfacePatch object.""" + """Return a `str` version of this PlacementGroupCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'NetworkInterfacePatch') -> bool: + def __eq__(self, other: 'PlacementGroupCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'NetworkInterfacePatch') -> bool: + def __ne__(self, other: 'PlacementGroupCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class NetworkInterfacePrototype(): +class PlacementGroupCollectionFirst(): """ - NetworkInterfacePrototype. + A link to the first page of resources. - :attr bool allow_ip_spoofing: (optional) Indicates whether source IP spoofing is - allowed on this interface. If false, source IP spoofing is prevented on this - interface. If true, source IP spoofing is allowed on this interface. - :attr str name: (optional) The user-defined name for network interface. Names - must be unique within the instance the network interface resides in. If - unspecified, the name will be a hyphenated list of randomly-selected words. - :attr NetworkInterfaceIPPrototype primary_ip: (optional) The primary IP address - to bind to the network interface. This can be specified using - an existing reserved IP, or a prototype object for a new reserved IP. - If an existing reserved IP or a prototype object with an address is specified, - it must - be available on the network interface's subnet. Otherwise, an available address - on the - subnet will be automatically selected and reserved. - :attr List[SecurityGroupIdentity] security_groups: (optional) The security - groups to use for this network interface. If unspecified, the VPC's default - security group is used. - :attr SubnetIdentity subnet: The associated subnet. + :attr str href: The URL for a page of resources. """ def __init__(self, - subnet: 'SubnetIdentity', - *, - allow_ip_spoofing: bool = None, - name: str = None, - primary_ip: 'NetworkInterfaceIPPrototype' = None, - security_groups: List['SecurityGroupIdentity'] = None) -> None: + href: str) -> None: """ - Initialize a NetworkInterfacePrototype object. + Initialize a PlacementGroupCollectionFirst object. - :param SubnetIdentity subnet: The associated subnet. - :param bool allow_ip_spoofing: (optional) Indicates whether source IP - spoofing is allowed on this interface. If false, source IP spoofing is - prevented on this interface. If true, source IP spoofing is allowed on this - interface. - :param str name: (optional) The user-defined name for network interface. - Names must be unique within the instance the network interface resides in. - If unspecified, the name will be a hyphenated list of randomly-selected - words. - :param NetworkInterfaceIPPrototype primary_ip: (optional) The primary IP - address to bind to the network interface. This can be specified using - an existing reserved IP, or a prototype object for a new reserved IP. - If an existing reserved IP or a prototype object with an address is - specified, it must - be available on the network interface's subnet. Otherwise, an available - address on the - subnet will be automatically selected and reserved. - :param List[SecurityGroupIdentity] security_groups: (optional) The security - groups to use for this network interface. If unspecified, the VPC's default - security group is used. + :param str href: The URL for a page of resources. """ - self.allow_ip_spoofing = allow_ip_spoofing - self.name = name - self.primary_ip = primary_ip - self.security_groups = security_groups - self.subnet = subnet + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkInterfacePrototype': - """Initialize a NetworkInterfacePrototype object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'PlacementGroupCollectionFirst': + """Initialize a PlacementGroupCollectionFirst object from a json dictionary.""" args = {} - if 'allow_ip_spoofing' in _dict: - args['allow_ip_spoofing'] = _dict.get('allow_ip_spoofing') - if 'name' in _dict: - args['name'] = _dict.get('name') - if 'primary_ip' in _dict: - args['primary_ip'] = _dict.get('primary_ip') - if 'security_groups' in _dict: - args['security_groups'] = _dict.get('security_groups') - if 'subnet' in _dict: - args['subnet'] = _dict.get('subnet') + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'subnet\' not present in NetworkInterfacePrototype JSON') + raise ValueError('Required property \'href\' not present in PlacementGroupCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a NetworkInterfacePrototype object from a json dictionary.""" + """Initialize a PlacementGroupCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'allow_ip_spoofing') and self.allow_ip_spoofing is not None: - _dict['allow_ip_spoofing'] = self.allow_ip_spoofing - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'primary_ip') and self.primary_ip is not None: - if isinstance(self.primary_ip, dict): - _dict['primary_ip'] = self.primary_ip - else: - _dict['primary_ip'] = self.primary_ip.to_dict() - if hasattr(self, 'security_groups') and self.security_groups is not None: - security_groups_list = [] - for x in self.security_groups: - if isinstance(x, dict): - security_groups_list.append(x) - else: - security_groups_list.append(x.to_dict()) - _dict['security_groups'] = security_groups_list - if hasattr(self, 'subnet') and self.subnet is not None: - if isinstance(self.subnet, dict): - _dict['subnet'] = self.subnet - else: - _dict['subnet'] = self.subnet.to_dict() + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -45556,56 +49392,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this NetworkInterfacePrototype object.""" + """Return a `str` version of this PlacementGroupCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'NetworkInterfacePrototype') -> bool: + def __eq__(self, other: 'PlacementGroupCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'NetworkInterfacePrototype') -> bool: + def __ne__(self, other: 'PlacementGroupCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class NetworkInterfaceReferenceDeleted(): +class PlacementGroupCollectionNext(): """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. + A link to the next page of resources. This property is present for all pages except + the last page. - :attr str more_info: Link to documentation about deleted resources. + :attr str href: The URL for a page of resources. """ def __init__(self, - more_info: str) -> None: + href: str) -> None: """ - Initialize a NetworkInterfaceReferenceDeleted object. + Initialize a PlacementGroupCollectionNext object. - :param str more_info: Link to documentation about deleted resources. + :param str href: The URL for a page of resources. """ - self.more_info = more_info + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkInterfaceReferenceDeleted': - """Initialize a NetworkInterfaceReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'PlacementGroupCollectionNext': + """Initialize a PlacementGroupCollectionNext object from a json dictionary.""" args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'more_info\' not present in NetworkInterfaceReferenceDeleted JSON') + raise ValueError('Required property \'href\' not present in PlacementGroupCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a NetworkInterfaceReferenceDeleted object from a json dictionary.""" + """Initialize a PlacementGroupCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -45613,56 +49449,54 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this NetworkInterfaceReferenceDeleted object.""" + """Return a `str` version of this PlacementGroupCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'NetworkInterfaceReferenceDeleted') -> bool: + def __eq__(self, other: 'PlacementGroupCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'NetworkInterfaceReferenceDeleted') -> bool: + def __ne__(self, other: 'PlacementGroupCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class NetworkInterfaceReferenceTargetContextDeleted(): +class PlacementGroupPatch(): """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. + PlacementGroupPatch. - :attr str more_info: Link to documentation about deleted resources. + :attr str name: (optional) The user-defined name for this placement group. """ def __init__(self, - more_info: str) -> None: + *, + name: str = None) -> None: """ - Initialize a NetworkInterfaceReferenceTargetContextDeleted object. + Initialize a PlacementGroupPatch object. - :param str more_info: Link to documentation about deleted resources. + :param str name: (optional) The user-defined name for this placement group. """ - self.more_info = more_info + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkInterfaceReferenceTargetContextDeleted': - """Initialize a NetworkInterfaceReferenceTargetContextDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'PlacementGroupPatch': + """Initialize a PlacementGroupPatch object from a json dictionary.""" args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') - else: - raise ValueError('Required property \'more_info\' not present in NetworkInterfaceReferenceTargetContextDeleted JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a NetworkInterfaceReferenceTargetContextDeleted object from a json dictionary.""" + """Initialize a PlacementGroupPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -45670,57 +49504,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this NetworkInterfaceReferenceTargetContextDeleted object.""" + """Return a `str` version of this PlacementGroupPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'NetworkInterfaceReferenceTargetContextDeleted') -> bool: + def __eq__(self, other: 'PlacementGroupPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'NetworkInterfaceReferenceTargetContextDeleted') -> bool: + def __ne__(self, other: 'PlacementGroupPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class NetworkInterfaceUnpaginatedCollection(): +class PlacementGroupReferenceDeleted(): """ - NetworkInterfaceUnpaginatedCollection. + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. - :attr List[NetworkInterface] network_interfaces: Collection of network - interfaces. + :attr str more_info: Link to documentation about deleted resources. """ def __init__(self, - network_interfaces: List['NetworkInterface']) -> None: + more_info: str) -> None: """ - Initialize a NetworkInterfaceUnpaginatedCollection object. + Initialize a PlacementGroupReferenceDeleted object. - :param List[NetworkInterface] network_interfaces: Collection of network - interfaces. + :param str more_info: Link to documentation about deleted resources. """ - self.network_interfaces = network_interfaces + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'NetworkInterfaceUnpaginatedCollection': - """Initialize a NetworkInterfaceUnpaginatedCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'PlacementGroupReferenceDeleted': + """Initialize a PlacementGroupReferenceDeleted object from a json dictionary.""" args = {} - if 'network_interfaces' in _dict: - args['network_interfaces'] = [NetworkInterface.from_dict(x) for x in _dict.get('network_interfaces')] + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'network_interfaces\' not present in NetworkInterfaceUnpaginatedCollection JSON') + raise ValueError('Required property \'more_info\' not present in PlacementGroupReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a NetworkInterfaceUnpaginatedCollection object from a json dictionary.""" + """Initialize a PlacementGroupReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'network_interfaces') and self.network_interfaces is not None: - _dict['network_interfaces'] = [x.to_dict() for x in self.network_interfaces] + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -45728,129 +49561,161 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this NetworkInterfaceUnpaginatedCollection object.""" + """Return a `str` version of this PlacementGroupReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'NetworkInterfaceUnpaginatedCollection') -> bool: + def __eq__(self, other: 'PlacementGroupReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'NetworkInterfaceUnpaginatedCollection') -> bool: + def __ne__(self, other: 'PlacementGroupReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class OperatingSystem(): +class PublicGateway(): """ - OperatingSystem. + PublicGateway. - :attr str architecture: The operating system architecture. - :attr bool dedicated_host_only: Images with this operating system can only be - used on dedicated hosts or dedicated host groups. - :attr str display_name: A unique, display-friendly name for the operating - system. - :attr str family: The software family for this operating system. - :attr str href: The URL for this operating system. - :attr str name: The globally unique name for this operating system. - :attr str vendor: The vendor of the operating system. - :attr str version: The major release version of this operating system. + :attr datetime created_at: The date and time that the public gateway was + created. + :attr str crn: The CRN for this public gateway. + :attr PublicGatewayFloatingIp floating_ip: The floating IP bound to this public + gateway. + :attr str href: The URL for this public gateway. + :attr str id: The unique identifier for this public gateway. + :attr str name: The user-defined name for this public gateway. + :attr ResourceGroupReference resource_group: The resource group for this public + gateway. + :attr str resource_type: The resource type. + :attr str status: The status of the volume. + :attr VPCReference vpc: The VPC this public gateway serves. + :attr ZoneReference zone: The zone this public gateway resides in. """ def __init__(self, - architecture: str, - dedicated_host_only: bool, - display_name: str, - family: str, + created_at: datetime, + crn: str, + floating_ip: 'PublicGatewayFloatingIp', href: str, + id: str, name: str, - vendor: str, - version: str) -> None: + resource_group: 'ResourceGroupReference', + resource_type: str, + status: str, + vpc: 'VPCReference', + zone: 'ZoneReference') -> None: """ - Initialize a OperatingSystem object. + Initialize a PublicGateway object. - :param str architecture: The operating system architecture. - :param bool dedicated_host_only: Images with this operating system can only - be used on dedicated hosts or dedicated host groups. - :param str display_name: A unique, display-friendly name for the operating - system. - :param str family: The software family for this operating system. - :param str href: The URL for this operating system. - :param str name: The globally unique name for this operating system. - :param str vendor: The vendor of the operating system. - :param str version: The major release version of this operating system. + :param datetime created_at: The date and time that the public gateway was + created. + :param str crn: The CRN for this public gateway. + :param PublicGatewayFloatingIp floating_ip: The floating IP bound to this + public gateway. + :param str href: The URL for this public gateway. + :param str id: The unique identifier for this public gateway. + :param str name: The user-defined name for this public gateway. + :param ResourceGroupReference resource_group: The resource group for this + public gateway. + :param str resource_type: The resource type. + :param str status: The status of the volume. + :param VPCReference vpc: The VPC this public gateway serves. + :param ZoneReference zone: The zone this public gateway resides in. """ - self.architecture = architecture - self.dedicated_host_only = dedicated_host_only - self.display_name = display_name - self.family = family + self.created_at = created_at + self.crn = crn + self.floating_ip = floating_ip self.href = href + self.id = id self.name = name - self.vendor = vendor - self.version = version + self.resource_group = resource_group + self.resource_type = resource_type + self.status = status + self.vpc = vpc + self.zone = zone @classmethod - def from_dict(cls, _dict: Dict) -> 'OperatingSystem': - """Initialize a OperatingSystem object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'PublicGateway': + """Initialize a PublicGateway object from a json dictionary.""" args = {} - if 'architecture' in _dict: - args['architecture'] = _dict.get('architecture') - else: - raise ValueError('Required property \'architecture\' not present in OperatingSystem JSON') - if 'dedicated_host_only' in _dict: - args['dedicated_host_only'] = _dict.get('dedicated_host_only') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError('Required property \'dedicated_host_only\' not present in OperatingSystem JSON') - if 'display_name' in _dict: - args['display_name'] = _dict.get('display_name') + raise ValueError('Required property \'created_at\' not present in PublicGateway JSON') + if 'crn' in _dict: + args['crn'] = _dict.get('crn') else: - raise ValueError('Required property \'display_name\' not present in OperatingSystem JSON') - if 'family' in _dict: - args['family'] = _dict.get('family') + raise ValueError('Required property \'crn\' not present in PublicGateway JSON') + if 'floating_ip' in _dict: + args['floating_ip'] = PublicGatewayFloatingIp.from_dict(_dict.get('floating_ip')) else: - raise ValueError('Required property \'family\' not present in OperatingSystem JSON') + raise ValueError('Required property \'floating_ip\' not present in PublicGateway JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in OperatingSystem JSON') + raise ValueError('Required property \'href\' not present in PublicGateway JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in PublicGateway JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in OperatingSystem JSON') - if 'vendor' in _dict: - args['vendor'] = _dict.get('vendor') + raise ValueError('Required property \'name\' not present in PublicGateway JSON') + if 'resource_group' in _dict: + args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) else: - raise ValueError('Required property \'vendor\' not present in OperatingSystem JSON') - if 'version' in _dict: - args['version'] = _dict.get('version') + raise ValueError('Required property \'resource_group\' not present in PublicGateway JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') else: - raise ValueError('Required property \'version\' not present in OperatingSystem JSON') + raise ValueError('Required property \'resource_type\' not present in PublicGateway JSON') + if 'status' in _dict: + args['status'] = _dict.get('status') + else: + raise ValueError('Required property \'status\' not present in PublicGateway JSON') + if 'vpc' in _dict: + args['vpc'] = VPCReference.from_dict(_dict.get('vpc')) + else: + raise ValueError('Required property \'vpc\' not present in PublicGateway JSON') + if 'zone' in _dict: + args['zone'] = ZoneReference.from_dict(_dict.get('zone')) + else: + raise ValueError('Required property \'zone\' not present in PublicGateway JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a OperatingSystem object from a json dictionary.""" + """Initialize a PublicGateway object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'architecture') and self.architecture is not None: - _dict['architecture'] = self.architecture - if hasattr(self, 'dedicated_host_only') and self.dedicated_host_only is not None: - _dict['dedicated_host_only'] = self.dedicated_host_only - if hasattr(self, 'display_name') and self.display_name is not None: - _dict['display_name'] = self.display_name - if hasattr(self, 'family') and self.family is not None: - _dict['family'] = self.family + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'floating_ip') and self.floating_ip is not None: + _dict['floating_ip'] = self.floating_ip.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'vendor') and self.vendor is not None: - _dict['vendor'] = self.vendor - if hasattr(self, 'version') and self.version is not None: - _dict['version'] = self.version + if hasattr(self, 'resource_group') and self.resource_group is not None: + _dict['resource_group'] = self.resource_group.to_dict() + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'vpc') and self.vpc is not None: + _dict['vpc'] = self.vpc.to_dict() + if hasattr(self, 'zone') and self.zone is not None: + _dict['zone'] = self.zone.to_dict() return _dict def _to_dict(self): @@ -45858,80 +49723,103 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this OperatingSystem object.""" + """Return a `str` version of this PublicGateway object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'OperatingSystem') -> bool: + def __eq__(self, other: 'PublicGateway') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'OperatingSystem') -> bool: + def __ne__(self, other: 'PublicGateway') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class OperatingSystemCollection(): + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + PUBLIC_GATEWAY = 'public_gateway' + + + class StatusEnum(str, Enum): + """ + The status of the volume. + """ + AVAILABLE = 'available' + DELETING = 'deleting' + FAILED = 'failed' + PENDING = 'pending' + + +class PublicGatewayCollection(): """ - OperatingSystemCollection. + PublicGatewayCollection. - :attr OperatingSystemCollectionFirst first: A link to the first page of - resources. + :attr PublicGatewayCollectionFirst first: A link to the first page of resources. :attr int limit: The maximum number of resources that can be returned by the request. - :attr OperatingSystemCollectionNext next: (optional) A link to the next page of + :attr PublicGatewayCollectionNext next: (optional) A link to the next page of resources. This property is present for all pages except the last page. - :attr List[OperatingSystem] operating_systems: Collection of operating systems. + :attr List[PublicGateway] public_gateways: Collection of public gateways. + :attr int total_count: The total number of resources across all pages. """ def __init__(self, - first: 'OperatingSystemCollectionFirst', + first: 'PublicGatewayCollectionFirst', limit: int, - operating_systems: List['OperatingSystem'], + public_gateways: List['PublicGateway'], + total_count: int, *, - next: 'OperatingSystemCollectionNext' = None) -> None: + next: 'PublicGatewayCollectionNext' = None) -> None: """ - Initialize a OperatingSystemCollection object. + Initialize a PublicGatewayCollection object. - :param OperatingSystemCollectionFirst first: A link to the first page of + :param PublicGatewayCollectionFirst first: A link to the first page of resources. :param int limit: The maximum number of resources that can be returned by the request. - :param List[OperatingSystem] operating_systems: Collection of operating - systems. - :param OperatingSystemCollectionNext next: (optional) A link to the next - page of resources. This property is present for all pages + :param List[PublicGateway] public_gateways: Collection of public gateways. + :param int total_count: The total number of resources across all pages. + :param PublicGatewayCollectionNext next: (optional) A link to the next page + of resources. This property is present for all pages except the last page. """ self.first = first self.limit = limit self.next = next - self.operating_systems = operating_systems + self.public_gateways = public_gateways + self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'OperatingSystemCollection': - """Initialize a OperatingSystemCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'PublicGatewayCollection': + """Initialize a PublicGatewayCollection object from a json dictionary.""" args = {} if 'first' in _dict: - args['first'] = OperatingSystemCollectionFirst.from_dict(_dict.get('first')) + args['first'] = PublicGatewayCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'first\' not present in OperatingSystemCollection JSON') + raise ValueError('Required property \'first\' not present in PublicGatewayCollection JSON') if 'limit' in _dict: args['limit'] = _dict.get('limit') else: - raise ValueError('Required property \'limit\' not present in OperatingSystemCollection JSON') + raise ValueError('Required property \'limit\' not present in PublicGatewayCollection JSON') if 'next' in _dict: - args['next'] = OperatingSystemCollectionNext.from_dict(_dict.get('next')) - if 'operating_systems' in _dict: - args['operating_systems'] = [OperatingSystem.from_dict(x) for x in _dict.get('operating_systems')] + args['next'] = PublicGatewayCollectionNext.from_dict(_dict.get('next')) + if 'public_gateways' in _dict: + args['public_gateways'] = [PublicGateway.from_dict(x) for x in _dict.get('public_gateways')] else: - raise ValueError('Required property \'operating_systems\' not present in OperatingSystemCollection JSON') + raise ValueError('Required property \'public_gateways\' not present in PublicGatewayCollection JSON') + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') + else: + raise ValueError('Required property \'total_count\' not present in PublicGatewayCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a OperatingSystemCollection object from a json dictionary.""" + """Initialize a PublicGatewayCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -45943,8 +49831,10 @@ def to_dict(self) -> Dict: _dict['limit'] = self.limit if hasattr(self, 'next') and self.next is not None: _dict['next'] = self.next.to_dict() - if hasattr(self, 'operating_systems') and self.operating_systems is not None: - _dict['operating_systems'] = [x.to_dict() for x in self.operating_systems] + if hasattr(self, 'public_gateways') and self.public_gateways is not None: + _dict['public_gateways'] = [x.to_dict() for x in self.public_gateways] + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count return _dict def _to_dict(self): @@ -45952,20 +49842,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this OperatingSystemCollection object.""" + """Return a `str` version of this PublicGatewayCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'OperatingSystemCollection') -> bool: + def __eq__(self, other: 'PublicGatewayCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'OperatingSystemCollection') -> bool: + def __ne__(self, other: 'PublicGatewayCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class OperatingSystemCollectionFirst(): +class PublicGatewayCollectionFirst(): """ A link to the first page of resources. @@ -45975,25 +49865,25 @@ class OperatingSystemCollectionFirst(): def __init__(self, href: str) -> None: """ - Initialize a OperatingSystemCollectionFirst object. + Initialize a PublicGatewayCollectionFirst object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'OperatingSystemCollectionFirst': - """Initialize a OperatingSystemCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'PublicGatewayCollectionFirst': + """Initialize a PublicGatewayCollectionFirst object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in OperatingSystemCollectionFirst JSON') + raise ValueError('Required property \'href\' not present in PublicGatewayCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a OperatingSystemCollectionFirst object from a json dictionary.""" + """Initialize a PublicGatewayCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -46008,20 +49898,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this OperatingSystemCollectionFirst object.""" + """Return a `str` version of this PublicGatewayCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'OperatingSystemCollectionFirst') -> bool: + def __eq__(self, other: 'PublicGatewayCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'OperatingSystemCollectionFirst') -> bool: + def __ne__(self, other: 'PublicGatewayCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class OperatingSystemCollectionNext(): +class PublicGatewayCollectionNext(): """ A link to the next page of resources. This property is present for all pages except the last page. @@ -46032,25 +49922,25 @@ class OperatingSystemCollectionNext(): def __init__(self, href: str) -> None: """ - Initialize a OperatingSystemCollectionNext object. + Initialize a PublicGatewayCollectionNext object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'OperatingSystemCollectionNext': - """Initialize a OperatingSystemCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'PublicGatewayCollectionNext': + """Initialize a PublicGatewayCollectionNext object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in OperatingSystemCollectionNext JSON') + raise ValueError('Required property \'href\' not present in PublicGatewayCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a OperatingSystemCollectionNext object from a json dictionary.""" + """Initialize a PublicGatewayCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -46065,78 +49955,121 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this OperatingSystemCollectionNext object.""" + """Return a `str` version of this PublicGatewayCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'OperatingSystemCollectionNext') -> bool: + def __eq__(self, other: 'PublicGatewayCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'OperatingSystemCollectionNext') -> bool: + def __ne__(self, other: 'PublicGatewayCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class OperatingSystemIdentity(): +class PublicGatewayFloatingIPPrototype(): """ - Identifies an operating system by a unique property. + PublicGatewayFloatingIPPrototype. """ def __init__(self) -> None: """ - Initialize a OperatingSystemIdentity object. + Initialize a PublicGatewayFloatingIPPrototype object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['OperatingSystemIdentityByName', 'OperatingSystemIdentityByHref'])) + ", ".join(['PublicGatewayFloatingIPPrototypeFloatingIPIdentity', 'PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext'])) raise Exception(msg) -class OperatingSystemReference(): +class PublicGatewayFloatingIp(): """ - OperatingSystemReference. + The floating IP bound to this public gateway. - :attr str href: The URL for this operating system. - :attr str name: The globally unique name for this operating system. + :attr str address: The globally unique IP address. + :attr str crn: The CRN for this floating IP. + :attr FloatingIPReferenceDeleted deleted: (optional) If present, this property + indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str href: The URL for this floating IP. + :attr str id: The unique identifier for this floating IP. + :attr str name: The unique user-defined name for this floating IP. """ def __init__(self, + address: str, + crn: str, href: str, - name: str) -> None: + id: str, + name: str, + *, + deleted: 'FloatingIPReferenceDeleted' = None) -> None: """ - Initialize a OperatingSystemReference object. + Initialize a PublicGatewayFloatingIp object. - :param str href: The URL for this operating system. - :param str name: The globally unique name for this operating system. + :param str address: The globally unique IP address. + :param str crn: The CRN for this floating IP. + :param str href: The URL for this floating IP. + :param str id: The unique identifier for this floating IP. + :param str name: The unique user-defined name for this floating IP. + :param FloatingIPReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides + some supplementary information. """ + self.address = address + self.crn = crn + self.deleted = deleted self.href = href + self.id = id self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'OperatingSystemReference': - """Initialize a OperatingSystemReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'PublicGatewayFloatingIp': + """Initialize a PublicGatewayFloatingIp object from a json dictionary.""" args = {} + if 'address' in _dict: + args['address'] = _dict.get('address') + else: + raise ValueError('Required property \'address\' not present in PublicGatewayFloatingIp JSON') + if 'crn' in _dict: + args['crn'] = _dict.get('crn') + else: + raise ValueError('Required property \'crn\' not present in PublicGatewayFloatingIp JSON') + if 'deleted' in _dict: + args['deleted'] = FloatingIPReferenceDeleted.from_dict(_dict.get('deleted')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in OperatingSystemReference JSON') + raise ValueError('Required property \'href\' not present in PublicGatewayFloatingIp JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in PublicGatewayFloatingIp JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in OperatingSystemReference JSON') + raise ValueError('Required property \'name\' not present in PublicGatewayFloatingIp JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a OperatingSystemReference object from a json dictionary.""" + """Initialize a PublicGatewayFloatingIp object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'address') and self.address is not None: + _dict['address'] = self.address + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name return _dict @@ -46146,151 +50079,71 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this OperatingSystemReference object.""" + """Return a `str` version of this PublicGatewayFloatingIp object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'OperatingSystemReference') -> bool: + def __eq__(self, other: 'PublicGatewayFloatingIp') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'OperatingSystemReference') -> bool: + def __ne__(self, other: 'PublicGatewayFloatingIp') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class PlacementGroup(): +class PublicGatewayIdentity(): """ - PlacementGroup. + Identifies a public gateway by a unique property. - :attr datetime created_at: The date and time that the placement group was - created. - :attr str crn: The CRN for this placement group. - :attr str href: The URL for this placement group. - :attr str id: The unique identifier for this placement group. - :attr str lifecycle_state: The lifecycle state of the placement group. - :attr str name: The user-defined name for this placement group. - :attr ResourceGroupReference resource_group: The resource group for this - placement group. - :attr str resource_type: The resource type. - :attr str strategy: The strategy for this placement group - - `host_spread`: place on different compute hosts - - `power_spread`: place on compute hosts that use different power sources - The enumerated values for this property may expand in the future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the placement group on which the - unexpected strategy was encountered. + """ + + def __init__(self) -> None: + """ + Initialize a PublicGatewayIdentity object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['PublicGatewayIdentityPublicGatewayIdentityById', 'PublicGatewayIdentityPublicGatewayIdentityByCRN', 'PublicGatewayIdentityPublicGatewayIdentityByHref'])) + raise Exception(msg) + +class PublicGatewayPatch(): + """ + PublicGatewayPatch. + + :attr str name: (optional) The user-defined name for this public gateway. Names + must be unique within the VPC the public gateway resides in. """ def __init__(self, - created_at: datetime, - crn: str, - href: str, - id: str, - lifecycle_state: str, - name: str, - resource_group: 'ResourceGroupReference', - resource_type: str, - strategy: str) -> None: + *, + name: str = None) -> None: """ - Initialize a PlacementGroup object. + Initialize a PublicGatewayPatch object. - :param datetime created_at: The date and time that the placement group was - created. - :param str crn: The CRN for this placement group. - :param str href: The URL for this placement group. - :param str id: The unique identifier for this placement group. - :param str lifecycle_state: The lifecycle state of the placement group. - :param str name: The user-defined name for this placement group. - :param ResourceGroupReference resource_group: The resource group for this - placement group. - :param str resource_type: The resource type. - :param str strategy: The strategy for this placement group - - `host_spread`: place on different compute hosts - - `power_spread`: place on compute hosts that use different power sources - The enumerated values for this property may expand in the future. When - processing this property, check for and log unknown values. Optionally halt - processing and surface the error, or bypass the placement group on which - the unexpected strategy was encountered. + :param str name: (optional) The user-defined name for this public gateway. + Names must be unique within the VPC the public gateway resides in. """ - self.created_at = created_at - self.crn = crn - self.href = href - self.id = id - self.lifecycle_state = lifecycle_state self.name = name - self.resource_group = resource_group - self.resource_type = resource_type - self.strategy = strategy @classmethod - def from_dict(cls, _dict: Dict) -> 'PlacementGroup': - """Initialize a PlacementGroup object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'PublicGatewayPatch': + """Initialize a PublicGatewayPatch object from a json dictionary.""" args = {} - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - else: - raise ValueError('Required property \'created_at\' not present in PlacementGroup JSON') - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in PlacementGroup JSON') - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in PlacementGroup JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in PlacementGroup JSON') - if 'lifecycle_state' in _dict: - args['lifecycle_state'] = _dict.get('lifecycle_state') - else: - raise ValueError('Required property \'lifecycle_state\' not present in PlacementGroup JSON') if 'name' in _dict: args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in PlacementGroup JSON') - if 'resource_group' in _dict: - args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) - else: - raise ValueError('Required property \'resource_group\' not present in PlacementGroup JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in PlacementGroup JSON') - if 'strategy' in _dict: - args['strategy'] = _dict.get('strategy') - else: - raise ValueError('Required property \'strategy\' not present in PlacementGroup JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a PlacementGroup object from a json dictionary.""" + """Initialize a PublicGatewayPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'lifecycle_state') and self.lifecycle_state is not None: - _dict['lifecycle_state'] = self.lifecycle_state if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'resource_group') and self.resource_group is not None: - _dict['resource_group'] = self.resource_group.to_dict() - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type - if hasattr(self, 'strategy') and self.strategy is not None: - _dict['strategy'] = self.strategy return _dict def _to_dict(self): @@ -46298,137 +50151,108 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this PlacementGroup object.""" + """Return a `str` version of this PublicGatewayPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'PlacementGroup') -> bool: + def __eq__(self, other: 'PublicGatewayPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'PlacementGroup') -> bool: + def __ne__(self, other: 'PublicGatewayPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class LifecycleStateEnum(str, Enum): - """ - The lifecycle state of the placement group. - """ - DELETING = 'deleting' - FAILED = 'failed' - PENDING = 'pending' - STABLE = 'stable' - SUSPENDED = 'suspended' - UPDATING = 'updating' - WAITING = 'waiting' - - - class ResourceTypeEnum(str, Enum): - """ - The resource type. - """ - PLACEMENT_GROUP = 'placement_group' - - - class StrategyEnum(str, Enum): - """ - The strategy for this placement group - - `host_spread`: place on different compute hosts - - `power_spread`: place on compute hosts that use different power sources - The enumerated values for this property may expand in the future. When processing - this property, check for and log unknown values. Optionally halt processing and - surface the error, or bypass the placement group on which the unexpected strategy - was encountered. - """ - HOST_SPREAD = 'host_spread' - POWER_SPREAD = 'power_spread' - - -class PlacementGroupCollection(): +class PublicGatewayReference(): """ - PlacementGroupCollection. + PublicGatewayReference. - :attr PlacementGroupCollectionFirst first: A link to the first page of - resources. - :attr int limit: The maximum number of resources that can be returned by the - request. - :attr PlacementGroupCollectionNext next: (optional) A link to the next page of - resources. This property is present for all pages - except the last page. - :attr List[PlacementGroup] placement_groups: Collection of placement groups. - :attr int total_count: The total number of resources across all pages. + :attr str crn: The CRN for this public gateway. + :attr PublicGatewayReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str href: The URL for this public gateway. + :attr str id: The unique identifier for this public gateway. + :attr str name: The user-defined name for this public gateway. + :attr str resource_type: The resource type. """ def __init__(self, - first: 'PlacementGroupCollectionFirst', - limit: int, - placement_groups: List['PlacementGroup'], - total_count: int, + crn: str, + href: str, + id: str, + name: str, + resource_type: str, *, - next: 'PlacementGroupCollectionNext' = None) -> None: + deleted: 'PublicGatewayReferenceDeleted' = None) -> None: """ - Initialize a PlacementGroupCollection object. + Initialize a PublicGatewayReference object. - :param PlacementGroupCollectionFirst first: A link to the first page of - resources. - :param int limit: The maximum number of resources that can be returned by - the request. - :param List[PlacementGroup] placement_groups: Collection of placement - groups. - :param int total_count: The total number of resources across all pages. - :param PlacementGroupCollectionNext next: (optional) A link to the next - page of resources. This property is present for all pages - except the last page. + :param str crn: The CRN for this public gateway. + :param str href: The URL for this public gateway. + :param str id: The unique identifier for this public gateway. + :param str name: The user-defined name for this public gateway. + :param str resource_type: The resource type. + :param PublicGatewayReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides + some supplementary information. """ - self.first = first - self.limit = limit - self.next = next - self.placement_groups = placement_groups - self.total_count = total_count + self.crn = crn + self.deleted = deleted + self.href = href + self.id = id + self.name = name + self.resource_type = resource_type @classmethod - def from_dict(cls, _dict: Dict) -> 'PlacementGroupCollection': - """Initialize a PlacementGroupCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'PublicGatewayReference': + """Initialize a PublicGatewayReference object from a json dictionary.""" args = {} - if 'first' in _dict: - args['first'] = PlacementGroupCollectionFirst.from_dict(_dict.get('first')) + if 'crn' in _dict: + args['crn'] = _dict.get('crn') else: - raise ValueError('Required property \'first\' not present in PlacementGroupCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') + raise ValueError('Required property \'crn\' not present in PublicGatewayReference JSON') + if 'deleted' in _dict: + args['deleted'] = PublicGatewayReferenceDeleted.from_dict(_dict.get('deleted')) + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'limit\' not present in PlacementGroupCollection JSON') - if 'next' in _dict: - args['next'] = PlacementGroupCollectionNext.from_dict(_dict.get('next')) - if 'placement_groups' in _dict: - args['placement_groups'] = [PlacementGroup.from_dict(x) for x in _dict.get('placement_groups')] + raise ValueError('Required property \'href\' not present in PublicGatewayReference JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') else: - raise ValueError('Required property \'placement_groups\' not present in PlacementGroupCollection JSON') - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') + raise ValueError('Required property \'id\' not present in PublicGatewayReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') else: - raise ValueError('Required property \'total_count\' not present in PlacementGroupCollection JSON') + raise ValueError('Required property \'name\' not present in PublicGatewayReference JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in PublicGatewayReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a PlacementGroupCollection object from a json dictionary.""" + """Initialize a PublicGatewayReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'placement_groups') and self.placement_groups is not None: - _dict['placement_groups'] = [x.to_dict() for x in self.placement_groups] - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type return _dict def _to_dict(self): @@ -46436,55 +50260,63 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this PlacementGroupCollection object.""" + """Return a `str` version of this PublicGatewayReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'PlacementGroupCollection') -> bool: + def __eq__(self, other: 'PublicGatewayReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'PlacementGroupCollection') -> bool: + def __ne__(self, other: 'PublicGatewayReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class PlacementGroupCollectionFirst(): + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + PUBLIC_GATEWAY = 'public_gateway' + + +class PublicGatewayReferenceDeleted(): """ - A link to the first page of resources. + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. - :attr str href: The URL for a page of resources. + :attr str more_info: Link to documentation about deleted resources. """ def __init__(self, - href: str) -> None: + more_info: str) -> None: """ - Initialize a PlacementGroupCollectionFirst object. + Initialize a PublicGatewayReferenceDeleted object. - :param str href: The URL for a page of resources. + :param str more_info: Link to documentation about deleted resources. """ - self.href = href + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'PlacementGroupCollectionFirst': - """Initialize a PlacementGroupCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'PublicGatewayReferenceDeleted': + """Initialize a PublicGatewayReferenceDeleted object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'href\' not present in PlacementGroupCollectionFirst JSON') + raise ValueError('Required property \'more_info\' not present in PublicGatewayReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a PlacementGroupCollectionFirst object from a json dictionary.""" + """Initialize a PublicGatewayReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -46492,56 +50324,85 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this PlacementGroupCollectionFirst object.""" + """Return a `str` version of this PublicGatewayReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'PlacementGroupCollectionFirst') -> bool: + def __eq__(self, other: 'PublicGatewayReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'PlacementGroupCollectionFirst') -> bool: + def __ne__(self, other: 'PublicGatewayReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class PlacementGroupCollectionNext(): +class Region(): """ - A link to the next page of resources. This property is present for all pages except - the last page. + Region. - :attr str href: The URL for a page of resources. + :attr str endpoint: The API endpoint for this region. + :attr str href: The URL for this region. + :attr str name: The globally unique name for this region. + :attr str status: The availability status of this region. """ def __init__(self, - href: str) -> None: + endpoint: str, + href: str, + name: str, + status: str) -> None: """ - Initialize a PlacementGroupCollectionNext object. + Initialize a Region object. - :param str href: The URL for a page of resources. + :param str endpoint: The API endpoint for this region. + :param str href: The URL for this region. + :param str name: The globally unique name for this region. + :param str status: The availability status of this region. """ + self.endpoint = endpoint self.href = href + self.name = name + self.status = status @classmethod - def from_dict(cls, _dict: Dict) -> 'PlacementGroupCollectionNext': - """Initialize a PlacementGroupCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'Region': + """Initialize a Region object from a json dictionary.""" args = {} + if 'endpoint' in _dict: + args['endpoint'] = _dict.get('endpoint') + else: + raise ValueError('Required property \'endpoint\' not present in Region JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in PlacementGroupCollectionNext JSON') + raise ValueError('Required property \'href\' not present in Region JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in Region JSON') + if 'status' in _dict: + args['status'] = _dict.get('status') + else: + raise ValueError('Required property \'status\' not present in Region JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a PlacementGroupCollectionNext object from a json dictionary.""" + """Initialize a Region object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'endpoint') and self.endpoint is not None: + _dict['endpoint'] = self.endpoint if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status return _dict def _to_dict(self): @@ -46549,54 +50410,63 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this PlacementGroupCollectionNext object.""" + """Return a `str` version of this Region object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'PlacementGroupCollectionNext') -> bool: + def __eq__(self, other: 'Region') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'PlacementGroupCollectionNext') -> bool: + def __ne__(self, other: 'Region') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class PlacementGroupPatch(): + class StatusEnum(str, Enum): + """ + The availability status of this region. + """ + AVAILABLE = 'available' + UNAVAILABLE = 'unavailable' + + +class RegionCollection(): """ - PlacementGroupPatch. + RegionCollection. - :attr str name: (optional) The user-defined name for this placement group. + :attr List[Region] regions: Collection of regions. """ def __init__(self, - *, - name: str = None) -> None: + regions: List['Region']) -> None: """ - Initialize a PlacementGroupPatch object. + Initialize a RegionCollection object. - :param str name: (optional) The user-defined name for this placement group. + :param List[Region] regions: Collection of regions. """ - self.name = name + self.regions = regions @classmethod - def from_dict(cls, _dict: Dict) -> 'PlacementGroupPatch': - """Initialize a PlacementGroupPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RegionCollection': + """Initialize a RegionCollection object from a json dictionary.""" args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') + if 'regions' in _dict: + args['regions'] = [Region.from_dict(x) for x in _dict.get('regions')] + else: + raise ValueError('Required property \'regions\' not present in RegionCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a PlacementGroupPatch object from a json dictionary.""" + """Initialize a RegionCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name + if hasattr(self, 'regions') and self.regions is not None: + _dict['regions'] = [x.to_dict() for x in self.regions] return _dict def _to_dict(self): @@ -46604,56 +50474,65 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this PlacementGroupPatch object.""" + """Return a `str` version of this RegionCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'PlacementGroupPatch') -> bool: + def __eq__(self, other: 'RegionCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'PlacementGroupPatch') -> bool: + def __ne__(self, other: 'RegionCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class PlacementGroupReferenceDeleted(): +class RegionReference(): """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. + RegionReference. - :attr str more_info: Link to documentation about deleted resources. + :attr str href: The URL for this region. + :attr str name: The globally unique name for this region. """ def __init__(self, - more_info: str) -> None: + href: str, + name: str) -> None: """ - Initialize a PlacementGroupReferenceDeleted object. + Initialize a RegionReference object. - :param str more_info: Link to documentation about deleted resources. + :param str href: The URL for this region. + :param str name: The globally unique name for this region. """ - self.more_info = more_info + self.href = href + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'PlacementGroupReferenceDeleted': - """Initialize a PlacementGroupReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RegionReference': + """Initialize a RegionReference object from a json dictionary.""" args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'more_info\' not present in PlacementGroupReferenceDeleted JSON') + raise ValueError('Required property \'href\' not present in RegionReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in RegionReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a PlacementGroupReferenceDeleted object from a json dictionary.""" + """Initialize a RegionReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -46661,161 +50540,166 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this PlacementGroupReferenceDeleted object.""" + """Return a `str` version of this RegionReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'PlacementGroupReferenceDeleted') -> bool: + def __eq__(self, other: 'RegionReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'PlacementGroupReferenceDeleted') -> bool: + def __ne__(self, other: 'RegionReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class PublicGateway(): +class ReservedIP(): """ - PublicGateway. + ReservedIP. - :attr datetime created_at: The date and time that the public gateway was - created. - :attr str crn: The CRN for this public gateway. - :attr PublicGatewayFloatingIp floating_ip: The floating IP bound to this public - gateway. - :attr str href: The URL for this public gateway. - :attr str id: The unique identifier for this public gateway. - :attr str name: The user-defined name for this public gateway. - :attr ResourceGroupReference resource_group: The resource group for this public - gateway. + :attr str address: The IP address. + If the address has not yet been selected, the value will be `0.0.0.0`. + This property may add support for IPv6 addresses in the future. When processing + a value in this property, verify that the address is in an expected format. If + it is not, log an error. Optionally halt processing and surface the error, or + bypass the resource on which the unexpected IP address format was encountered. + :attr bool auto_delete: Indicates whether this reserved IP member will be + automatically deleted when either + `target` is deleted, or the reserved IP is unbound. + :attr datetime created_at: The date and time that the reserved IP was created. + :attr str href: The URL for this reserved IP. + :attr str id: The unique identifier for this reserved IP. + :attr str lifecycle_state: The lifecycle state of the reserved IP. + :attr str name: The user-defined or system-provided name for this reserved IP. + :attr str owner: The owner of the reserved IP. :attr str resource_type: The resource type. - :attr str status: The status of the volume. - :attr VPCReference vpc: The VPC this public gateway serves. - :attr ZoneReference zone: The zone this public gateway resides in. + :attr ReservedIPTarget target: (optional) The target of this reserved IP. + If absent, this reserved IP is provider-owned or unbound. """ def __init__(self, + address: str, + auto_delete: bool, created_at: datetime, - crn: str, - floating_ip: 'PublicGatewayFloatingIp', href: str, id: str, + lifecycle_state: str, name: str, - resource_group: 'ResourceGroupReference', + owner: str, resource_type: str, - status: str, - vpc: 'VPCReference', - zone: 'ZoneReference') -> None: + *, + target: 'ReservedIPTarget' = None) -> None: """ - Initialize a PublicGateway object. + Initialize a ReservedIP object. - :param datetime created_at: The date and time that the public gateway was + :param str address: The IP address. + If the address has not yet been selected, the value will be `0.0.0.0`. + This property may add support for IPv6 addresses in the future. When + processing a value in this property, verify that the address is in an + expected format. If it is not, log an error. Optionally halt processing and + surface the error, or bypass the resource on which the unexpected IP + address format was encountered. + :param bool auto_delete: Indicates whether this reserved IP member will be + automatically deleted when either + `target` is deleted, or the reserved IP is unbound. + :param datetime created_at: The date and time that the reserved IP was created. - :param str crn: The CRN for this public gateway. - :param PublicGatewayFloatingIp floating_ip: The floating IP bound to this - public gateway. - :param str href: The URL for this public gateway. - :param str id: The unique identifier for this public gateway. - :param str name: The user-defined name for this public gateway. - :param ResourceGroupReference resource_group: The resource group for this - public gateway. + :param str href: The URL for this reserved IP. + :param str id: The unique identifier for this reserved IP. + :param str lifecycle_state: The lifecycle state of the reserved IP. + :param str name: The user-defined or system-provided name for this reserved + IP. + :param str owner: The owner of the reserved IP. :param str resource_type: The resource type. - :param str status: The status of the volume. - :param VPCReference vpc: The VPC this public gateway serves. - :param ZoneReference zone: The zone this public gateway resides in. + :param ReservedIPTarget target: (optional) The target of this reserved IP. + If absent, this reserved IP is provider-owned or unbound. """ + self.address = address + self.auto_delete = auto_delete self.created_at = created_at - self.crn = crn - self.floating_ip = floating_ip self.href = href self.id = id + self.lifecycle_state = lifecycle_state self.name = name - self.resource_group = resource_group + self.owner = owner self.resource_type = resource_type - self.status = status - self.vpc = vpc - self.zone = zone + self.target = target @classmethod - def from_dict(cls, _dict: Dict) -> 'PublicGateway': - """Initialize a PublicGateway object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ReservedIP': + """Initialize a ReservedIP object from a json dictionary.""" args = {} - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) + if 'address' in _dict: + args['address'] = _dict.get('address') else: - raise ValueError('Required property \'created_at\' not present in PublicGateway JSON') - if 'crn' in _dict: - args['crn'] = _dict.get('crn') + raise ValueError('Required property \'address\' not present in ReservedIP JSON') + if 'auto_delete' in _dict: + args['auto_delete'] = _dict.get('auto_delete') else: - raise ValueError('Required property \'crn\' not present in PublicGateway JSON') - if 'floating_ip' in _dict: - args['floating_ip'] = PublicGatewayFloatingIp.from_dict(_dict.get('floating_ip')) + raise ValueError('Required property \'auto_delete\' not present in ReservedIP JSON') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError('Required property \'floating_ip\' not present in PublicGateway JSON') + raise ValueError('Required property \'created_at\' not present in ReservedIP JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in PublicGateway JSON') + raise ValueError('Required property \'href\' not present in ReservedIP JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in PublicGateway JSON') + raise ValueError('Required property \'id\' not present in ReservedIP JSON') + if 'lifecycle_state' in _dict: + args['lifecycle_state'] = _dict.get('lifecycle_state') + else: + raise ValueError('Required property \'lifecycle_state\' not present in ReservedIP JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in PublicGateway JSON') - if 'resource_group' in _dict: - args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) + raise ValueError('Required property \'name\' not present in ReservedIP JSON') + if 'owner' in _dict: + args['owner'] = _dict.get('owner') else: - raise ValueError('Required property \'resource_group\' not present in PublicGateway JSON') + raise ValueError('Required property \'owner\' not present in ReservedIP JSON') if 'resource_type' in _dict: args['resource_type'] = _dict.get('resource_type') else: - raise ValueError('Required property \'resource_type\' not present in PublicGateway JSON') - if 'status' in _dict: - args['status'] = _dict.get('status') - else: - raise ValueError('Required property \'status\' not present in PublicGateway JSON') - if 'vpc' in _dict: - args['vpc'] = VPCReference.from_dict(_dict.get('vpc')) - else: - raise ValueError('Required property \'vpc\' not present in PublicGateway JSON') - if 'zone' in _dict: - args['zone'] = ZoneReference.from_dict(_dict.get('zone')) - else: - raise ValueError('Required property \'zone\' not present in PublicGateway JSON') + raise ValueError('Required property \'resource_type\' not present in ReservedIP JSON') + if 'target' in _dict: + args['target'] = _dict.get('target') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a PublicGateway object from a json dictionary.""" + """Initialize a ReservedIP object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'address') and self.address is not None: + _dict['address'] = self.address + if hasattr(self, 'auto_delete') and self.auto_delete is not None: + _dict['auto_delete'] = self.auto_delete if hasattr(self, 'created_at') and self.created_at is not None: _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - if hasattr(self, 'floating_ip') and self.floating_ip is not None: - _dict['floating_ip'] = self.floating_ip.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id + if hasattr(self, 'lifecycle_state') and self.lifecycle_state is not None: + _dict['lifecycle_state'] = self.lifecycle_state if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'resource_group') and self.resource_group is not None: - _dict['resource_group'] = self.resource_group.to_dict() + if hasattr(self, 'owner') and self.owner is not None: + _dict['owner'] = self.owner if hasattr(self, 'resource_type') and self.resource_type is not None: _dict['resource_type'] = self.resource_type - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status - if hasattr(self, 'vpc') and self.vpc is not None: - _dict['vpc'] = self.vpc.to_dict() - if hasattr(self, 'zone') and self.zone is not None: - _dict['zone'] = self.zone.to_dict() + if hasattr(self, 'target') and self.target is not None: + if isinstance(self.target, dict): + _dict['target'] = self.target + else: + _dict['target'] = self.target.to_dict() return _dict def _to_dict(self): @@ -46823,103 +50707,115 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this PublicGateway object.""" + """Return a `str` version of this ReservedIP object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'PublicGateway') -> bool: + def __eq__(self, other: 'ReservedIP') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'PublicGateway') -> bool: + def __ne__(self, other: 'ReservedIP') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ResourceTypeEnum(str, Enum): + class LifecycleStateEnum(str, Enum): """ - The resource type. + The lifecycle state of the reserved IP. """ - PUBLIC_GATEWAY = 'public_gateway' + DELETING = 'deleting' + FAILED = 'failed' + PENDING = 'pending' + STABLE = 'stable' + SUSPENDED = 'suspended' + UPDATING = 'updating' + WAITING = 'waiting' - class StatusEnum(str, Enum): + class OwnerEnum(str, Enum): """ - The status of the volume. + The owner of the reserved IP. """ - AVAILABLE = 'available' - DELETING = 'deleting' - FAILED = 'failed' - PENDING = 'pending' + PROVIDER = 'provider' + USER = 'user' -class PublicGatewayCollection(): + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + SUBNET_RESERVED_IP = 'subnet_reserved_ip' + + +class ReservedIPCollection(): """ - PublicGatewayCollection. + ReservedIPCollection. - :attr PublicGatewayCollectionFirst first: A link to the first page of resources. + :attr ReservedIPCollectionFirst first: A link to the first page of resources. :attr int limit: The maximum number of resources that can be returned by the request. - :attr PublicGatewayCollectionNext next: (optional) A link to the next page of + :attr ReservedIPCollectionNext next: (optional) A link to the next page of resources. This property is present for all pages except the last page. - :attr List[PublicGateway] public_gateways: Collection of public gateways. + :attr List[ReservedIP] reserved_ips: Collection of reserved IPs in this subnet. :attr int total_count: The total number of resources across all pages. """ def __init__(self, - first: 'PublicGatewayCollectionFirst', + first: 'ReservedIPCollectionFirst', limit: int, - public_gateways: List['PublicGateway'], + reserved_ips: List['ReservedIP'], total_count: int, *, - next: 'PublicGatewayCollectionNext' = None) -> None: + next: 'ReservedIPCollectionNext' = None) -> None: """ - Initialize a PublicGatewayCollection object. + Initialize a ReservedIPCollection object. - :param PublicGatewayCollectionFirst first: A link to the first page of + :param ReservedIPCollectionFirst first: A link to the first page of resources. :param int limit: The maximum number of resources that can be returned by the request. - :param List[PublicGateway] public_gateways: Collection of public gateways. + :param List[ReservedIP] reserved_ips: Collection of reserved IPs in this + subnet. :param int total_count: The total number of resources across all pages. - :param PublicGatewayCollectionNext next: (optional) A link to the next page - of resources. This property is present for all pages + :param ReservedIPCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages except the last page. """ self.first = first self.limit = limit self.next = next - self.public_gateways = public_gateways + self.reserved_ips = reserved_ips self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'PublicGatewayCollection': - """Initialize a PublicGatewayCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ReservedIPCollection': + """Initialize a ReservedIPCollection object from a json dictionary.""" args = {} if 'first' in _dict: - args['first'] = PublicGatewayCollectionFirst.from_dict(_dict.get('first')) + args['first'] = ReservedIPCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'first\' not present in PublicGatewayCollection JSON') + raise ValueError('Required property \'first\' not present in ReservedIPCollection JSON') if 'limit' in _dict: args['limit'] = _dict.get('limit') else: - raise ValueError('Required property \'limit\' not present in PublicGatewayCollection JSON') + raise ValueError('Required property \'limit\' not present in ReservedIPCollection JSON') if 'next' in _dict: - args['next'] = PublicGatewayCollectionNext.from_dict(_dict.get('next')) - if 'public_gateways' in _dict: - args['public_gateways'] = [PublicGateway.from_dict(x) for x in _dict.get('public_gateways')] + args['next'] = ReservedIPCollectionNext.from_dict(_dict.get('next')) + if 'reserved_ips' in _dict: + args['reserved_ips'] = [ReservedIP.from_dict(x) for x in _dict.get('reserved_ips')] else: - raise ValueError('Required property \'public_gateways\' not present in PublicGatewayCollection JSON') + raise ValueError('Required property \'reserved_ips\' not present in ReservedIPCollection JSON') if 'total_count' in _dict: args['total_count'] = _dict.get('total_count') else: - raise ValueError('Required property \'total_count\' not present in PublicGatewayCollection JSON') + raise ValueError('Required property \'total_count\' not present in ReservedIPCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a PublicGatewayCollection object from a json dictionary.""" + """Initialize a ReservedIPCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -46931,8 +50827,8 @@ def to_dict(self) -> Dict: _dict['limit'] = self.limit if hasattr(self, 'next') and self.next is not None: _dict['next'] = self.next.to_dict() - if hasattr(self, 'public_gateways') and self.public_gateways is not None: - _dict['public_gateways'] = [x.to_dict() for x in self.public_gateways] + if hasattr(self, 'reserved_ips') and self.reserved_ips is not None: + _dict['reserved_ips'] = [x.to_dict() for x in self.reserved_ips] if hasattr(self, 'total_count') and self.total_count is not None: _dict['total_count'] = self.total_count return _dict @@ -46942,55 +50838,104 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this PublicGatewayCollection object.""" + """Return a `str` version of this ReservedIPCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'PublicGatewayCollection') -> bool: + def __eq__(self, other: 'ReservedIPCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'PublicGatewayCollection') -> bool: + def __ne__(self, other: 'ReservedIPCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class PublicGatewayCollectionFirst(): +class ReservedIPCollectionEndpointGatewayContext(): """ - A link to the first page of resources. + ReservedIPCollectionEndpointGatewayContext. - :attr str href: The URL for a page of resources. + :attr ReservedIPCollectionEndpointGatewayContextFirst first: A link to the first + page of resources. + :attr List[ReservedIP] ips: Collection of reserved IPs bound to an endpoint + gateway. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr ReservedIPCollectionEndpointGatewayContextNext next: (optional) A link to + the next page of resources. This property is present for all pages + except the last page. + :attr int total_count: The total number of resources across all pages. """ def __init__(self, - href: str) -> None: + first: 'ReservedIPCollectionEndpointGatewayContextFirst', + ips: List['ReservedIP'], + limit: int, + total_count: int, + *, + next: 'ReservedIPCollectionEndpointGatewayContextNext' = None) -> None: """ - Initialize a PublicGatewayCollectionFirst object. + Initialize a ReservedIPCollectionEndpointGatewayContext object. - :param str href: The URL for a page of resources. + :param ReservedIPCollectionEndpointGatewayContextFirst first: A link to the + first page of resources. + :param List[ReservedIP] ips: Collection of reserved IPs bound to an + endpoint gateway. + :param int limit: The maximum number of resources that can be returned by + the request. + :param int total_count: The total number of resources across all pages. + :param ReservedIPCollectionEndpointGatewayContextNext next: (optional) A + link to the next page of resources. This property is present for all pages + except the last page. """ - self.href = href + self.first = first + self.ips = ips + self.limit = limit + self.next = next + self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'PublicGatewayCollectionFirst': - """Initialize a PublicGatewayCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ReservedIPCollectionEndpointGatewayContext': + """Initialize a ReservedIPCollectionEndpointGatewayContext object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') + if 'first' in _dict: + args['first'] = ReservedIPCollectionEndpointGatewayContextFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'href\' not present in PublicGatewayCollectionFirst JSON') + raise ValueError('Required property \'first\' not present in ReservedIPCollectionEndpointGatewayContext JSON') + if 'ips' in _dict: + args['ips'] = [ReservedIP.from_dict(x) for x in _dict.get('ips')] + else: + raise ValueError('Required property \'ips\' not present in ReservedIPCollectionEndpointGatewayContext JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') + else: + raise ValueError('Required property \'limit\' not present in ReservedIPCollectionEndpointGatewayContext JSON') + if 'next' in _dict: + args['next'] = ReservedIPCollectionEndpointGatewayContextNext.from_dict(_dict.get('next')) + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') + else: + raise ValueError('Required property \'total_count\' not present in ReservedIPCollectionEndpointGatewayContext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a PublicGatewayCollectionFirst object from a json dictionary.""" + """Initialize a ReservedIPCollectionEndpointGatewayContext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'ips') and self.ips is not None: + _dict['ips'] = [x.to_dict() for x in self.ips] + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count return _dict def _to_dict(self): @@ -46998,23 +50943,22 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this PublicGatewayCollectionFirst object.""" + """Return a `str` version of this ReservedIPCollectionEndpointGatewayContext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'PublicGatewayCollectionFirst') -> bool: + def __eq__(self, other: 'ReservedIPCollectionEndpointGatewayContext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'PublicGatewayCollectionFirst') -> bool: + def __ne__(self, other: 'ReservedIPCollectionEndpointGatewayContext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class PublicGatewayCollectionNext(): +class ReservedIPCollectionEndpointGatewayContextFirst(): """ - A link to the next page of resources. This property is present for all pages except - the last page. + A link to the first page of resources. :attr str href: The URL for a page of resources. """ @@ -47022,25 +50966,25 @@ class PublicGatewayCollectionNext(): def __init__(self, href: str) -> None: """ - Initialize a PublicGatewayCollectionNext object. + Initialize a ReservedIPCollectionEndpointGatewayContextFirst object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'PublicGatewayCollectionNext': - """Initialize a PublicGatewayCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ReservedIPCollectionEndpointGatewayContextFirst': + """Initialize a ReservedIPCollectionEndpointGatewayContextFirst object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in PublicGatewayCollectionNext JSON') + raise ValueError('Required property \'href\' not present in ReservedIPCollectionEndpointGatewayContextFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a PublicGatewayCollectionNext object from a json dictionary.""" + """Initialize a ReservedIPCollectionEndpointGatewayContextFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -47055,123 +50999,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this PublicGatewayCollectionNext object.""" + """Return a `str` version of this ReservedIPCollectionEndpointGatewayContextFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'PublicGatewayCollectionNext') -> bool: + def __eq__(self, other: 'ReservedIPCollectionEndpointGatewayContextFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'PublicGatewayCollectionNext') -> bool: + def __ne__(self, other: 'ReservedIPCollectionEndpointGatewayContextFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class PublicGatewayFloatingIPPrototype(): - """ - PublicGatewayFloatingIPPrototype. - - """ - - def __init__(self) -> None: - """ - Initialize a PublicGatewayFloatingIPPrototype object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['PublicGatewayFloatingIPPrototypeFloatingIPIdentity', 'PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext'])) - raise Exception(msg) - -class PublicGatewayFloatingIp(): - """ - The floating IP bound to this public gateway. - - :attr str address: The globally unique IP address. - :attr str crn: The CRN for this floating IP. - :attr FloatingIPReferenceDeleted deleted: (optional) If present, this property - indicates the referenced resource has been deleted and provides - some supplementary information. - :attr str href: The URL for this floating IP. - :attr str id: The unique identifier for this floating IP. - :attr str name: The unique user-defined name for this floating IP. +class ReservedIPCollectionEndpointGatewayContextNext(): + """ + A link to the next page of resources. This property is present for all pages except + the last page. + + :attr str href: The URL for a page of resources. """ def __init__(self, - address: str, - crn: str, - href: str, - id: str, - name: str, - *, - deleted: 'FloatingIPReferenceDeleted' = None) -> None: + href: str) -> None: """ - Initialize a PublicGatewayFloatingIp object. + Initialize a ReservedIPCollectionEndpointGatewayContextNext object. - :param str address: The globally unique IP address. - :param str crn: The CRN for this floating IP. - :param str href: The URL for this floating IP. - :param str id: The unique identifier for this floating IP. - :param str name: The unique user-defined name for this floating IP. - :param FloatingIPReferenceDeleted deleted: (optional) If present, this - property indicates the referenced resource has been deleted and provides - some supplementary information. + :param str href: The URL for a page of resources. """ - self.address = address - self.crn = crn - self.deleted = deleted self.href = href - self.id = id - self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'PublicGatewayFloatingIp': - """Initialize a PublicGatewayFloatingIp object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ReservedIPCollectionEndpointGatewayContextNext': + """Initialize a ReservedIPCollectionEndpointGatewayContextNext object from a json dictionary.""" args = {} - if 'address' in _dict: - args['address'] = _dict.get('address') - else: - raise ValueError('Required property \'address\' not present in PublicGatewayFloatingIp JSON') - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in PublicGatewayFloatingIp JSON') - if 'deleted' in _dict: - args['deleted'] = FloatingIPReferenceDeleted.from_dict(_dict.get('deleted')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in PublicGatewayFloatingIp JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in PublicGatewayFloatingIp JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in PublicGatewayFloatingIp JSON') + raise ValueError('Required property \'href\' not present in ReservedIPCollectionEndpointGatewayContextNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a PublicGatewayFloatingIp object from a json dictionary.""" + """Initialize a ReservedIPCollectionEndpointGatewayContextNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'address') and self.address is not None: - _dict['address'] = self.address - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name return _dict def _to_dict(self): @@ -47179,71 +51056,55 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this PublicGatewayFloatingIp object.""" + """Return a `str` version of this ReservedIPCollectionEndpointGatewayContextNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'PublicGatewayFloatingIp') -> bool: + def __eq__(self, other: 'ReservedIPCollectionEndpointGatewayContextNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'PublicGatewayFloatingIp') -> bool: + def __ne__(self, other: 'ReservedIPCollectionEndpointGatewayContextNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class PublicGatewayIdentity(): - """ - Identifies a public gateway by a unique property. - - """ - - def __init__(self) -> None: - """ - Initialize a PublicGatewayIdentity object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['PublicGatewayIdentityPublicGatewayIdentityById', 'PublicGatewayIdentityPublicGatewayIdentityByCRN', 'PublicGatewayIdentityPublicGatewayIdentityByHref'])) - raise Exception(msg) - -class PublicGatewayPatch(): +class ReservedIPCollectionFirst(): """ - PublicGatewayPatch. + A link to the first page of resources. - :attr str name: (optional) The user-defined name for this public gateway. Names - must be unique within the VPC the public gateway resides in. + :attr str href: The URL for a page of resources. """ def __init__(self, - *, - name: str = None) -> None: + href: str) -> None: """ - Initialize a PublicGatewayPatch object. + Initialize a ReservedIPCollectionFirst object. - :param str name: (optional) The user-defined name for this public gateway. - Names must be unique within the VPC the public gateway resides in. + :param str href: The URL for a page of resources. """ - self.name = name + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'PublicGatewayPatch': - """Initialize a PublicGatewayPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ReservedIPCollectionFirst': + """Initialize a ReservedIPCollectionFirst object from a json dictionary.""" args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in ReservedIPCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a PublicGatewayPatch object from a json dictionary.""" + """Initialize a ReservedIPCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -47251,108 +51112,104 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this PublicGatewayPatch object.""" + """Return a `str` version of this ReservedIPCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'PublicGatewayPatch') -> bool: + def __eq__(self, other: 'ReservedIPCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'PublicGatewayPatch') -> bool: + def __ne__(self, other: 'ReservedIPCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class PublicGatewayReference(): +class ReservedIPCollectionNetworkInterfaceContext(): """ - PublicGatewayReference. + ReservedIPCollectionNetworkInterfaceContext. - :attr str crn: The CRN for this public gateway. - :attr PublicGatewayReferenceDeleted deleted: (optional) If present, this - property indicates the referenced resource has been deleted and provides - some supplementary information. - :attr str href: The URL for this public gateway. - :attr str id: The unique identifier for this public gateway. - :attr str name: The user-defined name for this public gateway. - :attr str resource_type: The resource type. + :attr ReservedIPCollectionNetworkInterfaceContextFirst first: A link to the + first page of resources. + :attr List[ReservedIP] ips: Collection of reserved IPs bound to a network + interface. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr ReservedIPCollectionNetworkInterfaceContextNext next: (optional) A link to + the next page of resources. This property is present for all pages + except the last page. + :attr int total_count: The total number of resources across all pages. """ def __init__(self, - crn: str, - href: str, - id: str, - name: str, - resource_type: str, + first: 'ReservedIPCollectionNetworkInterfaceContextFirst', + ips: List['ReservedIP'], + limit: int, + total_count: int, *, - deleted: 'PublicGatewayReferenceDeleted' = None) -> None: + next: 'ReservedIPCollectionNetworkInterfaceContextNext' = None) -> None: """ - Initialize a PublicGatewayReference object. + Initialize a ReservedIPCollectionNetworkInterfaceContext object. - :param str crn: The CRN for this public gateway. - :param str href: The URL for this public gateway. - :param str id: The unique identifier for this public gateway. - :param str name: The user-defined name for this public gateway. - :param str resource_type: The resource type. - :param PublicGatewayReferenceDeleted deleted: (optional) If present, this - property indicates the referenced resource has been deleted and provides - some supplementary information. + :param ReservedIPCollectionNetworkInterfaceContextFirst first: A link to + the first page of resources. + :param List[ReservedIP] ips: Collection of reserved IPs bound to a network + interface. + :param int limit: The maximum number of resources that can be returned by + the request. + :param int total_count: The total number of resources across all pages. + :param ReservedIPCollectionNetworkInterfaceContextNext next: (optional) A + link to the next page of resources. This property is present for all pages + except the last page. """ - self.crn = crn - self.deleted = deleted - self.href = href - self.id = id - self.name = name - self.resource_type = resource_type + self.first = first + self.ips = ips + self.limit = limit + self.next = next + self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'PublicGatewayReference': - """Initialize a PublicGatewayReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ReservedIPCollectionNetworkInterfaceContext': + """Initialize a ReservedIPCollectionNetworkInterfaceContext object from a json dictionary.""" args = {} - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in PublicGatewayReference JSON') - if 'deleted' in _dict: - args['deleted'] = PublicGatewayReferenceDeleted.from_dict(_dict.get('deleted')) - if 'href' in _dict: - args['href'] = _dict.get('href') + if 'first' in _dict: + args['first'] = ReservedIPCollectionNetworkInterfaceContextFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'href\' not present in PublicGatewayReference JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') + raise ValueError('Required property \'first\' not present in ReservedIPCollectionNetworkInterfaceContext JSON') + if 'ips' in _dict: + args['ips'] = [ReservedIP.from_dict(x) for x in _dict.get('ips')] else: - raise ValueError('Required property \'id\' not present in PublicGatewayReference JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') + raise ValueError('Required property \'ips\' not present in ReservedIPCollectionNetworkInterfaceContext JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') else: - raise ValueError('Required property \'name\' not present in PublicGatewayReference JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') + raise ValueError('Required property \'limit\' not present in ReservedIPCollectionNetworkInterfaceContext JSON') + if 'next' in _dict: + args['next'] = ReservedIPCollectionNetworkInterfaceContextNext.from_dict(_dict.get('next')) + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') else: - raise ValueError('Required property \'resource_type\' not present in PublicGatewayReference JSON') + raise ValueError('Required property \'total_count\' not present in ReservedIPCollectionNetworkInterfaceContext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a PublicGatewayReference object from a json dictionary.""" + """Initialize a ReservedIPCollectionNetworkInterfaceContext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'ips') and self.ips is not None: + _dict['ips'] = [x.to_dict() for x in self.ips] + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count return _dict def _to_dict(self): @@ -47360,63 +51217,55 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this PublicGatewayReference object.""" + """Return a `str` version of this ReservedIPCollectionNetworkInterfaceContext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'PublicGatewayReference') -> bool: + def __eq__(self, other: 'ReservedIPCollectionNetworkInterfaceContext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'PublicGatewayReference') -> bool: + def __ne__(self, other: 'ReservedIPCollectionNetworkInterfaceContext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ResourceTypeEnum(str, Enum): - """ - The resource type. - """ - PUBLIC_GATEWAY = 'public_gateway' - - -class PublicGatewayReferenceDeleted(): +class ReservedIPCollectionNetworkInterfaceContextFirst(): """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. + A link to the first page of resources. - :attr str more_info: Link to documentation about deleted resources. + :attr str href: The URL for a page of resources. """ def __init__(self, - more_info: str) -> None: + href: str) -> None: """ - Initialize a PublicGatewayReferenceDeleted object. + Initialize a ReservedIPCollectionNetworkInterfaceContextFirst object. - :param str more_info: Link to documentation about deleted resources. + :param str href: The URL for a page of resources. """ - self.more_info = more_info + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'PublicGatewayReferenceDeleted': - """Initialize a PublicGatewayReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ReservedIPCollectionNetworkInterfaceContextFirst': + """Initialize a ReservedIPCollectionNetworkInterfaceContextFirst object from a json dictionary.""" args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'more_info\' not present in PublicGatewayReferenceDeleted JSON') + raise ValueError('Required property \'href\' not present in ReservedIPCollectionNetworkInterfaceContextFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a PublicGatewayReferenceDeleted object from a json dictionary.""" + """Initialize a ReservedIPCollectionNetworkInterfaceContextFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -47424,85 +51273,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this PublicGatewayReferenceDeleted object.""" + """Return a `str` version of this ReservedIPCollectionNetworkInterfaceContextFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'PublicGatewayReferenceDeleted') -> bool: + def __eq__(self, other: 'ReservedIPCollectionNetworkInterfaceContextFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'PublicGatewayReferenceDeleted') -> bool: + def __ne__(self, other: 'ReservedIPCollectionNetworkInterfaceContextFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class Region(): +class ReservedIPCollectionNetworkInterfaceContextNext(): """ - Region. + A link to the next page of resources. This property is present for all pages except + the last page. - :attr str endpoint: The API endpoint for this region. - :attr str href: The URL for this region. - :attr str name: The globally unique name for this region. - :attr str status: The availability status of this region. + :attr str href: The URL for a page of resources. """ def __init__(self, - endpoint: str, - href: str, - name: str, - status: str) -> None: + href: str) -> None: """ - Initialize a Region object. + Initialize a ReservedIPCollectionNetworkInterfaceContextNext object. - :param str endpoint: The API endpoint for this region. - :param str href: The URL for this region. - :param str name: The globally unique name for this region. - :param str status: The availability status of this region. + :param str href: The URL for a page of resources. """ - self.endpoint = endpoint self.href = href - self.name = name - self.status = status @classmethod - def from_dict(cls, _dict: Dict) -> 'Region': - """Initialize a Region object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ReservedIPCollectionNetworkInterfaceContextNext': + """Initialize a ReservedIPCollectionNetworkInterfaceContextNext object from a json dictionary.""" args = {} - if 'endpoint' in _dict: - args['endpoint'] = _dict.get('endpoint') - else: - raise ValueError('Required property \'endpoint\' not present in Region JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in Region JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in Region JSON') - if 'status' in _dict: - args['status'] = _dict.get('status') - else: - raise ValueError('Required property \'status\' not present in Region JSON') + raise ValueError('Required property \'href\' not present in ReservedIPCollectionNetworkInterfaceContextNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a Region object from a json dictionary.""" + """Initialize a ReservedIPCollectionNetworkInterfaceContextNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'endpoint') and self.endpoint is not None: - _dict['endpoint'] = self.endpoint if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status return _dict def _to_dict(self): @@ -47510,63 +51330,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this Region object.""" + """Return a `str` version of this ReservedIPCollectionNetworkInterfaceContextNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'Region') -> bool: + def __eq__(self, other: 'ReservedIPCollectionNetworkInterfaceContextNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'Region') -> bool: + def __ne__(self, other: 'ReservedIPCollectionNetworkInterfaceContextNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class StatusEnum(str, Enum): - """ - The availability status of this region. - """ - AVAILABLE = 'available' - UNAVAILABLE = 'unavailable' - - -class RegionCollection(): +class ReservedIPCollectionNext(): """ - RegionCollection. + A link to the next page of resources. This property is present for all pages except + the last page. - :attr List[Region] regions: Collection of regions. + :attr str href: The URL for a page of resources. """ def __init__(self, - regions: List['Region']) -> None: + href: str) -> None: """ - Initialize a RegionCollection object. + Initialize a ReservedIPCollectionNext object. - :param List[Region] regions: Collection of regions. + :param str href: The URL for a page of resources. """ - self.regions = regions + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'RegionCollection': - """Initialize a RegionCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ReservedIPCollectionNext': + """Initialize a ReservedIPCollectionNext object from a json dictionary.""" args = {} - if 'regions' in _dict: - args['regions'] = [Region.from_dict(x) for x in _dict.get('regions')] + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'regions\' not present in RegionCollection JSON') + raise ValueError('Required property \'href\' not present in ReservedIPCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RegionCollection object from a json dictionary.""" + """Initialize a ReservedIPCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'regions') and self.regions is not None: - _dict['regions'] = [x.to_dict() for x in self.regions] + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -47574,63 +51387,70 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RegionCollection object.""" + """Return a `str` version of this ReservedIPCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RegionCollection') -> bool: + def __eq__(self, other: 'ReservedIPCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'RegionCollection') -> bool: + def __ne__(self, other: 'ReservedIPCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class RegionReference(): +class ReservedIPPatch(): """ - RegionReference. + ReservedIPPatch. - :attr str href: The URL for this region. - :attr str name: The globally unique name for this region. + :attr bool auto_delete: (optional) Indicates whether this reserved IP member + will be automatically deleted when either + `target` is deleted, or the reserved IP is unbound. Must be `false` if the + reserved IP is unbound. + :attr str name: (optional) The user-defined name for this reserved IP. Names + must be unique within the subnet the reserved IP resides in. Names beginning + with `ibm-` are reserved for provider-owned resources. """ def __init__(self, - href: str, - name: str) -> None: + *, + auto_delete: bool = None, + name: str = None) -> None: """ - Initialize a RegionReference object. + Initialize a ReservedIPPatch object. - :param str href: The URL for this region. - :param str name: The globally unique name for this region. + :param bool auto_delete: (optional) Indicates whether this reserved IP + member will be automatically deleted when either + `target` is deleted, or the reserved IP is unbound. Must be `false` if the + reserved IP is unbound. + :param str name: (optional) The user-defined name for this reserved IP. + Names must be unique within the subnet the reserved IP resides in. Names + beginning with `ibm-` are reserved for provider-owned resources. """ - self.href = href + self.auto_delete = auto_delete self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'RegionReference': - """Initialize a RegionReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ReservedIPPatch': + """Initialize a ReservedIPPatch object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in RegionReference JSON') + if 'auto_delete' in _dict: + args['auto_delete'] = _dict.get('auto_delete') if 'name' in _dict: args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in RegionReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RegionReference object from a json dictionary.""" + """Initialize a ReservedIPPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'auto_delete') and self.auto_delete is not None: + _dict['auto_delete'] = self.auto_delete if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name return _dict @@ -47640,22 +51460,22 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RegionReference object.""" + """Return a `str` version of this ReservedIPPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RegionReference') -> bool: + def __eq__(self, other: 'ReservedIPPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'RegionReference') -> bool: + def __ne__(self, other: 'ReservedIPPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ReservedIP(): +class ReservedIPReference(): """ - ReservedIP. + ReservedIPReference. :attr str address: The IP address. If the address has not yet been selected, the value will be `0.0.0.0`. @@ -47663,34 +51483,25 @@ class ReservedIP(): a value in this property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. - :attr bool auto_delete: Indicates whether this reserved IP member will be - automatically deleted when either - `target` is deleted, or the reserved IP is unbound. - :attr datetime created_at: The date and time that the reserved IP was created. + :attr ReservedIPReferenceDeleted deleted: (optional) If present, this property + indicates the referenced resource has been deleted and provides + some supplementary information. :attr str href: The URL for this reserved IP. :attr str id: The unique identifier for this reserved IP. - :attr str lifecycle_state: The lifecycle state of the reserved IP. :attr str name: The user-defined or system-provided name for this reserved IP. - :attr str owner: The owner of the reserved IP. :attr str resource_type: The resource type. - :attr ReservedIPTarget target: (optional) The target of this reserved IP. - If absent, this reserved IP is provider-owned or unbound. """ def __init__(self, address: str, - auto_delete: bool, - created_at: datetime, href: str, id: str, - lifecycle_state: str, name: str, - owner: str, resource_type: str, *, - target: 'ReservedIPTarget' = None) -> None: + deleted: 'ReservedIPReferenceDeleted' = None) -> None: """ - Initialize a ReservedIP object. + Initialize a ReservedIPReference object. :param str address: The IP address. If the address has not yet been selected, the value will be `0.0.0.0`. @@ -47699,79 +51510,53 @@ def __init__(self, expected format. If it is not, log an error. Optionally halt processing and surface the error, or bypass the resource on which the unexpected IP address format was encountered. - :param bool auto_delete: Indicates whether this reserved IP member will be - automatically deleted when either - `target` is deleted, or the reserved IP is unbound. - :param datetime created_at: The date and time that the reserved IP was - created. :param str href: The URL for this reserved IP. :param str id: The unique identifier for this reserved IP. - :param str lifecycle_state: The lifecycle state of the reserved IP. :param str name: The user-defined or system-provided name for this reserved IP. - :param str owner: The owner of the reserved IP. :param str resource_type: The resource type. - :param ReservedIPTarget target: (optional) The target of this reserved IP. - If absent, this reserved IP is provider-owned or unbound. + :param ReservedIPReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides + some supplementary information. """ self.address = address - self.auto_delete = auto_delete - self.created_at = created_at + self.deleted = deleted self.href = href self.id = id - self.lifecycle_state = lifecycle_state self.name = name - self.owner = owner self.resource_type = resource_type - self.target = target @classmethod - def from_dict(cls, _dict: Dict) -> 'ReservedIP': - """Initialize a ReservedIP object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ReservedIPReference': + """Initialize a ReservedIPReference object from a json dictionary.""" args = {} if 'address' in _dict: args['address'] = _dict.get('address') else: - raise ValueError('Required property \'address\' not present in ReservedIP JSON') - if 'auto_delete' in _dict: - args['auto_delete'] = _dict.get('auto_delete') - else: - raise ValueError('Required property \'auto_delete\' not present in ReservedIP JSON') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - else: - raise ValueError('Required property \'created_at\' not present in ReservedIP JSON') + raise ValueError('Required property \'address\' not present in ReservedIPReference JSON') + if 'deleted' in _dict: + args['deleted'] = ReservedIPReferenceDeleted.from_dict(_dict.get('deleted')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in ReservedIP JSON') + raise ValueError('Required property \'href\' not present in ReservedIPReference JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in ReservedIP JSON') - if 'lifecycle_state' in _dict: - args['lifecycle_state'] = _dict.get('lifecycle_state') - else: - raise ValueError('Required property \'lifecycle_state\' not present in ReservedIP JSON') + raise ValueError('Required property \'id\' not present in ReservedIPReference JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in ReservedIP JSON') - if 'owner' in _dict: - args['owner'] = _dict.get('owner') - else: - raise ValueError('Required property \'owner\' not present in ReservedIP JSON') + raise ValueError('Required property \'name\' not present in ReservedIPReference JSON') if 'resource_type' in _dict: args['resource_type'] = _dict.get('resource_type') else: - raise ValueError('Required property \'resource_type\' not present in ReservedIP JSON') - if 'target' in _dict: - args['target'] = _dict.get('target') + raise ValueError('Required property \'resource_type\' not present in ReservedIPReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ReservedIP object from a json dictionary.""" + """Initialize a ReservedIPReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -47779,27 +51564,16 @@ def to_dict(self) -> Dict: _dict = {} if hasattr(self, 'address') and self.address is not None: _dict['address'] = self.address - if hasattr(self, 'auto_delete') and self.auto_delete is not None: - _dict['auto_delete'] = self.auto_delete - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id - if hasattr(self, 'lifecycle_state') and self.lifecycle_state is not None: - _dict['lifecycle_state'] = self.lifecycle_state if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'owner') and self.owner is not None: - _dict['owner'] = self.owner if hasattr(self, 'resource_type') and self.resource_type is not None: _dict['resource_type'] = self.resource_type - if hasattr(self, 'target') and self.target is not None: - if isinstance(self.target, dict): - _dict['target'] = self.target - else: - _dict['target'] = self.target.to_dict() return _dict def _to_dict(self): @@ -47807,40 +51581,19 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ReservedIP object.""" + """Return a `str` version of this ReservedIPReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ReservedIP') -> bool: + def __eq__(self, other: 'ReservedIPReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ReservedIP') -> bool: + def __ne__(self, other: 'ReservedIPReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class LifecycleStateEnum(str, Enum): - """ - The lifecycle state of the reserved IP. - """ - DELETING = 'deleting' - FAILED = 'failed' - PENDING = 'pending' - STABLE = 'stable' - SUSPENDED = 'suspended' - UPDATING = 'updating' - WAITING = 'waiting' - - - class OwnerEnum(str, Enum): - """ - The owner of the reserved IP. - """ - PROVIDER = 'provider' - USER = 'user' - - class ResourceTypeEnum(str, Enum): """ The resource type. @@ -47848,89 +51601,43 @@ class ResourceTypeEnum(str, Enum): SUBNET_RESERVED_IP = 'subnet_reserved_ip' -class ReservedIPCollection(): +class ReservedIPReferenceDeleted(): """ - ReservedIPCollection. + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. - :attr ReservedIPCollectionFirst first: A link to the first page of resources. - :attr int limit: The maximum number of resources that can be returned by the - request. - :attr ReservedIPCollectionNext next: (optional) A link to the next page of - resources. This property is present for all pages - except the last page. - :attr List[ReservedIP] reserved_ips: Collection of reserved IPs in this subnet. - :attr int total_count: The total number of resources across all pages. + :attr str more_info: Link to documentation about deleted resources. """ def __init__(self, - first: 'ReservedIPCollectionFirst', - limit: int, - reserved_ips: List['ReservedIP'], - total_count: int, - *, - next: 'ReservedIPCollectionNext' = None) -> None: + more_info: str) -> None: """ - Initialize a ReservedIPCollection object. + Initialize a ReservedIPReferenceDeleted object. - :param ReservedIPCollectionFirst first: A link to the first page of - resources. - :param int limit: The maximum number of resources that can be returned by - the request. - :param List[ReservedIP] reserved_ips: Collection of reserved IPs in this - subnet. - :param int total_count: The total number of resources across all pages. - :param ReservedIPCollectionNext next: (optional) A link to the next page of - resources. This property is present for all pages - except the last page. + :param str more_info: Link to documentation about deleted resources. """ - self.first = first - self.limit = limit - self.next = next - self.reserved_ips = reserved_ips - self.total_count = total_count + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'ReservedIPCollection': - """Initialize a ReservedIPCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ReservedIPReferenceDeleted': + """Initialize a ReservedIPReferenceDeleted object from a json dictionary.""" args = {} - if 'first' in _dict: - args['first'] = ReservedIPCollectionFirst.from_dict(_dict.get('first')) - else: - raise ValueError('Required property \'first\' not present in ReservedIPCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') - else: - raise ValueError('Required property \'limit\' not present in ReservedIPCollection JSON') - if 'next' in _dict: - args['next'] = ReservedIPCollectionNext.from_dict(_dict.get('next')) - if 'reserved_ips' in _dict: - args['reserved_ips'] = [ReservedIP.from_dict(x) for x in _dict.get('reserved_ips')] - else: - raise ValueError('Required property \'reserved_ips\' not present in ReservedIPCollection JSON') - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'total_count\' not present in ReservedIPCollection JSON') + raise ValueError('Required property \'more_info\' not present in ReservedIPReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ReservedIPCollection object from a json dictionary.""" + """Initialize a ReservedIPReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'reserved_ips') and self.reserved_ips is not None: - _dict['reserved_ips'] = [x.to_dict() for x in self.reserved_ips] - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -47938,104 +51645,86 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ReservedIPCollection object.""" + """Return a `str` version of this ReservedIPReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ReservedIPCollection') -> bool: + def __eq__(self, other: 'ReservedIPReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ReservedIPCollection') -> bool: + def __ne__(self, other: 'ReservedIPReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ReservedIPCollectionEndpointGatewayContext(): +class ReservedIPTarget(): """ - ReservedIPCollectionEndpointGatewayContext. + The target of this reserved IP. + If absent, this reserved IP is provider-owned or unbound. - :attr ReservedIPCollectionEndpointGatewayContextFirst first: A link to the first - page of resources. - :attr List[ReservedIP] ips: Collection of reserved IPs bound to an endpoint - gateway. - :attr int limit: The maximum number of resources that can be returned by the - request. - :attr ReservedIPCollectionEndpointGatewayContextNext next: (optional) A link to - the next page of resources. This property is present for all pages - except the last page. - :attr int total_count: The total number of resources across all pages. + """ + + def __init__(self) -> None: + """ + Initialize a ReservedIPTarget object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['ReservedIPTargetEndpointGatewayReference', 'ReservedIPTargetNetworkInterfaceReferenceTargetContext', 'ReservedIPTargetLoadBalancerReference', 'ReservedIPTargetVPNGatewayReference', 'ReservedIPTargetVPNServerReference', 'ReservedIPTargetGenericResourceReference'])) + raise Exception(msg) + +class ReservedIPTargetPrototype(): + """ + The target this reserved IP is to be bound to. The target must be an endpoint gateway + not already bound to a reserved IP in the subnet's zone. + + """ + + def __init__(self) -> None: + """ + Initialize a ReservedIPTargetPrototype object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['ReservedIPTargetPrototypeEndpointGatewayIdentity'])) + raise Exception(msg) + +class ResourceFilter(): + """ + Identifies one or more resources according to the specified filter property. + + :attr str resource_type: (optional) The resource type. """ def __init__(self, - first: 'ReservedIPCollectionEndpointGatewayContextFirst', - ips: List['ReservedIP'], - limit: int, - total_count: int, *, - next: 'ReservedIPCollectionEndpointGatewayContextNext' = None) -> None: + resource_type: str = None) -> None: """ - Initialize a ReservedIPCollectionEndpointGatewayContext object. + Initialize a ResourceFilter object. - :param ReservedIPCollectionEndpointGatewayContextFirst first: A link to the - first page of resources. - :param List[ReservedIP] ips: Collection of reserved IPs bound to an - endpoint gateway. - :param int limit: The maximum number of resources that can be returned by - the request. - :param int total_count: The total number of resources across all pages. - :param ReservedIPCollectionEndpointGatewayContextNext next: (optional) A - link to the next page of resources. This property is present for all pages - except the last page. + :param str resource_type: (optional) The resource type. """ - self.first = first - self.ips = ips - self.limit = limit - self.next = next - self.total_count = total_count + self.resource_type = resource_type @classmethod - def from_dict(cls, _dict: Dict) -> 'ReservedIPCollectionEndpointGatewayContext': - """Initialize a ReservedIPCollectionEndpointGatewayContext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ResourceFilter': + """Initialize a ResourceFilter object from a json dictionary.""" args = {} - if 'first' in _dict: - args['first'] = ReservedIPCollectionEndpointGatewayContextFirst.from_dict(_dict.get('first')) - else: - raise ValueError('Required property \'first\' not present in ReservedIPCollectionEndpointGatewayContext JSON') - if 'ips' in _dict: - args['ips'] = [ReservedIP.from_dict(x) for x in _dict.get('ips')] - else: - raise ValueError('Required property \'ips\' not present in ReservedIPCollectionEndpointGatewayContext JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') - else: - raise ValueError('Required property \'limit\' not present in ReservedIPCollectionEndpointGatewayContext JSON') - if 'next' in _dict: - args['next'] = ReservedIPCollectionEndpointGatewayContextNext.from_dict(_dict.get('next')) - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') - else: - raise ValueError('Required property \'total_count\' not present in ReservedIPCollectionEndpointGatewayContext JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ReservedIPCollectionEndpointGatewayContext object from a json dictionary.""" + """Initialize a ResourceFilter object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'ips') and self.ips is not None: - _dict['ips'] = [x.to_dict() for x in self.ips] - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type return _dict def _to_dict(self): @@ -48043,48 +51732,80 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ReservedIPCollectionEndpointGatewayContext object.""" + """Return a `str` version of this ResourceFilter object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ReservedIPCollectionEndpointGatewayContext') -> bool: + def __eq__(self, other: 'ResourceFilter') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ReservedIPCollectionEndpointGatewayContext') -> bool: + def __ne__(self, other: 'ResourceFilter') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ReservedIPCollectionEndpointGatewayContextFirst(): +class ResourceGroupIdentity(): """ - A link to the first page of resources. + The resource group to use. If unspecified, the account's [default resource + group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - :attr str href: The URL for a page of resources. + """ + + def __init__(self) -> None: + """ + Initialize a ResourceGroupIdentity object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['ResourceGroupIdentityById'])) + raise Exception(msg) + +class ResourceGroupReference(): + """ + ResourceGroupReference. + + :attr str href: The URL for this resource group. + :attr str id: The unique identifier for this resource group. + :attr str name: The user-defined name for this resource group. """ def __init__(self, - href: str) -> None: + href: str, + id: str, + name: str) -> None: """ - Initialize a ReservedIPCollectionEndpointGatewayContextFirst object. + Initialize a ResourceGroupReference object. - :param str href: The URL for a page of resources. + :param str href: The URL for this resource group. + :param str id: The unique identifier for this resource group. + :param str name: The user-defined name for this resource group. """ self.href = href + self.id = id + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'ReservedIPCollectionEndpointGatewayContextFirst': - """Initialize a ReservedIPCollectionEndpointGatewayContextFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ResourceGroupReference': + """Initialize a ResourceGroupReference object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in ReservedIPCollectionEndpointGatewayContextFirst JSON') + raise ValueError('Required property \'href\' not present in ResourceGroupReference JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in ResourceGroupReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in ResourceGroupReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ReservedIPCollectionEndpointGatewayContextFirst object from a json dictionary.""" + """Initialize a ResourceGroupReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -48092,6 +51813,10 @@ def to_dict(self) -> Dict: _dict = {} if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -48099,56 +51824,191 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ReservedIPCollectionEndpointGatewayContextFirst object.""" + """Return a `str` version of this ResourceGroupReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ReservedIPCollectionEndpointGatewayContextFirst') -> bool: + def __eq__(self, other: 'ResourceGroupReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ReservedIPCollectionEndpointGatewayContextFirst') -> bool: + def __ne__(self, other: 'ResourceGroupReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ReservedIPCollectionEndpointGatewayContextNext(): +class Route(): """ - A link to the next page of resources. This property is present for all pages except - the last page. + Route. - :attr str href: The URL for a page of resources. + :attr str action: The action to perform with a packet matching the route: + - `delegate`: delegate to the system's built-in routes + - `delegate_vpc`: delegate to the system's built-in routes, ignoring + Internet-bound + routes + - `deliver`: deliver the packet to the specified `next_hop` + - `drop`: drop the packet. + :attr datetime created_at: The date and time that the route was created. + :attr RouteCreator creator: (optional) If present, the resource that created the + route. Routes with this property present cannot be + directly deleted. All routes with an `origin` of `learned` or `service` will + have this + property set, and future `origin` values may also have this property set. + :attr str destination: The destination of the route. + :attr str href: The URL for this route. + :attr str id: The unique identifier for this route. + :attr str lifecycle_state: The lifecycle state of the route. + :attr str name: The user-defined name for this route. + :attr RouteNextHop next_hop: If `action` is `deliver`, the next hop that packets + will be delivered to. For + other `action` values, its `address` will be `0.0.0.0`. + :attr str origin: (optional) The origin of this route: + - `service`: route was directly created by a service + - `user`: route was directly created by a user + The enumerated values for this property are expected to expand in the future. + When processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the route on which the unexpected + property value was encountered. + :attr ZoneReference zone: The zone the route applies to. (Traffic from subnets + in this zone will be + subject to this route.). """ def __init__(self, - href: str) -> None: + action: str, + created_at: datetime, + destination: str, + href: str, + id: str, + lifecycle_state: str, + name: str, + next_hop: 'RouteNextHop', + zone: 'ZoneReference', + *, + creator: 'RouteCreator' = None, + origin: str = None) -> None: """ - Initialize a ReservedIPCollectionEndpointGatewayContextNext object. + Initialize a Route object. - :param str href: The URL for a page of resources. + :param str action: The action to perform with a packet matching the route: + - `delegate`: delegate to the system's built-in routes + - `delegate_vpc`: delegate to the system's built-in routes, ignoring + Internet-bound + routes + - `deliver`: deliver the packet to the specified `next_hop` + - `drop`: drop the packet. + :param datetime created_at: The date and time that the route was created. + :param str destination: The destination of the route. + :param str href: The URL for this route. + :param str id: The unique identifier for this route. + :param str lifecycle_state: The lifecycle state of the route. + :param str name: The user-defined name for this route. + :param RouteNextHop next_hop: If `action` is `deliver`, the next hop that + packets will be delivered to. For + other `action` values, its `address` will be `0.0.0.0`. + :param ZoneReference zone: The zone the route applies to. (Traffic from + subnets in this zone will be + subject to this route.). + :param RouteCreator creator: (optional) If present, the resource that + created the route. Routes with this property present cannot be + directly deleted. All routes with an `origin` of `learned` or `service` + will have this + property set, and future `origin` values may also have this property set. """ + self.action = action + self.created_at = created_at + self.creator = creator + self.destination = destination self.href = href + self.id = id + self.lifecycle_state = lifecycle_state + self.name = name + self.next_hop = next_hop + self.origin = origin + self.zone = zone @classmethod - def from_dict(cls, _dict: Dict) -> 'ReservedIPCollectionEndpointGatewayContextNext': - """Initialize a ReservedIPCollectionEndpointGatewayContextNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'Route': + """Initialize a Route object from a json dictionary.""" args = {} + if 'action' in _dict: + args['action'] = _dict.get('action') + else: + raise ValueError('Required property \'action\' not present in Route JSON') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) + else: + raise ValueError('Required property \'created_at\' not present in Route JSON') + if 'creator' in _dict: + args['creator'] = _dict.get('creator') + if 'destination' in _dict: + args['destination'] = _dict.get('destination') + else: + raise ValueError('Required property \'destination\' not present in Route JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in ReservedIPCollectionEndpointGatewayContextNext JSON') + raise ValueError('Required property \'href\' not present in Route JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in Route JSON') + if 'lifecycle_state' in _dict: + args['lifecycle_state'] = _dict.get('lifecycle_state') + else: + raise ValueError('Required property \'lifecycle_state\' not present in Route JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in Route JSON') + if 'next_hop' in _dict: + args['next_hop'] = _dict.get('next_hop') + else: + raise ValueError('Required property \'next_hop\' not present in Route JSON') + if 'origin' in _dict: + args['origin'] = _dict.get('origin') + if 'zone' in _dict: + args['zone'] = ZoneReference.from_dict(_dict.get('zone')) + else: + raise ValueError('Required property \'zone\' not present in Route JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ReservedIPCollectionEndpointGatewayContextNext object from a json dictionary.""" + """Initialize a Route object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'action') and self.action is not None: + _dict['action'] = self.action + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'creator') and self.creator is not None: + if isinstance(self.creator, dict): + _dict['creator'] = self.creator + else: + _dict['creator'] = self.creator.to_dict() + if hasattr(self, 'destination') and self.destination is not None: + _dict['destination'] = self.destination if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'lifecycle_state') and self.lifecycle_state is not None: + _dict['lifecycle_state'] = self.lifecycle_state + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'next_hop') and self.next_hop is not None: + if isinstance(self.next_hop, dict): + _dict['next_hop'] = self.next_hop + else: + _dict['next_hop'] = self.next_hop.to_dict() + if hasattr(self, 'origin') and getattr(self, 'origin') is not None: + _dict['origin'] = getattr(self, 'origin') + if hasattr(self, 'zone') and self.zone is not None: + _dict['zone'] = self.zone.to_dict() return _dict def _to_dict(self): @@ -48156,145 +52016,128 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ReservedIPCollectionEndpointGatewayContextNext object.""" + """Return a `str` version of this Route object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ReservedIPCollectionEndpointGatewayContextNext') -> bool: + def __eq__(self, other: 'Route') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ReservedIPCollectionEndpointGatewayContextNext') -> bool: + def __ne__(self, other: 'Route') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ReservedIPCollectionFirst(): - """ - A link to the first page of resources. - - :attr str href: The URL for a page of resources. - """ - - def __init__(self, - href: str) -> None: + class ActionEnum(str, Enum): """ - Initialize a ReservedIPCollectionFirst object. - - :param str href: The URL for a page of resources. + The action to perform with a packet matching the route: + - `delegate`: delegate to the system's built-in routes + - `delegate_vpc`: delegate to the system's built-in routes, ignoring + Internet-bound + routes + - `deliver`: deliver the packet to the specified `next_hop` + - `drop`: drop the packet. """ - self.href = href - - @classmethod - def from_dict(cls, _dict: Dict) -> 'ReservedIPCollectionFirst': - """Initialize a ReservedIPCollectionFirst object from a json dictionary.""" - args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in ReservedIPCollectionFirst JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a ReservedIPCollectionFirst object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - return _dict + DELEGATE = 'delegate' + DELEGATE_VPC = 'delegate_vpc' + DELIVER = 'deliver' + DROP = 'drop' - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - def __str__(self) -> str: - """Return a `str` version of this ReservedIPCollectionFirst object.""" - return json.dumps(self.to_dict(), indent=2) + class LifecycleStateEnum(str, Enum): + """ + The lifecycle state of the route. + """ + DELETING = 'deleting' + FAILED = 'failed' + PENDING = 'pending' + STABLE = 'stable' + SUSPENDED = 'suspended' + UPDATING = 'updating' + WAITING = 'waiting' - def __eq__(self, other: 'ReservedIPCollectionFirst') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ReservedIPCollectionFirst') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other + class OriginEnum(str, Enum): + """ + The origin of this route: + - `service`: route was directly created by a service + - `user`: route was directly created by a user + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the route on which the unexpected + property value was encountered. + """ + SERVICE = 'service' + USER = 'user' -class ReservedIPCollectionNetworkInterfaceContext(): + +class RouteCollection(): """ - ReservedIPCollectionNetworkInterfaceContext. + RouteCollection. - :attr ReservedIPCollectionNetworkInterfaceContextFirst first: A link to the - first page of resources. - :attr List[ReservedIP] ips: Collection of reserved IPs bound to a network - interface. + :attr RouteCollectionFirst first: A link to the first page of resources. :attr int limit: The maximum number of resources that can be returned by the request. - :attr ReservedIPCollectionNetworkInterfaceContextNext next: (optional) A link to - the next page of resources. This property is present for all pages + :attr RouteCollectionNext next: (optional) A link to the next page of resources. + This property is present for all pages except the last page. + :attr List[Route] routes: Collection of routes. :attr int total_count: The total number of resources across all pages. """ def __init__(self, - first: 'ReservedIPCollectionNetworkInterfaceContextFirst', - ips: List['ReservedIP'], + first: 'RouteCollectionFirst', limit: int, + routes: List['Route'], total_count: int, *, - next: 'ReservedIPCollectionNetworkInterfaceContextNext' = None) -> None: + next: 'RouteCollectionNext' = None) -> None: """ - Initialize a ReservedIPCollectionNetworkInterfaceContext object. + Initialize a RouteCollection object. - :param ReservedIPCollectionNetworkInterfaceContextFirst first: A link to - the first page of resources. - :param List[ReservedIP] ips: Collection of reserved IPs bound to a network - interface. + :param RouteCollectionFirst first: A link to the first page of resources. :param int limit: The maximum number of resources that can be returned by the request. + :param List[Route] routes: Collection of routes. :param int total_count: The total number of resources across all pages. - :param ReservedIPCollectionNetworkInterfaceContextNext next: (optional) A - link to the next page of resources. This property is present for all pages + :param RouteCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages except the last page. """ self.first = first - self.ips = ips self.limit = limit self.next = next + self.routes = routes self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'ReservedIPCollectionNetworkInterfaceContext': - """Initialize a ReservedIPCollectionNetworkInterfaceContext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RouteCollection': + """Initialize a RouteCollection object from a json dictionary.""" args = {} if 'first' in _dict: - args['first'] = ReservedIPCollectionNetworkInterfaceContextFirst.from_dict(_dict.get('first')) - else: - raise ValueError('Required property \'first\' not present in ReservedIPCollectionNetworkInterfaceContext JSON') - if 'ips' in _dict: - args['ips'] = [ReservedIP.from_dict(x) for x in _dict.get('ips')] + args['first'] = RouteCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'ips\' not present in ReservedIPCollectionNetworkInterfaceContext JSON') + raise ValueError('Required property \'first\' not present in RouteCollection JSON') if 'limit' in _dict: args['limit'] = _dict.get('limit') else: - raise ValueError('Required property \'limit\' not present in ReservedIPCollectionNetworkInterfaceContext JSON') + raise ValueError('Required property \'limit\' not present in RouteCollection JSON') if 'next' in _dict: - args['next'] = ReservedIPCollectionNetworkInterfaceContextNext.from_dict(_dict.get('next')) + args['next'] = RouteCollectionNext.from_dict(_dict.get('next')) + if 'routes' in _dict: + args['routes'] = [Route.from_dict(x) for x in _dict.get('routes')] + else: + raise ValueError('Required property \'routes\' not present in RouteCollection JSON') if 'total_count' in _dict: args['total_count'] = _dict.get('total_count') else: - raise ValueError('Required property \'total_count\' not present in ReservedIPCollectionNetworkInterfaceContext JSON') + raise ValueError('Required property \'total_count\' not present in RouteCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ReservedIPCollectionNetworkInterfaceContext object from a json dictionary.""" + """Initialize a RouteCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -48302,12 +52145,12 @@ def to_dict(self) -> Dict: _dict = {} if hasattr(self, 'first') and self.first is not None: _dict['first'] = self.first.to_dict() - if hasattr(self, 'ips') and self.ips is not None: - _dict['ips'] = [x.to_dict() for x in self.ips] if hasattr(self, 'limit') and self.limit is not None: _dict['limit'] = self.limit if hasattr(self, 'next') and self.next is not None: _dict['next'] = self.next.to_dict() + if hasattr(self, 'routes') and self.routes is not None: + _dict['routes'] = [x.to_dict() for x in self.routes] if hasattr(self, 'total_count') and self.total_count is not None: _dict['total_count'] = self.total_count return _dict @@ -48317,20 +52160,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ReservedIPCollectionNetworkInterfaceContext object.""" + """Return a `str` version of this RouteCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ReservedIPCollectionNetworkInterfaceContext') -> bool: + def __eq__(self, other: 'RouteCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ReservedIPCollectionNetworkInterfaceContext') -> bool: + def __ne__(self, other: 'RouteCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ReservedIPCollectionNetworkInterfaceContextFirst(): +class RouteCollectionFirst(): """ A link to the first page of resources. @@ -48340,25 +52183,25 @@ class ReservedIPCollectionNetworkInterfaceContextFirst(): def __init__(self, href: str) -> None: """ - Initialize a ReservedIPCollectionNetworkInterfaceContextFirst object. + Initialize a RouteCollectionFirst object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'ReservedIPCollectionNetworkInterfaceContextFirst': - """Initialize a ReservedIPCollectionNetworkInterfaceContextFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RouteCollectionFirst': + """Initialize a RouteCollectionFirst object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in ReservedIPCollectionNetworkInterfaceContextFirst JSON') + raise ValueError('Required property \'href\' not present in RouteCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ReservedIPCollectionNetworkInterfaceContextFirst object from a json dictionary.""" + """Initialize a RouteCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -48373,20 +52216,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ReservedIPCollectionNetworkInterfaceContextFirst object.""" + """Return a `str` version of this RouteCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ReservedIPCollectionNetworkInterfaceContextFirst') -> bool: + def __eq__(self, other: 'RouteCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ReservedIPCollectionNetworkInterfaceContextFirst') -> bool: + def __ne__(self, other: 'RouteCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ReservedIPCollectionNetworkInterfaceContextNext(): +class RouteCollectionNext(): """ A link to the next page of resources. This property is present for all pages except the last page. @@ -48397,25 +52240,25 @@ class ReservedIPCollectionNetworkInterfaceContextNext(): def __init__(self, href: str) -> None: """ - Initialize a ReservedIPCollectionNetworkInterfaceContextNext object. + Initialize a RouteCollectionNext object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'ReservedIPCollectionNetworkInterfaceContextNext': - """Initialize a ReservedIPCollectionNetworkInterfaceContextNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RouteCollectionNext': + """Initialize a RouteCollectionNext object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in ReservedIPCollectionNetworkInterfaceContextNext JSON') + raise ValueError('Required property \'href\' not present in RouteCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ReservedIPCollectionNetworkInterfaceContextNext object from a json dictionary.""" + """Initialize a RouteCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -48430,56 +52273,88 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ReservedIPCollectionNetworkInterfaceContextNext object.""" + """Return a `str` version of this RouteCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ReservedIPCollectionNetworkInterfaceContextNext') -> bool: + def __eq__(self, other: 'RouteCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ReservedIPCollectionNetworkInterfaceContextNext') -> bool: + def __ne__(self, other: 'RouteCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ReservedIPCollectionNext(): +class RouteCreator(): """ - A link to the next page of resources. This property is present for all pages except - the last page. + If present, the resource that created the route. Routes with this property present + cannot be directly deleted. All routes with an `origin` of `learned` or `service` will + have this property set, and future `origin` values may also have this property set. - :attr str href: The URL for a page of resources. + """ + + def __init__(self) -> None: + """ + Initialize a RouteCreator object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['RouteCreatorVPNGatewayReference', 'RouteCreatorVPNServerReference'])) + raise Exception(msg) + +class RouteNextHop(): + """ + RouteNextHop. + + """ + + def __init__(self) -> None: + """ + Initialize a RouteNextHop object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['RouteNextHopIP', 'RouteNextHopVPNGatewayConnectionReference'])) + raise Exception(msg) + +class RoutePatch(): + """ + RoutePatch. + + :attr str name: (optional) The user-defined name for this route. Names must be + unique within the VPC routing table the route resides in. """ def __init__(self, - href: str) -> None: + *, + name: str = None) -> None: """ - Initialize a ReservedIPCollectionNext object. + Initialize a RoutePatch object. - :param str href: The URL for a page of resources. + :param str name: (optional) The user-defined name for this route. Names + must be unique within the VPC routing table the route resides in. """ - self.href = href + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'ReservedIPCollectionNext': - """Initialize a ReservedIPCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RoutePatch': + """Initialize a RoutePatch object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in ReservedIPCollectionNext JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ReservedIPCollectionNext object from a json dictionary.""" + """Initialize a RoutePatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -48487,72 +52362,128 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ReservedIPCollectionNext object.""" + """Return a `str` version of this RoutePatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ReservedIPCollectionNext') -> bool: + def __eq__(self, other: 'RoutePatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ReservedIPCollectionNext') -> bool: + def __ne__(self, other: 'RoutePatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ReservedIPPatch(): +class RoutePrototype(): """ - ReservedIPPatch. + RoutePrototype. - :attr bool auto_delete: (optional) Indicates whether this reserved IP member - will be automatically deleted when either - `target` is deleted, or the reserved IP is unbound. Must be `false` if the - reserved IP is unbound. - :attr str name: (optional) The user-defined name for this reserved IP. Names - must be unique within the subnet the reserved IP resides in. Names beginning - with `ibm-` are reserved for provider-owned resources. + :attr str action: (optional) The action to perform with a packet matching the + route: + - `delegate`: delegate to the system's built-in routes + - `delegate_vpc`: delegate to the system's built-in routes, ignoring + Internet-bound + routes + - `deliver`: deliver the packet to the specified `next_hop` + - `drop`: drop the packet. + :attr str destination: The destination of the route. At most two routes per + `zone` in a table can have the same destination, and only if both routes have an + `action` of `deliver` and the + `next_hop` is an IP address. + :attr str name: (optional) The user-defined name for this route. If unspecified, + the name will be a hyphenated list of randomly-selected words. Names must be + unique within the VPC routing table the route resides in. + :attr RoutePrototypeNextHop next_hop: (optional) If `action` is `deliver`, the + next hop that packets will be delivered to. For other `action` + values, it must be omitted or specified as `0.0.0.0`. + :attr ZoneIdentity zone: The zone to apply the route to. (Traffic from subnets + in this zone will be + subject to this route.). """ def __init__(self, + destination: str, + zone: 'ZoneIdentity', *, - auto_delete: bool = None, - name: str = None) -> None: + action: str = None, + name: str = None, + next_hop: 'RoutePrototypeNextHop' = None) -> None: """ - Initialize a ReservedIPPatch object. + Initialize a RoutePrototype object. - :param bool auto_delete: (optional) Indicates whether this reserved IP - member will be automatically deleted when either - `target` is deleted, or the reserved IP is unbound. Must be `false` if the - reserved IP is unbound. - :param str name: (optional) The user-defined name for this reserved IP. - Names must be unique within the subnet the reserved IP resides in. Names - beginning with `ibm-` are reserved for provider-owned resources. + :param str destination: The destination of the route. At most two routes + per `zone` in a table can have the same destination, and only if both + routes have an `action` of `deliver` and the + `next_hop` is an IP address. + :param ZoneIdentity zone: The zone to apply the route to. (Traffic from + subnets in this zone will be + subject to this route.). + :param str action: (optional) The action to perform with a packet matching + the route: + - `delegate`: delegate to the system's built-in routes + - `delegate_vpc`: delegate to the system's built-in routes, ignoring + Internet-bound + routes + - `deliver`: deliver the packet to the specified `next_hop` + - `drop`: drop the packet. + :param str name: (optional) The user-defined name for this route. If + unspecified, the name will be a hyphenated list of randomly-selected words. + Names must be unique within the VPC routing table the route resides in. + :param RoutePrototypeNextHop next_hop: (optional) If `action` is `deliver`, + the next hop that packets will be delivered to. For other `action` + values, it must be omitted or specified as `0.0.0.0`. """ - self.auto_delete = auto_delete + self.action = action + self.destination = destination self.name = name + self.next_hop = next_hop + self.zone = zone @classmethod - def from_dict(cls, _dict: Dict) -> 'ReservedIPPatch': - """Initialize a ReservedIPPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RoutePrototype': + """Initialize a RoutePrototype object from a json dictionary.""" args = {} - if 'auto_delete' in _dict: - args['auto_delete'] = _dict.get('auto_delete') + if 'action' in _dict: + args['action'] = _dict.get('action') + if 'destination' in _dict: + args['destination'] = _dict.get('destination') + else: + raise ValueError('Required property \'destination\' not present in RoutePrototype JSON') if 'name' in _dict: args['name'] = _dict.get('name') + if 'next_hop' in _dict: + args['next_hop'] = _dict.get('next_hop') + if 'zone' in _dict: + args['zone'] = _dict.get('zone') + else: + raise ValueError('Required property \'zone\' not present in RoutePrototype JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ReservedIPPatch object from a json dictionary.""" + """Initialize a RoutePrototype object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'auto_delete') and self.auto_delete is not None: - _dict['auto_delete'] = self.auto_delete + if hasattr(self, 'action') and self.action is not None: + _dict['action'] = self.action + if hasattr(self, 'destination') and self.destination is not None: + _dict['destination'] = self.destination if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name + if hasattr(self, 'next_hop') and self.next_hop is not None: + if isinstance(self.next_hop, dict): + _dict['next_hop'] = self.next_hop + else: + _dict['next_hop'] = self.next_hop.to_dict() + if hasattr(self, 'zone') and self.zone is not None: + if isinstance(self.zone, dict): + _dict['zone'] = self.zone + else: + _dict['zone'] = self.zone.to_dict() return _dict def _to_dict(self): @@ -48560,110 +52491,112 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ReservedIPPatch object.""" + """Return a `str` version of this RoutePrototype object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ReservedIPPatch') -> bool: + def __eq__(self, other: 'RoutePrototype') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ReservedIPPatch') -> bool: + def __ne__(self, other: 'RoutePrototype') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ReservedIPReference(): + class ActionEnum(str, Enum): + """ + The action to perform with a packet matching the route: + - `delegate`: delegate to the system's built-in routes + - `delegate_vpc`: delegate to the system's built-in routes, ignoring + Internet-bound + routes + - `deliver`: deliver the packet to the specified `next_hop` + - `drop`: drop the packet. + """ + DELEGATE = 'delegate' + DELEGATE_VPC = 'delegate_vpc' + DELIVER = 'deliver' + DROP = 'drop' + + +class RoutePrototypeNextHop(): """ - ReservedIPReference. + If `action` is `deliver`, the next hop that packets will be delivered to. For other + `action` values, it must be omitted or specified as `0.0.0.0`. - :attr str address: The IP address. - If the address has not yet been selected, the value will be `0.0.0.0`. - This property may add support for IPv6 addresses in the future. When processing - a value in this property, verify that the address is in an expected format. If - it is not, log an error. Optionally halt processing and surface the error, or - bypass the resource on which the unexpected IP address format was encountered. - :attr ReservedIPReferenceDeleted deleted: (optional) If present, this property + """ + + def __init__(self) -> None: + """ + Initialize a RoutePrototypeNextHop object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP', 'RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity'])) + raise Exception(msg) + +class RouteReference(): + """ + RouteReference. + + :attr RouteReferenceDeleted deleted: (optional) If present, this property indicates the referenced resource has been deleted and provides some supplementary information. - :attr str href: The URL for this reserved IP. - :attr str id: The unique identifier for this reserved IP. - :attr str name: The user-defined or system-provided name for this reserved IP. - :attr str resource_type: The resource type. + :attr str href: The URL for this route. + :attr str id: The unique identifier for this route. + :attr str name: The user-defined name for this route. """ def __init__(self, - address: str, href: str, id: str, name: str, - resource_type: str, *, - deleted: 'ReservedIPReferenceDeleted' = None) -> None: + deleted: 'RouteReferenceDeleted' = None) -> None: """ - Initialize a ReservedIPReference object. + Initialize a RouteReference object. - :param str address: The IP address. - If the address has not yet been selected, the value will be `0.0.0.0`. - This property may add support for IPv6 addresses in the future. When - processing a value in this property, verify that the address is in an - expected format. If it is not, log an error. Optionally halt processing and - surface the error, or bypass the resource on which the unexpected IP - address format was encountered. - :param str href: The URL for this reserved IP. - :param str id: The unique identifier for this reserved IP. - :param str name: The user-defined or system-provided name for this reserved - IP. - :param str resource_type: The resource type. - :param ReservedIPReferenceDeleted deleted: (optional) If present, this - property indicates the referenced resource has been deleted and provides + :param str href: The URL for this route. + :param str id: The unique identifier for this route. + :param str name: The user-defined name for this route. + :param RouteReferenceDeleted deleted: (optional) If present, this property + indicates the referenced resource has been deleted and provides some supplementary information. """ - self.address = address self.deleted = deleted self.href = href self.id = id self.name = name - self.resource_type = resource_type @classmethod - def from_dict(cls, _dict: Dict) -> 'ReservedIPReference': - """Initialize a ReservedIPReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RouteReference': + """Initialize a RouteReference object from a json dictionary.""" args = {} - if 'address' in _dict: - args['address'] = _dict.get('address') - else: - raise ValueError('Required property \'address\' not present in ReservedIPReference JSON') if 'deleted' in _dict: - args['deleted'] = ReservedIPReferenceDeleted.from_dict(_dict.get('deleted')) + args['deleted'] = RouteReferenceDeleted.from_dict(_dict.get('deleted')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in ReservedIPReference JSON') + raise ValueError('Required property \'href\' not present in RouteReference JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in ReservedIPReference JSON') + raise ValueError('Required property \'id\' not present in RouteReference JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in ReservedIPReference JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in ReservedIPReference JSON') + raise ValueError('Required property \'name\' not present in RouteReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ReservedIPReference object from a json dictionary.""" + """Initialize a RouteReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'address') and self.address is not None: - _dict['address'] = self.address if hasattr(self, 'deleted') and self.deleted is not None: _dict['deleted'] = self.deleted.to_dict() if hasattr(self, 'href') and self.href is not None: @@ -48672,8 +52605,6 @@ def to_dict(self) -> Dict: _dict['id'] = self.id if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type return _dict def _to_dict(self): @@ -48681,187 +52612,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ReservedIPReference object.""" + """Return a `str` version of this RouteReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ReservedIPReference') -> bool: + def __eq__(self, other: 'RouteReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ReservedIPReference') -> bool: + def __ne__(self, other: 'RouteReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ResourceTypeEnum(str, Enum): - """ - The resource type. - """ - SUBNET_RESERVED_IP = 'subnet_reserved_ip' - - -class ReservedIPReferenceDeleted(): +class RouteReferenceDeleted(): """ If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. - - :attr str more_info: Link to documentation about deleted resources. - """ - - def __init__(self, - more_info: str) -> None: - """ - Initialize a ReservedIPReferenceDeleted object. - - :param str more_info: Link to documentation about deleted resources. - """ - self.more_info = more_info - - @classmethod - def from_dict(cls, _dict: Dict) -> 'ReservedIPReferenceDeleted': - """Initialize a ReservedIPReferenceDeleted object from a json dictionary.""" - args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') - else: - raise ValueError('Required property \'more_info\' not present in ReservedIPReferenceDeleted JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a ReservedIPReferenceDeleted object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this ReservedIPReferenceDeleted object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'ReservedIPReferenceDeleted') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'ReservedIPReferenceDeleted') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - -class ReservedIPTarget(): - """ - The target of this reserved IP. - If absent, this reserved IP is provider-owned or unbound. - - """ - - def __init__(self) -> None: - """ - Initialize a ReservedIPTarget object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['ReservedIPTargetEndpointGatewayReference', 'ReservedIPTargetNetworkInterfaceReferenceTargetContext', 'ReservedIPTargetLoadBalancerReference', 'ReservedIPTargetVPNGatewayReference', 'ReservedIPTargetGenericResourceReference'])) - raise Exception(msg) - -class ReservedIPTargetPrototype(): - """ - The target this reserved IP is to be bound to. The target must be an endpoint gateway - not already bound to a reserved IP in the subnet's zone. - - """ - - def __init__(self) -> None: - """ - Initialize a ReservedIPTargetPrototype object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['ReservedIPTargetPrototypeEndpointGatewayIdentity'])) - raise Exception(msg) - -class ResourceGroupIdentity(): - """ - The resource group to use. If unspecified, the account's [default resource - group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - - """ - - def __init__(self) -> None: - """ - Initialize a ResourceGroupIdentity object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['ResourceGroupIdentityById'])) - raise Exception(msg) - -class ResourceGroupReference(): - """ - ResourceGroupReference. + provides some supplementary information. - :attr str href: The URL for this resource group. - :attr str id: The unique identifier for this resource group. - :attr str name: The user-defined name for this resource group. + :attr str more_info: Link to documentation about deleted resources. """ def __init__(self, - href: str, - id: str, - name: str) -> None: + more_info: str) -> None: """ - Initialize a ResourceGroupReference object. + Initialize a RouteReferenceDeleted object. - :param str href: The URL for this resource group. - :param str id: The unique identifier for this resource group. - :param str name: The user-defined name for this resource group. + :param str more_info: Link to documentation about deleted resources. """ - self.href = href - self.id = id - self.name = name + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'ResourceGroupReference': - """Initialize a ResourceGroupReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RouteReferenceDeleted': + """Initialize a RouteReferenceDeleted object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in ResourceGroupReference JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in ResourceGroupReference JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'name\' not present in ResourceGroupReference JSON') + raise ValueError('Required property \'more_info\' not present in RouteReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ResourceGroupReference object from a json dictionary.""" + """Initialize a RouteReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -48869,158 +52669,236 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ResourceGroupReference object.""" + """Return a `str` version of this RouteReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ResourceGroupReference') -> bool: + def __eq__(self, other: 'RouteReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ResourceGroupReference') -> bool: + def __ne__(self, other: 'RouteReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class Route(): +class RoutingTable(): """ - Route. + RoutingTable. - :attr str action: The action to perform with a packet matching the route: - - `delegate`: delegate to the system's built-in routes - - `delegate_vpc`: delegate to the system's built-in routes, ignoring - Internet-bound - routes - - `deliver`: deliver the packet to the specified `next_hop` - - `drop`: drop the packet. - :attr datetime created_at: The date and time that the route was created. - :attr str destination: The destination of the route. - :attr str href: The URL for this route. - :attr str id: The unique identifier for this route. - :attr str lifecycle_state: The lifecycle state of the route. - :attr str name: The user-defined name for this route. - :attr RouteNextHop next_hop: If `action` is `deliver`, the next hop that packets - will be delivered to. For - other `action` values, its `address` will be `0.0.0.0`. - :attr ZoneReference zone: The zone the route applies to. (Traffic from subnets - in this zone will be - subject to this route.). + :attr List[ResourceFilter] accept_routes_from: The filters specifying the + resources that may create routes in this routing table. + At present, only the `resource_type` filter is permitted, and only the + `vpn_server` value is supported, but filter support is expected to expand in the + future. + :attr datetime created_at: The date and time that this routing table was + created. + :attr str href: The URL for this routing table. + :attr str id: The unique identifier for this routing table. + :attr bool is_default: Indicates whether this is the default routing table for + this VPC. + :attr str lifecycle_state: The lifecycle state of the routing table. + :attr str name: The user-defined name for this routing table. + :attr str resource_type: The resource type. + :attr bool route_direct_link_ingress: Indicates whether this routing table is + used to route traffic that originates from + [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. + Incoming traffic will be routed according to the routing table with one + exception: routes with an `action` of `deliver` are treated as `drop` unless the + `next_hop` is an IP address bound to a network interface on a subnet in the + route's `zone`. Therefore, if an incoming packet matches a route with a + `next_hop` of an internet-bound IP address or a VPN gateway connection, the + packet will be dropped. + :attr bool route_transit_gateway_ingress: Indicates whether this routing table + is used to route traffic that originates from from [Transit + Gateway](https://cloud.ibm.com/cloud/transit-gateway/) to this VPC. + Incoming traffic will be routed according to the routing table with one + exception: routes with an `action` of `deliver` are treated as `drop` unless the + `next_hop` is an IP address bound to a network interface on a subnet in the + route's `zone`. Therefore, if an incoming packet matches a route with a + `next_hop` of an internet-bound IP address or a VPN gateway connection, the + packet will be dropped. + :attr bool route_vpc_zone_ingress: Indicates whether this routing table is used + to route traffic that originates from subnets in other zones in this VPC. + Incoming traffic will be routed according to the routing table with one + exception: routes with an `action` of `deliver` are treated as `drop` unless the + `next_hop` is an IP address bound to a network interface on a subnet in the + route's `zone`. Therefore, if an incoming packet matches a route with a + `next_hop` of an internet-bound IP address or a VPN gateway connection, the + packet will be dropped. + :attr List[RouteReference] routes: The routes for this routing table. + :attr List[SubnetReference] subnets: The subnets to which this routing table is + attached. """ def __init__(self, - action: str, + accept_routes_from: List['ResourceFilter'], created_at: datetime, - destination: str, href: str, id: str, + is_default: bool, lifecycle_state: str, name: str, - next_hop: 'RouteNextHop', - zone: 'ZoneReference') -> None: + resource_type: str, + route_direct_link_ingress: bool, + route_transit_gateway_ingress: bool, + route_vpc_zone_ingress: bool, + routes: List['RouteReference'], + subnets: List['SubnetReference']) -> None: """ - Initialize a Route object. + Initialize a RoutingTable object. - :param str action: The action to perform with a packet matching the route: - - `delegate`: delegate to the system's built-in routes - - `delegate_vpc`: delegate to the system's built-in routes, ignoring - Internet-bound - routes - - `deliver`: deliver the packet to the specified `next_hop` - - `drop`: drop the packet. - :param datetime created_at: The date and time that the route was created. - :param str destination: The destination of the route. - :param str href: The URL for this route. - :param str id: The unique identifier for this route. - :param str lifecycle_state: The lifecycle state of the route. - :param str name: The user-defined name for this route. - :param RouteNextHop next_hop: If `action` is `deliver`, the next hop that - packets will be delivered to. For - other `action` values, its `address` will be `0.0.0.0`. - :param ZoneReference zone: The zone the route applies to. (Traffic from - subnets in this zone will be - subject to this route.). + :param List[ResourceFilter] accept_routes_from: The filters specifying the + resources that may create routes in this routing table. + At present, only the `resource_type` filter is permitted, and only the + `vpn_server` value is supported, but filter support is expected to expand + in the future. + :param datetime created_at: The date and time that this routing table was + created. + :param str href: The URL for this routing table. + :param str id: The unique identifier for this routing table. + :param bool is_default: Indicates whether this is the default routing table + for this VPC. + :param str lifecycle_state: The lifecycle state of the routing table. + :param str name: The user-defined name for this routing table. + :param str resource_type: The resource type. + :param bool route_direct_link_ingress: Indicates whether this routing table + is used to route traffic that originates from + [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. + Incoming traffic will be routed according to the routing table with one + exception: routes with an `action` of `deliver` are treated as `drop` + unless the `next_hop` is an IP address bound to a network interface on a + subnet in the route's `zone`. Therefore, if an incoming packet matches a + route with a `next_hop` of an internet-bound IP address or a VPN gateway + connection, the packet will be dropped. + :param bool route_transit_gateway_ingress: Indicates whether this routing + table is used to route traffic that originates from from [Transit + Gateway](https://cloud.ibm.com/cloud/transit-gateway/) to this VPC. + Incoming traffic will be routed according to the routing table with one + exception: routes with an `action` of `deliver` are treated as `drop` + unless the `next_hop` is an IP address bound to a network interface on a + subnet in the route's `zone`. Therefore, if an incoming packet matches a + route with a `next_hop` of an internet-bound IP address or a VPN gateway + connection, the packet will be dropped. + :param bool route_vpc_zone_ingress: Indicates whether this routing table is + used to route traffic that originates from subnets in other zones in this + VPC. + Incoming traffic will be routed according to the routing table with one + exception: routes with an `action` of `deliver` are treated as `drop` + unless the `next_hop` is an IP address bound to a network interface on a + subnet in the route's `zone`. Therefore, if an incoming packet matches a + route with a `next_hop` of an internet-bound IP address or a VPN gateway + connection, the packet will be dropped. + :param List[RouteReference] routes: The routes for this routing table. + :param List[SubnetReference] subnets: The subnets to which this routing + table is attached. """ - self.action = action + self.accept_routes_from = accept_routes_from self.created_at = created_at - self.destination = destination self.href = href self.id = id + self.is_default = is_default self.lifecycle_state = lifecycle_state self.name = name - self.next_hop = next_hop - self.zone = zone + self.resource_type = resource_type + self.route_direct_link_ingress = route_direct_link_ingress + self.route_transit_gateway_ingress = route_transit_gateway_ingress + self.route_vpc_zone_ingress = route_vpc_zone_ingress + self.routes = routes + self.subnets = subnets @classmethod - def from_dict(cls, _dict: Dict) -> 'Route': - """Initialize a Route object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RoutingTable': + """Initialize a RoutingTable object from a json dictionary.""" args = {} - if 'action' in _dict: - args['action'] = _dict.get('action') + if 'accept_routes_from' in _dict: + args['accept_routes_from'] = [ResourceFilter.from_dict(x) for x in _dict.get('accept_routes_from')] else: - raise ValueError('Required property \'action\' not present in Route JSON') + raise ValueError('Required property \'accept_routes_from\' not present in RoutingTable JSON') if 'created_at' in _dict: args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError('Required property \'created_at\' not present in Route JSON') - if 'destination' in _dict: - args['destination'] = _dict.get('destination') - else: - raise ValueError('Required property \'destination\' not present in Route JSON') + raise ValueError('Required property \'created_at\' not present in RoutingTable JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in Route JSON') + raise ValueError('Required property \'href\' not present in RoutingTable JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in Route JSON') + raise ValueError('Required property \'id\' not present in RoutingTable JSON') + if 'is_default' in _dict: + args['is_default'] = _dict.get('is_default') + else: + raise ValueError('Required property \'is_default\' not present in RoutingTable JSON') if 'lifecycle_state' in _dict: args['lifecycle_state'] = _dict.get('lifecycle_state') else: - raise ValueError('Required property \'lifecycle_state\' not present in Route JSON') + raise ValueError('Required property \'lifecycle_state\' not present in RoutingTable JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in Route JSON') - if 'next_hop' in _dict: - args['next_hop'] = _dict.get('next_hop') + raise ValueError('Required property \'name\' not present in RoutingTable JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') else: - raise ValueError('Required property \'next_hop\' not present in Route JSON') - if 'zone' in _dict: - args['zone'] = ZoneReference.from_dict(_dict.get('zone')) + raise ValueError('Required property \'resource_type\' not present in RoutingTable JSON') + if 'route_direct_link_ingress' in _dict: + args['route_direct_link_ingress'] = _dict.get('route_direct_link_ingress') else: - raise ValueError('Required property \'zone\' not present in Route JSON') + raise ValueError('Required property \'route_direct_link_ingress\' not present in RoutingTable JSON') + if 'route_transit_gateway_ingress' in _dict: + args['route_transit_gateway_ingress'] = _dict.get('route_transit_gateway_ingress') + else: + raise ValueError('Required property \'route_transit_gateway_ingress\' not present in RoutingTable JSON') + if 'route_vpc_zone_ingress' in _dict: + args['route_vpc_zone_ingress'] = _dict.get('route_vpc_zone_ingress') + else: + raise ValueError('Required property \'route_vpc_zone_ingress\' not present in RoutingTable JSON') + if 'routes' in _dict: + args['routes'] = [RouteReference.from_dict(x) for x in _dict.get('routes')] + else: + raise ValueError('Required property \'routes\' not present in RoutingTable JSON') + if 'subnets' in _dict: + args['subnets'] = [SubnetReference.from_dict(x) for x in _dict.get('subnets')] + else: + raise ValueError('Required property \'subnets\' not present in RoutingTable JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a Route object from a json dictionary.""" + """Initialize a RoutingTable object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'action') and self.action is not None: - _dict['action'] = self.action + if hasattr(self, 'accept_routes_from') and self.accept_routes_from is not None: + _dict['accept_routes_from'] = [x.to_dict() for x in self.accept_routes_from] if hasattr(self, 'created_at') and self.created_at is not None: _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'destination') and self.destination is not None: - _dict['destination'] = self.destination if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id + if hasattr(self, 'is_default') and self.is_default is not None: + _dict['is_default'] = self.is_default if hasattr(self, 'lifecycle_state') and self.lifecycle_state is not None: _dict['lifecycle_state'] = self.lifecycle_state if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'next_hop') and self.next_hop is not None: - if isinstance(self.next_hop, dict): - _dict['next_hop'] = self.next_hop - else: - _dict['next_hop'] = self.next_hop.to_dict() - if hasattr(self, 'zone') and self.zone is not None: - _dict['zone'] = self.zone.to_dict() + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + if hasattr(self, 'route_direct_link_ingress') and self.route_direct_link_ingress is not None: + _dict['route_direct_link_ingress'] = self.route_direct_link_ingress + if hasattr(self, 'route_transit_gateway_ingress') and self.route_transit_gateway_ingress is not None: + _dict['route_transit_gateway_ingress'] = self.route_transit_gateway_ingress + if hasattr(self, 'route_vpc_zone_ingress') and self.route_vpc_zone_ingress is not None: + _dict['route_vpc_zone_ingress'] = self.route_vpc_zone_ingress + if hasattr(self, 'routes') and self.routes is not None: + _dict['routes'] = [x.to_dict() for x in self.routes] + if hasattr(self, 'subnets') and self.subnets is not None: + _dict['subnets'] = [x.to_dict() for x in self.subnets] return _dict def _to_dict(self): @@ -49028,38 +52906,22 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this Route object.""" + """Return a `str` version of this RoutingTable object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'Route') -> bool: + def __eq__(self, other: 'RoutingTable') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'Route') -> bool: + def __ne__(self, other: 'RoutingTable') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ActionEnum(str, Enum): - """ - The action to perform with a packet matching the route: - - `delegate`: delegate to the system's built-in routes - - `delegate_vpc`: delegate to the system's built-in routes, ignoring - Internet-bound - routes - - `deliver`: deliver the packet to the specified `next_hop` - - `drop`: drop the packet. - """ - DELEGATE = 'delegate' - DELEGATE_VPC = 'delegate_vpc' - DELIVER = 'deliver' - DROP = 'drop' - - class LifecycleStateEnum(str, Enum): """ - The lifecycle state of the route. + The lifecycle state of the routing table. """ DELETING = 'deleting' FAILED = 'failed' @@ -49070,72 +52932,80 @@ class LifecycleStateEnum(str, Enum): WAITING = 'waiting' -class RouteCollection(): + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + ROUTING_TABLE = 'routing_table' + + +class RoutingTableCollection(): """ - RouteCollection. + RoutingTableCollection. - :attr RouteCollectionFirst first: A link to the first page of resources. + :attr RoutingTableCollectionFirst first: A link to the first page of resources. :attr int limit: The maximum number of resources that can be returned by the request. - :attr RouteCollectionNext next: (optional) A link to the next page of resources. - This property is present for all pages + :attr RoutingTableCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages except the last page. - :attr List[Route] routes: Collection of routes. + :attr List[RoutingTable] routing_tables: Collection of routing tables. :attr int total_count: The total number of resources across all pages. """ def __init__(self, - first: 'RouteCollectionFirst', + first: 'RoutingTableCollectionFirst', limit: int, - routes: List['Route'], + routing_tables: List['RoutingTable'], total_count: int, *, - next: 'RouteCollectionNext' = None) -> None: + next: 'RoutingTableCollectionNext' = None) -> None: """ - Initialize a RouteCollection object. + Initialize a RoutingTableCollection object. - :param RouteCollectionFirst first: A link to the first page of resources. + :param RoutingTableCollectionFirst first: A link to the first page of + resources. :param int limit: The maximum number of resources that can be returned by the request. - :param List[Route] routes: Collection of routes. + :param List[RoutingTable] routing_tables: Collection of routing tables. :param int total_count: The total number of resources across all pages. - :param RouteCollectionNext next: (optional) A link to the next page of - resources. This property is present for all pages + :param RoutingTableCollectionNext next: (optional) A link to the next page + of resources. This property is present for all pages except the last page. """ self.first = first self.limit = limit self.next = next - self.routes = routes + self.routing_tables = routing_tables self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'RouteCollection': - """Initialize a RouteCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RoutingTableCollection': + """Initialize a RoutingTableCollection object from a json dictionary.""" args = {} if 'first' in _dict: - args['first'] = RouteCollectionFirst.from_dict(_dict.get('first')) + args['first'] = RoutingTableCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'first\' not present in RouteCollection JSON') + raise ValueError('Required property \'first\' not present in RoutingTableCollection JSON') if 'limit' in _dict: args['limit'] = _dict.get('limit') else: - raise ValueError('Required property \'limit\' not present in RouteCollection JSON') + raise ValueError('Required property \'limit\' not present in RoutingTableCollection JSON') if 'next' in _dict: - args['next'] = RouteCollectionNext.from_dict(_dict.get('next')) - if 'routes' in _dict: - args['routes'] = [Route.from_dict(x) for x in _dict.get('routes')] + args['next'] = RoutingTableCollectionNext.from_dict(_dict.get('next')) + if 'routing_tables' in _dict: + args['routing_tables'] = [RoutingTable.from_dict(x) for x in _dict.get('routing_tables')] else: - raise ValueError('Required property \'routes\' not present in RouteCollection JSON') + raise ValueError('Required property \'routing_tables\' not present in RoutingTableCollection JSON') if 'total_count' in _dict: args['total_count'] = _dict.get('total_count') else: - raise ValueError('Required property \'total_count\' not present in RouteCollection JSON') + raise ValueError('Required property \'total_count\' not present in RoutingTableCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RouteCollection object from a json dictionary.""" + """Initialize a RoutingTableCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -49147,8 +53017,8 @@ def to_dict(self) -> Dict: _dict['limit'] = self.limit if hasattr(self, 'next') and self.next is not None: _dict['next'] = self.next.to_dict() - if hasattr(self, 'routes') and self.routes is not None: - _dict['routes'] = [x.to_dict() for x in self.routes] + if hasattr(self, 'routing_tables') and self.routing_tables is not None: + _dict['routing_tables'] = [x.to_dict() for x in self.routing_tables] if hasattr(self, 'total_count') and self.total_count is not None: _dict['total_count'] = self.total_count return _dict @@ -49158,20 +53028,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RouteCollection object.""" + """Return a `str` version of this RoutingTableCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RouteCollection') -> bool: + def __eq__(self, other: 'RoutingTableCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'RouteCollection') -> bool: + def __ne__(self, other: 'RoutingTableCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class RouteCollectionFirst(): +class RoutingTableCollectionFirst(): """ A link to the first page of resources. @@ -49181,25 +53051,25 @@ class RouteCollectionFirst(): def __init__(self, href: str) -> None: """ - Initialize a RouteCollectionFirst object. + Initialize a RoutingTableCollectionFirst object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'RouteCollectionFirst': - """Initialize a RouteCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RoutingTableCollectionFirst': + """Initialize a RoutingTableCollectionFirst object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in RouteCollectionFirst JSON') + raise ValueError('Required property \'href\' not present in RoutingTableCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RouteCollectionFirst object from a json dictionary.""" + """Initialize a RoutingTableCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -49214,20 +53084,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RouteCollectionFirst object.""" + """Return a `str` version of this RoutingTableCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RouteCollectionFirst') -> bool: + def __eq__(self, other: 'RoutingTableCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'RouteCollectionFirst') -> bool: + def __ne__(self, other: 'RoutingTableCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class RouteCollectionNext(): +class RoutingTableCollectionNext(): """ A link to the next page of resources. This property is present for all pages except the last page. @@ -49238,25 +53108,25 @@ class RouteCollectionNext(): def __init__(self, href: str) -> None: """ - Initialize a RouteCollectionNext object. + Initialize a RoutingTableCollectionNext object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'RouteCollectionNext': - """Initialize a RouteCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RoutingTableCollectionNext': + """Initialize a RoutingTableCollectionNext object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in RouteCollectionNext JSON') + raise ValueError('Required property \'href\' not present in RoutingTableCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RouteCollectionNext object from a json dictionary.""" + """Initialize a RoutingTableCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -49271,215 +53141,195 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RouteCollectionNext object.""" + """Return a `str` version of this RoutingTableCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RouteCollectionNext') -> bool: + def __eq__(self, other: 'RoutingTableCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'RouteCollectionNext') -> bool: + def __ne__(self, other: 'RoutingTableCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class RouteNextHop(): - """ - RouteNextHop. - - """ - - def __init__(self) -> None: - """ - Initialize a RouteNextHop object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['RouteNextHopIP', 'RouteNextHopVPNGatewayConnectionReference'])) - raise Exception(msg) - -class RouteNextHopPrototype(): +class RoutingTableIdentity(): """ - The next hop packets will be routed to. + Identifies a routing table by a unique property. """ def __init__(self) -> None: """ - Initialize a RouteNextHopPrototype object. + Initialize a RoutingTableIdentity object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['RouteNextHopPrototypeRouteNextHopIP', 'RouteNextHopPrototypeVPNGatewayConnectionIdentity'])) + ", ".join(['RoutingTableIdentityById', 'RoutingTableIdentityByHref'])) raise Exception(msg) -class RoutePatch(): - """ - RoutePatch. - - :attr str name: (optional) The user-defined name for this route. Names must be - unique within the VPC routing table the route resides in. - """ - - def __init__(self, - *, - name: str = None) -> None: - """ - Initialize a RoutePatch object. - - :param str name: (optional) The user-defined name for this route. Names - must be unique within the VPC routing table the route resides in. - """ - self.name = name - - @classmethod - def from_dict(cls, _dict: Dict) -> 'RoutePatch': - """Initialize a RoutePatch object from a json dictionary.""" - args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a RoutePatch object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this RoutePatch object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'RoutePatch') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'RoutePatch') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - -class RoutePrototype(): +class RoutingTablePatch(): """ - RoutePrototype. + RoutingTablePatch. - :attr str action: (optional) The action to perform with a packet matching the - route: - - `delegate`: delegate to the system's built-in routes - - `delegate_vpc`: delegate to the system's built-in routes, ignoring - Internet-bound - routes - - `deliver`: deliver the packet to the specified `next_hop` - - `drop`: drop the packet. - :attr str destination: The destination of the route. At most two routes per - `zone` in a table can have the same destination, and only if both routes have an - `action` of `deliver` and the - `next_hop` is an IP address. - :attr str name: (optional) The user-defined name for this route. If unspecified, - the name will be a hyphenated list of randomly-selected words. Names must be - unique within the VPC routing table the route resides in. - :attr RouteNextHopPrototype next_hop: (optional) If `action` is `deliver`, the - next hop that packets will be delivered to. For - other `action` values, it must be omitted or specified as `0.0.0.0`. - :attr ZoneIdentity zone: The zone to apply the route to. (Traffic from subnets - in this zone will be - subject to this route.). + :attr List[ResourceFilter] accept_routes_from: (optional) The filters specifying + the resources that may create routes in this routing table + (replacing any existing filters). All routes learned from resources that match a + given filter will be removed when an existing filter is removed. Therefore, if + an empty array is specified, all filters will be removed, resulting in all + learned routes being removed. + At present, only the `resource_type` filter is permitted, and only the + `vpn_server` value is supported, but filter support is expected to expand in the + future. + :attr str name: (optional) The user-defined name for this routing table. Names + must be unique within the VPC the routing table resides in. + :attr bool route_direct_link_ingress: (optional) Indicates whether this routing + table is used to route traffic that originates from + [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. Updating to `true` + selects this routing table, provided no other routing table in the VPC already + has this property set to `true`, and no subnets are attached to this routing + table. Updating to `false` deselects this routing table. + Incoming traffic will be routed according to the routing table with one + exception: routes with an `action` of `deliver` are treated as `drop` unless the + `next_hop` is an IP address bound to a network interface on a subnet in the + route's `zone`. Therefore, if an incoming packet matches a route with a + `next_hop` of an internet-bound IP address or a VPN gateway connection, the + packet will be dropped. + :attr bool route_transit_gateway_ingress: (optional) Indicates whether this + routing table is used to route traffic that originates from + [Transit Gateway](https://cloud.ibm.com/cloud/transit-gateway/) to this VPC. + Updating to + `true` selects this routing table, provided no other routing table in the VPC + already has this property set to `true`, and no subnets are attached to this + routing table. Updating to `false` deselects this routing table. + Incoming traffic will be routed according to the routing table with one + exception: routes with an `action` of `deliver` are treated as `drop` unless the + `next_hop` is an IP address bound to a network interface on a subnet in the + route's `zone`. Therefore, if an incoming packet matches a route with a + `next_hop` of an internet-bound IP address or a VPN gateway connection, the + packet will be dropped. + If [Classic + Access](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure) + is enabled for this VPC, and this property is set to `true`, its incoming + traffic will also be routed according to this routing table. + :attr bool route_vpc_zone_ingress: (optional) Indicates whether this routing + table is used to route traffic that originates from subnets in other zones in + this VPC. Updating to `true` selects this routing table, provided no other + routing table in the VPC already has this property set to `true`, and no subnets + are attached to this routing table. Updating to `false` deselects this routing + table. + Incoming traffic will be routed according to the routing table with one + exception: routes with an `action` of `deliver` are treated as `drop` unless the + `next_hop` is an IP address bound to a network interface on a subnet in the + route's `zone`. Therefore, if an incoming packet matches a route with a + `next_hop` of an internet-bound IP address or a VPN gateway connection, the + packet will be dropped. """ def __init__(self, - destination: str, - zone: 'ZoneIdentity', *, - action: str = None, + accept_routes_from: List['ResourceFilter'] = None, name: str = None, - next_hop: 'RouteNextHopPrototype' = None) -> None: + route_direct_link_ingress: bool = None, + route_transit_gateway_ingress: bool = None, + route_vpc_zone_ingress: bool = None) -> None: """ - Initialize a RoutePrototype object. + Initialize a RoutingTablePatch object. - :param str destination: The destination of the route. At most two routes - per `zone` in a table can have the same destination, and only if both - routes have an `action` of `deliver` and the - `next_hop` is an IP address. - :param ZoneIdentity zone: The zone to apply the route to. (Traffic from - subnets in this zone will be - subject to this route.). - :param str action: (optional) The action to perform with a packet matching - the route: - - `delegate`: delegate to the system's built-in routes - - `delegate_vpc`: delegate to the system's built-in routes, ignoring - Internet-bound - routes - - `deliver`: deliver the packet to the specified `next_hop` - - `drop`: drop the packet. - :param str name: (optional) The user-defined name for this route. If - unspecified, the name will be a hyphenated list of randomly-selected words. - Names must be unique within the VPC routing table the route resides in. - :param RouteNextHopPrototype next_hop: (optional) If `action` is `deliver`, - the next hop that packets will be delivered to. For - other `action` values, it must be omitted or specified as `0.0.0.0`. + :param List[ResourceFilter] accept_routes_from: (optional) The filters + specifying the resources that may create routes in this routing table + (replacing any existing filters). All routes learned from resources that + match a given filter will be removed when an existing filter is removed. + Therefore, if an empty array is specified, all filters will be removed, + resulting in all learned routes being removed. + At present, only the `resource_type` filter is permitted, and only the + `vpn_server` value is supported, but filter support is expected to expand + in the future. + :param str name: (optional) The user-defined name for this routing table. + Names must be unique within the VPC the routing table resides in. + :param bool route_direct_link_ingress: (optional) Indicates whether this + routing table is used to route traffic that originates from + [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. Updating to + `true` selects this routing table, provided no other routing table in the + VPC already has this property set to `true`, and no subnets are attached to + this routing table. Updating to `false` deselects this routing table. + Incoming traffic will be routed according to the routing table with one + exception: routes with an `action` of `deliver` are treated as `drop` + unless the `next_hop` is an IP address bound to a network interface on a + subnet in the route's `zone`. Therefore, if an incoming packet matches a + route with a `next_hop` of an internet-bound IP address or a VPN gateway + connection, the packet will be dropped. + :param bool route_transit_gateway_ingress: (optional) Indicates whether + this routing table is used to route traffic that originates from + [Transit Gateway](https://cloud.ibm.com/cloud/transit-gateway/) to this + VPC. Updating to + `true` selects this routing table, provided no other routing table in the + VPC already has this property set to `true`, and no subnets are attached to + this routing table. Updating to `false` deselects this routing table. + Incoming traffic will be routed according to the routing table with one + exception: routes with an `action` of `deliver` are treated as `drop` + unless the `next_hop` is an IP address bound to a network interface on a + subnet in the route's `zone`. Therefore, if an incoming packet matches a + route with a `next_hop` of an internet-bound IP address or a VPN gateway + connection, the packet will be dropped. + If [Classic + Access](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure) + is enabled for this VPC, and this property is set to `true`, its incoming + traffic will also be routed according to this routing table. + :param bool route_vpc_zone_ingress: (optional) Indicates whether this + routing table is used to route traffic that originates from subnets in + other zones in this VPC. Updating to `true` selects this routing table, + provided no other routing table in the VPC already has this property set to + `true`, and no subnets are attached to this routing table. Updating to + `false` deselects this routing table. + Incoming traffic will be routed according to the routing table with one + exception: routes with an `action` of `deliver` are treated as `drop` + unless the `next_hop` is an IP address bound to a network interface on a + subnet in the route's `zone`. Therefore, if an incoming packet matches a + route with a `next_hop` of an internet-bound IP address or a VPN gateway + connection, the packet will be dropped. """ - self.action = action - self.destination = destination + self.accept_routes_from = accept_routes_from self.name = name - self.next_hop = next_hop - self.zone = zone + self.route_direct_link_ingress = route_direct_link_ingress + self.route_transit_gateway_ingress = route_transit_gateway_ingress + self.route_vpc_zone_ingress = route_vpc_zone_ingress @classmethod - def from_dict(cls, _dict: Dict) -> 'RoutePrototype': - """Initialize a RoutePrototype object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RoutingTablePatch': + """Initialize a RoutingTablePatch object from a json dictionary.""" args = {} - if 'action' in _dict: - args['action'] = _dict.get('action') - if 'destination' in _dict: - args['destination'] = _dict.get('destination') - else: - raise ValueError('Required property \'destination\' not present in RoutePrototype JSON') + if 'accept_routes_from' in _dict: + args['accept_routes_from'] = [ResourceFilter.from_dict(x) for x in _dict.get('accept_routes_from')] if 'name' in _dict: args['name'] = _dict.get('name') - if 'next_hop' in _dict: - args['next_hop'] = _dict.get('next_hop') - if 'zone' in _dict: - args['zone'] = _dict.get('zone') - else: - raise ValueError('Required property \'zone\' not present in RoutePrototype JSON') + if 'route_direct_link_ingress' in _dict: + args['route_direct_link_ingress'] = _dict.get('route_direct_link_ingress') + if 'route_transit_gateway_ingress' in _dict: + args['route_transit_gateway_ingress'] = _dict.get('route_transit_gateway_ingress') + if 'route_vpc_zone_ingress' in _dict: + args['route_vpc_zone_ingress'] = _dict.get('route_vpc_zone_ingress') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RoutePrototype object from a json dictionary.""" + """Initialize a RoutingTablePatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'action') and self.action is not None: - _dict['action'] = self.action - if hasattr(self, 'destination') and self.destination is not None: - _dict['destination'] = self.destination + if hasattr(self, 'accept_routes_from') and self.accept_routes_from is not None: + _dict['accept_routes_from'] = [x.to_dict() for x in self.accept_routes_from] if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'next_hop') and self.next_hop is not None: - if isinstance(self.next_hop, dict): - _dict['next_hop'] = self.next_hop - else: - _dict['next_hop'] = self.next_hop.to_dict() - if hasattr(self, 'zone') and self.zone is not None: - if isinstance(self.zone, dict): - _dict['zone'] = self.zone - else: - _dict['zone'] = self.zone.to_dict() + if hasattr(self, 'route_direct_link_ingress') and self.route_direct_link_ingress is not None: + _dict['route_direct_link_ingress'] = self.route_direct_link_ingress + if hasattr(self, 'route_transit_gateway_ingress') and self.route_transit_gateway_ingress is not None: + _dict['route_transit_gateway_ingress'] = self.route_transit_gateway_ingress + if hasattr(self, 'route_vpc_zone_ingress') and self.route_vpc_zone_ingress is not None: + _dict['route_vpc_zone_ingress'] = self.route_vpc_zone_ingress return _dict def _to_dict(self): @@ -49487,91 +53337,83 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RoutePrototype object.""" + """Return a `str` version of this RoutingTablePatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RoutePrototype') -> bool: + def __eq__(self, other: 'RoutingTablePatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'RoutePrototype') -> bool: + def __ne__(self, other: 'RoutingTablePatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ActionEnum(str, Enum): - """ - The action to perform with a packet matching the route: - - `delegate`: delegate to the system's built-in routes - - `delegate_vpc`: delegate to the system's built-in routes, ignoring - Internet-bound - routes - - `deliver`: deliver the packet to the specified `next_hop` - - `drop`: drop the packet. - """ - DELEGATE = 'delegate' - DELEGATE_VPC = 'delegate_vpc' - DELIVER = 'deliver' - DROP = 'drop' - - -class RouteReference(): +class RoutingTableReference(): """ - RouteReference. + RoutingTableReference. - :attr RouteReferenceDeleted deleted: (optional) If present, this property + :attr RoutingTableReferenceDeleted deleted: (optional) If present, this property indicates the referenced resource has been deleted and provides some supplementary information. - :attr str href: The URL for this route. - :attr str id: The unique identifier for this route. - :attr str name: The user-defined name for this route. + :attr str href: The URL for this routing table. + :attr str id: The unique identifier for this routing table. + :attr str name: The user-defined name for this routing table. + :attr str resource_type: The resource type. """ def __init__(self, href: str, id: str, name: str, + resource_type: str, *, - deleted: 'RouteReferenceDeleted' = None) -> None: + deleted: 'RoutingTableReferenceDeleted' = None) -> None: """ - Initialize a RouteReference object. + Initialize a RoutingTableReference object. - :param str href: The URL for this route. - :param str id: The unique identifier for this route. - :param str name: The user-defined name for this route. - :param RouteReferenceDeleted deleted: (optional) If present, this property - indicates the referenced resource has been deleted and provides + :param str href: The URL for this routing table. + :param str id: The unique identifier for this routing table. + :param str name: The user-defined name for this routing table. + :param str resource_type: The resource type. + :param RoutingTableReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides some supplementary information. """ self.deleted = deleted self.href = href self.id = id self.name = name + self.resource_type = resource_type @classmethod - def from_dict(cls, _dict: Dict) -> 'RouteReference': - """Initialize a RouteReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RoutingTableReference': + """Initialize a RoutingTableReference object from a json dictionary.""" args = {} if 'deleted' in _dict: - args['deleted'] = RouteReferenceDeleted.from_dict(_dict.get('deleted')) + args['deleted'] = RoutingTableReferenceDeleted.from_dict(_dict.get('deleted')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in RouteReference JSON') + raise ValueError('Required property \'href\' not present in RoutingTableReference JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in RouteReference JSON') + raise ValueError('Required property \'id\' not present in RoutingTableReference JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in RouteReference JSON') + raise ValueError('Required property \'name\' not present in RoutingTableReference JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in RoutingTableReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RouteReference object from a json dictionary.""" + """Initialize a RoutingTableReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -49585,6 +53427,8 @@ def to_dict(self) -> Dict: _dict['id'] = self.id if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type return _dict def _to_dict(self): @@ -49592,20 +53436,27 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RouteReference object.""" + """Return a `str` version of this RoutingTableReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RouteReference') -> bool: + def __eq__(self, other: 'RoutingTableReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'RouteReference') -> bool: + def __ne__(self, other: 'RoutingTableReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class RouteReferenceDeleted(): + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + ROUTING_TABLE = 'routing_table' + + +class RoutingTableReferenceDeleted(): """ If present, this property indicates the referenced resource has been deleted and provides some supplementary information. @@ -49616,25 +53467,25 @@ class RouteReferenceDeleted(): def __init__(self, more_info: str) -> None: """ - Initialize a RouteReferenceDeleted object. + Initialize a RoutingTableReferenceDeleted object. :param str more_info: Link to documentation about deleted resources. """ self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'RouteReferenceDeleted': - """Initialize a RouteReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RoutingTableReferenceDeleted': + """Initialize a RoutingTableReferenceDeleted object from a json dictionary.""" args = {} if 'more_info' in _dict: args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'more_info\' not present in RouteReferenceDeleted JSON') + raise ValueError('Required property \'more_info\' not present in RoutingTableReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RouteReferenceDeleted object from a json dictionary.""" + """Initialize a RoutingTableReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -49649,189 +53500,122 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RouteReferenceDeleted object.""" + """Return a `str` version of this RoutingTableReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RouteReferenceDeleted') -> bool: + def __eq__(self, other: 'RoutingTableReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'RouteReferenceDeleted') -> bool: + def __ne__(self, other: 'RoutingTableReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class RoutingTable(): +class SecurityGroup(): """ - RoutingTable. + SecurityGroup. - :attr datetime created_at: The date and time that this routing table was + :attr datetime created_at: The date and time that this security group was created. - :attr str href: The URL for this routing table. - :attr str id: The unique identifier for this routing table. - :attr bool is_default: Indicates whether this is the default routing table for - this VPC. - :attr str lifecycle_state: The lifecycle state of the routing table. - :attr str name: The user-defined name for this routing table. - :attr str resource_type: The resource type. - :attr bool route_direct_link_ingress: Indicates whether this routing table is - used to route traffic that originates from - [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. - Incoming traffic will be routed according to the routing table with one - exception: routes with an `action` of `deliver` are treated as `drop` unless the - `next_hop` is an IP address bound to a network interface on a subnet in the - route's `zone`. Therefore, if an incoming packet matches a route with a - `next_hop` of an internet-bound IP address or a VPN gateway connection, the - packet will be dropped. - :attr bool route_transit_gateway_ingress: Indicates whether this routing table - is used to route traffic that originates from from [Transit - Gateway](https://cloud.ibm.com/cloud/transit-gateway/) to this VPC. - Incoming traffic will be routed according to the routing table with one - exception: routes with an `action` of `deliver` are treated as `drop` unless the - `next_hop` is an IP address bound to a network interface on a subnet in the - route's `zone`. Therefore, if an incoming packet matches a route with a - `next_hop` of an internet-bound IP address or a VPN gateway connection, the - packet will be dropped. - :attr bool route_vpc_zone_ingress: Indicates whether this routing table is used - to route traffic that originates from subnets in other zones in this VPC. - Incoming traffic will be routed according to the routing table with one - exception: routes with an `action` of `deliver` are treated as `drop` unless the - `next_hop` is an IP address bound to a network interface on a subnet in the - route's `zone`. Therefore, if an incoming packet matches a route with a - `next_hop` of an internet-bound IP address or a VPN gateway connection, the - packet will be dropped. - :attr List[RouteReference] routes: The routes for this routing table. - :attr List[SubnetReference] subnets: The subnets to which this routing table is - attached. + :attr str crn: The security group's CRN. + :attr str href: The security group's canonical URL. + :attr str id: The unique identifier for this security group. + :attr str name: The user-defined name for this security group. Names must be + unique within the VPC the security group resides in. + :attr ResourceGroupReference resource_group: The resource group for this + security group. + :attr List[SecurityGroupRule] rules: The rules for this security group. If no + rules exist, all traffic will be denied. + :attr List[SecurityGroupTargetReference] targets: The targets for this security + group. + :attr VPCReference vpc: The VPC this security group is a part of. """ def __init__(self, created_at: datetime, + crn: str, href: str, id: str, - is_default: bool, - lifecycle_state: str, name: str, - resource_type: str, - route_direct_link_ingress: bool, - route_transit_gateway_ingress: bool, - route_vpc_zone_ingress: bool, - routes: List['RouteReference'], - subnets: List['SubnetReference']) -> None: + resource_group: 'ResourceGroupReference', + rules: List['SecurityGroupRule'], + targets: List['SecurityGroupTargetReference'], + vpc: 'VPCReference') -> None: """ - Initialize a RoutingTable object. + Initialize a SecurityGroup object. - :param datetime created_at: The date and time that this routing table was + :param datetime created_at: The date and time that this security group was created. - :param str href: The URL for this routing table. - :param str id: The unique identifier for this routing table. - :param bool is_default: Indicates whether this is the default routing table - for this VPC. - :param str lifecycle_state: The lifecycle state of the routing table. - :param str name: The user-defined name for this routing table. - :param str resource_type: The resource type. - :param bool route_direct_link_ingress: Indicates whether this routing table - is used to route traffic that originates from - [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. - Incoming traffic will be routed according to the routing table with one - exception: routes with an `action` of `deliver` are treated as `drop` - unless the `next_hop` is an IP address bound to a network interface on a - subnet in the route's `zone`. Therefore, if an incoming packet matches a - route with a `next_hop` of an internet-bound IP address or a VPN gateway - connection, the packet will be dropped. - :param bool route_transit_gateway_ingress: Indicates whether this routing - table is used to route traffic that originates from from [Transit - Gateway](https://cloud.ibm.com/cloud/transit-gateway/) to this VPC. - Incoming traffic will be routed according to the routing table with one - exception: routes with an `action` of `deliver` are treated as `drop` - unless the `next_hop` is an IP address bound to a network interface on a - subnet in the route's `zone`. Therefore, if an incoming packet matches a - route with a `next_hop` of an internet-bound IP address or a VPN gateway - connection, the packet will be dropped. - :param bool route_vpc_zone_ingress: Indicates whether this routing table is - used to route traffic that originates from subnets in other zones in this - VPC. - Incoming traffic will be routed according to the routing table with one - exception: routes with an `action` of `deliver` are treated as `drop` - unless the `next_hop` is an IP address bound to a network interface on a - subnet in the route's `zone`. Therefore, if an incoming packet matches a - route with a `next_hop` of an internet-bound IP address or a VPN gateway - connection, the packet will be dropped. - :param List[RouteReference] routes: The routes for this routing table. - :param List[SubnetReference] subnets: The subnets to which this routing - table is attached. + :param str crn: The security group's CRN. + :param str href: The security group's canonical URL. + :param str id: The unique identifier for this security group. + :param str name: The user-defined name for this security group. Names must + be unique within the VPC the security group resides in. + :param ResourceGroupReference resource_group: The resource group for this + security group. + :param List[SecurityGroupRule] rules: The rules for this security group. If + no rules exist, all traffic will be denied. + :param List[SecurityGroupTargetReference] targets: The targets for this + security group. + :param VPCReference vpc: The VPC this security group is a part of. """ self.created_at = created_at + self.crn = crn self.href = href self.id = id - self.is_default = is_default - self.lifecycle_state = lifecycle_state self.name = name - self.resource_type = resource_type - self.route_direct_link_ingress = route_direct_link_ingress - self.route_transit_gateway_ingress = route_transit_gateway_ingress - self.route_vpc_zone_ingress = route_vpc_zone_ingress - self.routes = routes - self.subnets = subnets + self.resource_group = resource_group + self.rules = rules + self.targets = targets + self.vpc = vpc @classmethod - def from_dict(cls, _dict: Dict) -> 'RoutingTable': - """Initialize a RoutingTable object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SecurityGroup': + """Initialize a SecurityGroup object from a json dictionary.""" args = {} if 'created_at' in _dict: args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError('Required property \'created_at\' not present in RoutingTable JSON') + raise ValueError('Required property \'created_at\' not present in SecurityGroup JSON') + if 'crn' in _dict: + args['crn'] = _dict.get('crn') + else: + raise ValueError('Required property \'crn\' not present in SecurityGroup JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in RoutingTable JSON') + raise ValueError('Required property \'href\' not present in SecurityGroup JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in RoutingTable JSON') - if 'is_default' in _dict: - args['is_default'] = _dict.get('is_default') - else: - raise ValueError('Required property \'is_default\' not present in RoutingTable JSON') - if 'lifecycle_state' in _dict: - args['lifecycle_state'] = _dict.get('lifecycle_state') - else: - raise ValueError('Required property \'lifecycle_state\' not present in RoutingTable JSON') + raise ValueError('Required property \'id\' not present in SecurityGroup JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in RoutingTable JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in RoutingTable JSON') - if 'route_direct_link_ingress' in _dict: - args['route_direct_link_ingress'] = _dict.get('route_direct_link_ingress') - else: - raise ValueError('Required property \'route_direct_link_ingress\' not present in RoutingTable JSON') - if 'route_transit_gateway_ingress' in _dict: - args['route_transit_gateway_ingress'] = _dict.get('route_transit_gateway_ingress') + raise ValueError('Required property \'name\' not present in SecurityGroup JSON') + if 'resource_group' in _dict: + args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) else: - raise ValueError('Required property \'route_transit_gateway_ingress\' not present in RoutingTable JSON') - if 'route_vpc_zone_ingress' in _dict: - args['route_vpc_zone_ingress'] = _dict.get('route_vpc_zone_ingress') + raise ValueError('Required property \'resource_group\' not present in SecurityGroup JSON') + if 'rules' in _dict: + args['rules'] = [SecurityGroupRule.from_dict(x) for x in _dict.get('rules')] else: - raise ValueError('Required property \'route_vpc_zone_ingress\' not present in RoutingTable JSON') - if 'routes' in _dict: - args['routes'] = [RouteReference.from_dict(x) for x in _dict.get('routes')] + raise ValueError('Required property \'rules\' not present in SecurityGroup JSON') + if 'targets' in _dict: + args['targets'] = _dict.get('targets') else: - raise ValueError('Required property \'routes\' not present in RoutingTable JSON') - if 'subnets' in _dict: - args['subnets'] = [SubnetReference.from_dict(x) for x in _dict.get('subnets')] + raise ValueError('Required property \'targets\' not present in SecurityGroup JSON') + if 'vpc' in _dict: + args['vpc'] = VPCReference.from_dict(_dict.get('vpc')) else: - raise ValueError('Required property \'subnets\' not present in RoutingTable JSON') + raise ValueError('Required property \'vpc\' not present in SecurityGroup JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RoutingTable object from a json dictionary.""" + """Initialize a SecurityGroup object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -49839,28 +53623,28 @@ def to_dict(self) -> Dict: _dict = {} if hasattr(self, 'created_at') and self.created_at is not None: _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id - if hasattr(self, 'is_default') and self.is_default is not None: - _dict['is_default'] = self.is_default - if hasattr(self, 'lifecycle_state') and self.lifecycle_state is not None: - _dict['lifecycle_state'] = self.lifecycle_state if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type - if hasattr(self, 'route_direct_link_ingress') and self.route_direct_link_ingress is not None: - _dict['route_direct_link_ingress'] = self.route_direct_link_ingress - if hasattr(self, 'route_transit_gateway_ingress') and self.route_transit_gateway_ingress is not None: - _dict['route_transit_gateway_ingress'] = self.route_transit_gateway_ingress - if hasattr(self, 'route_vpc_zone_ingress') and self.route_vpc_zone_ingress is not None: - _dict['route_vpc_zone_ingress'] = self.route_vpc_zone_ingress - if hasattr(self, 'routes') and self.routes is not None: - _dict['routes'] = [x.to_dict() for x in self.routes] - if hasattr(self, 'subnets') and self.subnets is not None: - _dict['subnets'] = [x.to_dict() for x in self.subnets] + if hasattr(self, 'resource_group') and self.resource_group is not None: + _dict['resource_group'] = self.resource_group.to_dict() + if hasattr(self, 'rules') and self.rules is not None: + _dict['rules'] = [x.to_dict() for x in self.rules] + if hasattr(self, 'targets') and self.targets is not None: + targets_list = [] + for x in self.targets: + if isinstance(x, dict): + targets_list.append(x) + else: + targets_list.append(x.to_dict()) + _dict['targets'] = targets_list + if hasattr(self, 'vpc') and self.vpc is not None: + _dict['vpc'] = self.vpc.to_dict() return _dict def _to_dict(self): @@ -49868,106 +53652,86 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RoutingTable object.""" + """Return a `str` version of this SecurityGroup object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RoutingTable') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'RoutingTable') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - - class LifecycleStateEnum(str, Enum): - """ - The lifecycle state of the routing table. - """ - DELETING = 'deleting' - FAILED = 'failed' - PENDING = 'pending' - STABLE = 'stable' - SUSPENDED = 'suspended' - UPDATING = 'updating' - WAITING = 'waiting' - - - class ResourceTypeEnum(str, Enum): - """ - The resource type. - """ - ROUTING_TABLE = 'routing_table' + def __eq__(self, other: 'SecurityGroup') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + def __ne__(self, other: 'SecurityGroup') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other -class RoutingTableCollection(): +class SecurityGroupCollection(): """ - RoutingTableCollection. + SecurityGroupCollection. - :attr RoutingTableCollectionFirst first: A link to the first page of resources. + :attr SecurityGroupCollectionFirst first: A link to the first page of resources. :attr int limit: The maximum number of resources that can be returned by the request. - :attr RoutingTableCollectionNext next: (optional) A link to the next page of + :attr SecurityGroupCollectionNext next: (optional) A link to the next page of resources. This property is present for all pages except the last page. - :attr List[RoutingTable] routing_tables: Collection of routing tables. + :attr List[SecurityGroup] security_groups: Collection of security groups. :attr int total_count: The total number of resources across all pages. """ def __init__(self, - first: 'RoutingTableCollectionFirst', + first: 'SecurityGroupCollectionFirst', limit: int, - routing_tables: List['RoutingTable'], + security_groups: List['SecurityGroup'], total_count: int, *, - next: 'RoutingTableCollectionNext' = None) -> None: + next: 'SecurityGroupCollectionNext' = None) -> None: """ - Initialize a RoutingTableCollection object. + Initialize a SecurityGroupCollection object. - :param RoutingTableCollectionFirst first: A link to the first page of + :param SecurityGroupCollectionFirst first: A link to the first page of resources. :param int limit: The maximum number of resources that can be returned by the request. - :param List[RoutingTable] routing_tables: Collection of routing tables. + :param List[SecurityGroup] security_groups: Collection of security groups. :param int total_count: The total number of resources across all pages. - :param RoutingTableCollectionNext next: (optional) A link to the next page + :param SecurityGroupCollectionNext next: (optional) A link to the next page of resources. This property is present for all pages except the last page. """ self.first = first self.limit = limit self.next = next - self.routing_tables = routing_tables + self.security_groups = security_groups self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'RoutingTableCollection': - """Initialize a RoutingTableCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SecurityGroupCollection': + """Initialize a SecurityGroupCollection object from a json dictionary.""" args = {} if 'first' in _dict: - args['first'] = RoutingTableCollectionFirst.from_dict(_dict.get('first')) + args['first'] = SecurityGroupCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'first\' not present in RoutingTableCollection JSON') + raise ValueError('Required property \'first\' not present in SecurityGroupCollection JSON') if 'limit' in _dict: args['limit'] = _dict.get('limit') else: - raise ValueError('Required property \'limit\' not present in RoutingTableCollection JSON') + raise ValueError('Required property \'limit\' not present in SecurityGroupCollection JSON') if 'next' in _dict: - args['next'] = RoutingTableCollectionNext.from_dict(_dict.get('next')) - if 'routing_tables' in _dict: - args['routing_tables'] = [RoutingTable.from_dict(x) for x in _dict.get('routing_tables')] + args['next'] = SecurityGroupCollectionNext.from_dict(_dict.get('next')) + if 'security_groups' in _dict: + args['security_groups'] = [SecurityGroup.from_dict(x) for x in _dict.get('security_groups')] else: - raise ValueError('Required property \'routing_tables\' not present in RoutingTableCollection JSON') + raise ValueError('Required property \'security_groups\' not present in SecurityGroupCollection JSON') if 'total_count' in _dict: args['total_count'] = _dict.get('total_count') else: - raise ValueError('Required property \'total_count\' not present in RoutingTableCollection JSON') + raise ValueError('Required property \'total_count\' not present in SecurityGroupCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RoutingTableCollection object from a json dictionary.""" + """Initialize a SecurityGroupCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -49979,8 +53743,8 @@ def to_dict(self) -> Dict: _dict['limit'] = self.limit if hasattr(self, 'next') and self.next is not None: _dict['next'] = self.next.to_dict() - if hasattr(self, 'routing_tables') and self.routing_tables is not None: - _dict['routing_tables'] = [x.to_dict() for x in self.routing_tables] + if hasattr(self, 'security_groups') and self.security_groups is not None: + _dict['security_groups'] = [x.to_dict() for x in self.security_groups] if hasattr(self, 'total_count') and self.total_count is not None: _dict['total_count'] = self.total_count return _dict @@ -49990,20 +53754,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RoutingTableCollection object.""" + """Return a `str` version of this SecurityGroupCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RoutingTableCollection') -> bool: + def __eq__(self, other: 'SecurityGroupCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'RoutingTableCollection') -> bool: + def __ne__(self, other: 'SecurityGroupCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class RoutingTableCollectionFirst(): +class SecurityGroupCollectionFirst(): """ A link to the first page of resources. @@ -50013,25 +53777,25 @@ class RoutingTableCollectionFirst(): def __init__(self, href: str) -> None: """ - Initialize a RoutingTableCollectionFirst object. + Initialize a SecurityGroupCollectionFirst object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'RoutingTableCollectionFirst': - """Initialize a RoutingTableCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SecurityGroupCollectionFirst': + """Initialize a SecurityGroupCollectionFirst object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in RoutingTableCollectionFirst JSON') + raise ValueError('Required property \'href\' not present in SecurityGroupCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RoutingTableCollectionFirst object from a json dictionary.""" + """Initialize a SecurityGroupCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -50046,20 +53810,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RoutingTableCollectionFirst object.""" + """Return a `str` version of this SecurityGroupCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RoutingTableCollectionFirst') -> bool: + def __eq__(self, other: 'SecurityGroupCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'RoutingTableCollectionFirst') -> bool: + def __ne__(self, other: 'SecurityGroupCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class RoutingTableCollectionNext(): +class SecurityGroupCollectionNext(): """ A link to the next page of resources. This property is present for all pages except the last page. @@ -50070,25 +53834,25 @@ class RoutingTableCollectionNext(): def __init__(self, href: str) -> None: """ - Initialize a RoutingTableCollectionNext object. + Initialize a SecurityGroupCollectionNext object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'RoutingTableCollectionNext': - """Initialize a RoutingTableCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SecurityGroupCollectionNext': + """Initialize a SecurityGroupCollectionNext object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in RoutingTableCollectionNext JSON') + raise ValueError('Required property \'href\' not present in SecurityGroupCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RoutingTableCollectionNext object from a json dictionary.""" + """Initialize a SecurityGroupCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -50103,158 +53867,64 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RoutingTableCollectionNext object.""" + """Return a `str` version of this SecurityGroupCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RoutingTableCollectionNext') -> bool: + def __eq__(self, other: 'SecurityGroupCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'RoutingTableCollectionNext') -> bool: + def __ne__(self, other: 'SecurityGroupCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class RoutingTableIdentity(): +class SecurityGroupIdentity(): """ - Identifies a routing table by a unique property. + Identifies a security group by a unique property. """ def __init__(self) -> None: """ - Initialize a RoutingTableIdentity object. + Initialize a SecurityGroupIdentity object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['RoutingTableIdentityById', 'RoutingTableIdentityByHref'])) + ", ".join(['SecurityGroupIdentityById', 'SecurityGroupIdentityByCRN', 'SecurityGroupIdentityByHref'])) raise Exception(msg) -class RoutingTablePatch(): +class SecurityGroupPatch(): """ - RoutingTablePatch. + SecurityGroupPatch. - :attr str name: (optional) The user-defined name for this routing table. Names - must be unique within the VPC the routing table resides in. - :attr bool route_direct_link_ingress: (optional) Indicates whether this routing - table is used to route traffic that originates from - [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. Updating to `true` - selects this routing table, provided no other routing table in the VPC already - has this property set to `true`, and no subnets are attached to this routing - table. Updating to `false` deselects this routing table. - Incoming traffic will be routed according to the routing table with one - exception: routes with an `action` of `deliver` are treated as `drop` unless the - `next_hop` is an IP address bound to a network interface on a subnet in the - route's `zone`. Therefore, if an incoming packet matches a route with a - `next_hop` of an internet-bound IP address or a VPN gateway connection, the - packet will be dropped. - :attr bool route_transit_gateway_ingress: (optional) Indicates whether this - routing table is used to route traffic that originates from - [Transit Gateway](https://cloud.ibm.com/cloud/transit-gateway/) to this VPC. - Updating to - `true` selects this routing table, provided no other routing table in the VPC - already has this property set to `true`, and no subnets are attached to this - routing table. Updating to `false` deselects this routing table. - Incoming traffic will be routed according to the routing table with one - exception: routes with an `action` of `deliver` are treated as `drop` unless the - `next_hop` is an IP address bound to a network interface on a subnet in the - route's `zone`. Therefore, if an incoming packet matches a route with a - `next_hop` of an internet-bound IP address or a VPN gateway connection, the - packet will be dropped. - If [Classic - Access](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure) - is enabled for this VPC, and this property is set to `true`, its incoming - traffic will also be routed according to this routing table. - :attr bool route_vpc_zone_ingress: (optional) Indicates whether this routing - table is used to route traffic that originates from subnets in other zones in - this VPC. Updating to `true` selects this routing table, provided no other - routing table in the VPC already has this property set to `true`, and no subnets - are attached to this routing table. Updating to `false` deselects this routing - table. - Incoming traffic will be routed according to the routing table with one - exception: routes with an `action` of `deliver` are treated as `drop` unless the - `next_hop` is an IP address bound to a network interface on a subnet in the - route's `zone`. Therefore, if an incoming packet matches a route with a - `next_hop` of an internet-bound IP address or a VPN gateway connection, the - packet will be dropped. + :attr str name: (optional) The user-defined name for this security group. Names + must be unique within the VPC the security group resides in. """ def __init__(self, *, - name: str = None, - route_direct_link_ingress: bool = None, - route_transit_gateway_ingress: bool = None, - route_vpc_zone_ingress: bool = None) -> None: + name: str = None) -> None: """ - Initialize a RoutingTablePatch object. + Initialize a SecurityGroupPatch object. - :param str name: (optional) The user-defined name for this routing table. - Names must be unique within the VPC the routing table resides in. - :param bool route_direct_link_ingress: (optional) Indicates whether this - routing table is used to route traffic that originates from - [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. Updating to - `true` selects this routing table, provided no other routing table in the - VPC already has this property set to `true`, and no subnets are attached to - this routing table. Updating to `false` deselects this routing table. - Incoming traffic will be routed according to the routing table with one - exception: routes with an `action` of `deliver` are treated as `drop` - unless the `next_hop` is an IP address bound to a network interface on a - subnet in the route's `zone`. Therefore, if an incoming packet matches a - route with a `next_hop` of an internet-bound IP address or a VPN gateway - connection, the packet will be dropped. - :param bool route_transit_gateway_ingress: (optional) Indicates whether - this routing table is used to route traffic that originates from - [Transit Gateway](https://cloud.ibm.com/cloud/transit-gateway/) to this - VPC. Updating to - `true` selects this routing table, provided no other routing table in the - VPC already has this property set to `true`, and no subnets are attached to - this routing table. Updating to `false` deselects this routing table. - Incoming traffic will be routed according to the routing table with one - exception: routes with an `action` of `deliver` are treated as `drop` - unless the `next_hop` is an IP address bound to a network interface on a - subnet in the route's `zone`. Therefore, if an incoming packet matches a - route with a `next_hop` of an internet-bound IP address or a VPN gateway - connection, the packet will be dropped. - If [Classic - Access](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure) - is enabled for this VPC, and this property is set to `true`, its incoming - traffic will also be routed according to this routing table. - :param bool route_vpc_zone_ingress: (optional) Indicates whether this - routing table is used to route traffic that originates from subnets in - other zones in this VPC. Updating to `true` selects this routing table, - provided no other routing table in the VPC already has this property set to - `true`, and no subnets are attached to this routing table. Updating to - `false` deselects this routing table. - Incoming traffic will be routed according to the routing table with one - exception: routes with an `action` of `deliver` are treated as `drop` - unless the `next_hop` is an IP address bound to a network interface on a - subnet in the route's `zone`. Therefore, if an incoming packet matches a - route with a `next_hop` of an internet-bound IP address or a VPN gateway - connection, the packet will be dropped. + :param str name: (optional) The user-defined name for this security group. + Names must be unique within the VPC the security group resides in. """ self.name = name - self.route_direct_link_ingress = route_direct_link_ingress - self.route_transit_gateway_ingress = route_transit_gateway_ingress - self.route_vpc_zone_ingress = route_vpc_zone_ingress @classmethod - def from_dict(cls, _dict: Dict) -> 'RoutingTablePatch': - """Initialize a RoutingTablePatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SecurityGroupPatch': + """Initialize a SecurityGroupPatch object from a json dictionary.""" args = {} if 'name' in _dict: args['name'] = _dict.get('name') - if 'route_direct_link_ingress' in _dict: - args['route_direct_link_ingress'] = _dict.get('route_direct_link_ingress') - if 'route_transit_gateway_ingress' in _dict: - args['route_transit_gateway_ingress'] = _dict.get('route_transit_gateway_ingress') - if 'route_vpc_zone_ingress' in _dict: - args['route_vpc_zone_ingress'] = _dict.get('route_vpc_zone_ingress') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RoutingTablePatch object from a json dictionary.""" + """Initialize a SecurityGroupPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -50262,12 +53932,6 @@ def to_dict(self) -> Dict: _dict = {} if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'route_direct_link_ingress') and self.route_direct_link_ingress is not None: - _dict['route_direct_link_ingress'] = self.route_direct_link_ingress - if hasattr(self, 'route_transit_gateway_ingress') and self.route_transit_gateway_ingress is not None: - _dict['route_transit_gateway_ingress'] = self.route_transit_gateway_ingress - if hasattr(self, 'route_vpc_zone_ingress') and self.route_vpc_zone_ingress is not None: - _dict['route_vpc_zone_ingress'] = self.route_vpc_zone_ingress return _dict def _to_dict(self): @@ -50275,98 +53939,321 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RoutingTablePatch object.""" + """Return a `str` version of this SecurityGroupPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RoutingTablePatch') -> bool: + def __eq__(self, other: 'SecurityGroupPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'RoutingTablePatch') -> bool: + def __ne__(self, other: 'SecurityGroupPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class RoutingTableReference(): +class SecurityGroupReference(): """ - RoutingTableReference. + SecurityGroupReference. - :attr RoutingTableReferenceDeleted deleted: (optional) If present, this property - indicates the referenced resource has been deleted and provides + :attr str crn: The security group's CRN. + :attr SecurityGroupReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides some supplementary information. - :attr str href: The URL for this routing table. - :attr str id: The unique identifier for this routing table. - :attr str name: The user-defined name for this routing table. - :attr str resource_type: The resource type. + :attr str href: The security group's canonical URL. + :attr str id: The unique identifier for this security group. + :attr str name: The user-defined name for this security group. Names must be + unique within the VPC the security group resides in. """ def __init__(self, + crn: str, href: str, id: str, name: str, - resource_type: str, *, - deleted: 'RoutingTableReferenceDeleted' = None) -> None: + deleted: 'SecurityGroupReferenceDeleted' = None) -> None: + """ + Initialize a SecurityGroupReference object. + + :param str crn: The security group's CRN. + :param str href: The security group's canonical URL. + :param str id: The unique identifier for this security group. + :param str name: The user-defined name for this security group. Names must + be unique within the VPC the security group resides in. + :param SecurityGroupReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides + some supplementary information. + """ + self.crn = crn + self.deleted = deleted + self.href = href + self.id = id + self.name = name + + @classmethod + def from_dict(cls, _dict: Dict) -> 'SecurityGroupReference': + """Initialize a SecurityGroupReference object from a json dictionary.""" + args = {} + if 'crn' in _dict: + args['crn'] = _dict.get('crn') + else: + raise ValueError('Required property \'crn\' not present in SecurityGroupReference JSON') + if 'deleted' in _dict: + args['deleted'] = SecurityGroupReferenceDeleted.from_dict(_dict.get('deleted')) + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in SecurityGroupReference JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in SecurityGroupReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in SecurityGroupReference JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a SecurityGroupReference object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this SecurityGroupReference object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'SecurityGroupReference') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'SecurityGroupReference') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class SecurityGroupReferenceDeleted(): + """ + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. + + :attr str more_info: Link to documentation about deleted resources. + """ + + def __init__(self, + more_info: str) -> None: + """ + Initialize a SecurityGroupReferenceDeleted object. + + :param str more_info: Link to documentation about deleted resources. + """ + self.more_info = more_info + + @classmethod + def from_dict(cls, _dict: Dict) -> 'SecurityGroupReferenceDeleted': + """Initialize a SecurityGroupReferenceDeleted object from a json dictionary.""" + args = {} + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') + else: + raise ValueError('Required property \'more_info\' not present in SecurityGroupReferenceDeleted JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a SecurityGroupReferenceDeleted object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this SecurityGroupReferenceDeleted object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'SecurityGroupReferenceDeleted') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'SecurityGroupReferenceDeleted') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class SecurityGroupRule(): + """ + SecurityGroupRule. + + :attr str direction: The direction of traffic to enforce, either `inbound` or + `outbound`. + :attr str href: The URL for this security group rule. + :attr str id: The unique identifier for this security group rule. + :attr str ip_version: The IP version to enforce. The format of `remote.address` + or `remote.cidr_block` must match this property, if they are used. + Alternatively, if `remote` references a security group, then this rule only + applies to IP addresses (network interfaces) in that group matching this IP + version. + :attr str protocol: The protocol to enforce. + :attr SecurityGroupRuleRemote remote: The IP addresses or security groups from + which this rule allows traffic (or to which, + for outbound rules). Can be specified as an IP address, a CIDR block, or a + security + group. A CIDR block of `0.0.0.0/0` allows traffic from any source (or to any + source, + for outbound rules). + """ + + def __init__(self, + direction: str, + href: str, + id: str, + ip_version: str, + protocol: str, + remote: 'SecurityGroupRuleRemote') -> None: + """ + Initialize a SecurityGroupRule object. + + :param str direction: The direction of traffic to enforce, either `inbound` + or `outbound`. + :param str href: The URL for this security group rule. + :param str id: The unique identifier for this security group rule. + :param str ip_version: The IP version to enforce. The format of + `remote.address` or `remote.cidr_block` must match this property, if they + are used. Alternatively, if `remote` references a security group, then this + rule only applies to IP addresses (network interfaces) in that group + matching this IP version. + :param str protocol: The protocol to enforce. + :param SecurityGroupRuleRemote remote: The IP addresses or security groups + from which this rule allows traffic (or to which, + for outbound rules). Can be specified as an IP address, a CIDR block, or a + security + group. A CIDR block of `0.0.0.0/0` allows traffic from any source (or to + any source, + for outbound rules). + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['SecurityGroupRuleSecurityGroupRuleProtocolAll', 'SecurityGroupRuleSecurityGroupRuleProtocolICMP', 'SecurityGroupRuleSecurityGroupRuleProtocolTCPUDP'])) + raise Exception(msg) + + @classmethod + def from_dict(cls, _dict: Dict) -> 'SecurityGroupRule': + """Initialize a SecurityGroupRule object from a json dictionary.""" + disc_class = cls._get_class_by_discriminator(_dict) + if disc_class != cls: + return disc_class.from_dict(_dict) + msg = ("Cannot convert dictionary into an instance of base class 'SecurityGroupRule'. " + + "The discriminator value should map to a valid subclass: {1}").format( + ", ".join(['SecurityGroupRuleSecurityGroupRuleProtocolAll', 'SecurityGroupRuleSecurityGroupRuleProtocolICMP', 'SecurityGroupRuleSecurityGroupRuleProtocolTCPUDP'])) + raise Exception(msg) + + @classmethod + def _from_dict(cls, _dict: Dict): + """Initialize a SecurityGroupRule object from a json dictionary.""" + return cls.from_dict(_dict) + + @classmethod + def _get_class_by_discriminator(cls, _dict: Dict) -> object: + mapping = {} + mapping['all'] = 'SecurityGroupRuleSecurityGroupRuleProtocolAll' + mapping['icmp'] = 'SecurityGroupRuleSecurityGroupRuleProtocolICMP' + mapping['tcp'] = 'SecurityGroupRuleSecurityGroupRuleProtocolTCPUDP' + mapping['udp'] = 'SecurityGroupRuleSecurityGroupRuleProtocolTCPUDP' + disc_value = _dict.get('protocol') + if disc_value is None: + raise ValueError('Discriminator property \'protocol\' not found in SecurityGroupRule JSON') + class_name = mapping.get(disc_value, disc_value) + try: + disc_class = getattr(sys.modules[__name__], class_name) + except AttributeError: + disc_class = cls + if isinstance(disc_class, object): + return disc_class + raise TypeError('%s is not a discriminator class' % class_name) + + class DirectionEnum(str, Enum): + """ + The direction of traffic to enforce, either `inbound` or `outbound`. + """ + INBOUND = 'inbound' + OUTBOUND = 'outbound' + + + class IpVersionEnum(str, Enum): + """ + The IP version to enforce. The format of `remote.address` or `remote.cidr_block` + must match this property, if they are used. Alternatively, if `remote` references + a security group, then this rule only applies to IP addresses (network interfaces) + in that group matching this IP version. + """ + IPV4 = 'ipv4' + + +class SecurityGroupRuleCollection(): + """ + Collection of rules in a security group. + + :attr List[SecurityGroupRule] rules: Array of rules. + """ + + def __init__(self, + rules: List['SecurityGroupRule']) -> None: """ - Initialize a RoutingTableReference object. + Initialize a SecurityGroupRuleCollection object. - :param str href: The URL for this routing table. - :param str id: The unique identifier for this routing table. - :param str name: The user-defined name for this routing table. - :param str resource_type: The resource type. - :param RoutingTableReferenceDeleted deleted: (optional) If present, this - property indicates the referenced resource has been deleted and provides - some supplementary information. + :param List[SecurityGroupRule] rules: Array of rules. """ - self.deleted = deleted - self.href = href - self.id = id - self.name = name - self.resource_type = resource_type + self.rules = rules @classmethod - def from_dict(cls, _dict: Dict) -> 'RoutingTableReference': - """Initialize a RoutingTableReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SecurityGroupRuleCollection': + """Initialize a SecurityGroupRuleCollection object from a json dictionary.""" args = {} - if 'deleted' in _dict: - args['deleted'] = RoutingTableReferenceDeleted.from_dict(_dict.get('deleted')) - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in RoutingTableReference JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in RoutingTableReference JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in RoutingTableReference JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') + if 'rules' in _dict: + args['rules'] = [SecurityGroupRule.from_dict(x) for x in _dict.get('rules')] else: - raise ValueError('Required property \'resource_type\' not present in RoutingTableReference JSON') + raise ValueError('Required property \'rules\' not present in SecurityGroupRuleCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RoutingTableReference object from a json dictionary.""" + """Initialize a SecurityGroupRuleCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type + if hasattr(self, 'rules') and self.rules is not None: + _dict['rules'] = [x.to_dict() for x in self.rules] return _dict def _to_dict(self): @@ -50374,63 +54261,141 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RoutingTableReference object.""" + """Return a `str` version of this SecurityGroupRuleCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RoutingTableReference') -> bool: + def __eq__(self, other: 'SecurityGroupRuleCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'RoutingTableReference') -> bool: + def __ne__(self, other: 'SecurityGroupRuleCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ResourceTypeEnum(str, Enum): - """ - The resource type. - """ - ROUTING_TABLE = 'routing_table' - - -class RoutingTableReferenceDeleted(): +class SecurityGroupRulePatch(): """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. + SecurityGroupRulePatch. - :attr str more_info: Link to documentation about deleted resources. + :attr int code: (optional) The ICMP traffic code to allow. Specify `null` to + remove an existing ICMP traffic code value. + :attr str direction: (optional) The direction of traffic to enforce, either + `inbound` or `outbound`. + :attr str ip_version: (optional) The IP version to enforce. The format of + `remote.address` or `remote.cidr_block` must match this property, if they are + used. Alternatively, if `remote` references a security group, then this rule + only applies to IP addresses (network interfaces) in that group matching this IP + version. + :attr int port_max: (optional) The inclusive upper bound of the protocol port + range. Specify `null` to clear an existing upper bound. If a lower bound has + been set, the upper bound must also be set, and must not be smaller. + :attr int port_min: (optional) The inclusive lower bound of the protocol port + range. Specify `null` to clear an existing lower bound. If an upper bound has + been set, the lower bound must also be set, and must not be larger. + :attr SecurityGroupRuleRemotePatch remote: (optional) The IP addresses or + security groups from which this rule will allow traffic (or to + which, for outbound rules). Can be specified as an IP address, a CIDR block, or + a + security group. A CIDR block of `0.0.0.0/0` will allow traffic from any source + (or to + any source, for outbound rules). + :attr int type: (optional) The ICMP traffic type to allow. Specify `null` to + remove an existing ICMP traffic type value. """ def __init__(self, - more_info: str) -> None: + *, + code: int = None, + direction: str = None, + ip_version: str = None, + port_max: int = None, + port_min: int = None, + remote: 'SecurityGroupRuleRemotePatch' = None, + type: int = None) -> None: """ - Initialize a RoutingTableReferenceDeleted object. + Initialize a SecurityGroupRulePatch object. - :param str more_info: Link to documentation about deleted resources. + :param int code: (optional) The ICMP traffic code to allow. Specify `null` + to remove an existing ICMP traffic code value. + :param str direction: (optional) The direction of traffic to enforce, + either `inbound` or `outbound`. + :param str ip_version: (optional) The IP version to enforce. The format of + `remote.address` or `remote.cidr_block` must match this property, if they + are used. Alternatively, if `remote` references a security group, then this + rule only applies to IP addresses (network interfaces) in that group + matching this IP version. + :param int port_max: (optional) The inclusive upper bound of the protocol + port range. Specify `null` to clear an existing upper bound. If a lower + bound has been set, the upper bound must also be set, and must not be + smaller. + :param int port_min: (optional) The inclusive lower bound of the protocol + port range. Specify `null` to clear an existing lower bound. If an upper + bound has been set, the lower bound must also be set, and must not be + larger. + :param SecurityGroupRuleRemotePatch remote: (optional) The IP addresses or + security groups from which this rule will allow traffic (or to + which, for outbound rules). Can be specified as an IP address, a CIDR + block, or a + security group. A CIDR block of `0.0.0.0/0` will allow traffic from any + source (or to + any source, for outbound rules). + :param int type: (optional) The ICMP traffic type to allow. Specify `null` + to remove an existing ICMP traffic type value. """ - self.more_info = more_info + self.code = code + self.direction = direction + self.ip_version = ip_version + self.port_max = port_max + self.port_min = port_min + self.remote = remote + self.type = type @classmethod - def from_dict(cls, _dict: Dict) -> 'RoutingTableReferenceDeleted': - """Initialize a RoutingTableReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SecurityGroupRulePatch': + """Initialize a SecurityGroupRulePatch object from a json dictionary.""" args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') - else: - raise ValueError('Required property \'more_info\' not present in RoutingTableReferenceDeleted JSON') + if 'code' in _dict: + args['code'] = _dict.get('code') + if 'direction' in _dict: + args['direction'] = _dict.get('direction') + if 'ip_version' in _dict: + args['ip_version'] = _dict.get('ip_version') + if 'port_max' in _dict: + args['port_max'] = _dict.get('port_max') + if 'port_min' in _dict: + args['port_min'] = _dict.get('port_min') + if 'remote' in _dict: + args['remote'] = _dict.get('remote') + if 'type' in _dict: + args['type'] = _dict.get('type') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RoutingTableReferenceDeleted object from a json dictionary.""" + """Initialize a SecurityGroupRulePatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'code') and self.code is not None: + _dict['code'] = self.code + if hasattr(self, 'direction') and self.direction is not None: + _dict['direction'] = self.direction + if hasattr(self, 'ip_version') and self.ip_version is not None: + _dict['ip_version'] = self.ip_version + if hasattr(self, 'port_max') and self.port_max is not None: + _dict['port_max'] = self.port_max + if hasattr(self, 'port_min') and self.port_min is not None: + _dict['port_min'] = self.port_min + if hasattr(self, 'remote') and self.remote is not None: + if isinstance(self.remote, dict): + _dict['remote'] = self.remote + else: + _dict['remote'] = self.remote.to_dict() + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type return _dict def _to_dict(self): @@ -50438,238 +54403,264 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RoutingTableReferenceDeleted object.""" + """Return a `str` version of this SecurityGroupRulePatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RoutingTableReferenceDeleted') -> bool: + def __eq__(self, other: 'SecurityGroupRulePatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'RoutingTableReferenceDeleted') -> bool: + def __ne__(self, other: 'SecurityGroupRulePatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class SecurityGroup(): + class DirectionEnum(str, Enum): + """ + The direction of traffic to enforce, either `inbound` or `outbound`. + """ + INBOUND = 'inbound' + OUTBOUND = 'outbound' + + + class IpVersionEnum(str, Enum): + """ + The IP version to enforce. The format of `remote.address` or `remote.cidr_block` + must match this property, if they are used. Alternatively, if `remote` references + a security group, then this rule only applies to IP addresses (network interfaces) + in that group matching this IP version. + """ + IPV4 = 'ipv4' + + +class SecurityGroupRulePrototype(): """ - SecurityGroup. + SecurityGroupRulePrototype. - :attr datetime created_at: The date and time that this security group was - created. - :attr str crn: The security group's CRN. - :attr str href: The security group's canonical URL. - :attr str id: The unique identifier for this security group. - :attr str name: The user-defined name for this security group. Names must be - unique within the VPC the security group resides in. - :attr ResourceGroupReference resource_group: The resource group for this - security group. - :attr List[SecurityGroupRule] rules: The rules for this security group. If no - rules exist, all traffic will be denied. - :attr List[SecurityGroupTargetReference] targets: The targets for this security - group. - :attr VPCReference vpc: The VPC this security group is a part of. + :attr str direction: The direction of traffic to enforce, either `inbound` or + `outbound`. + :attr str ip_version: (optional) The IP version to enforce. The format of + `remote.address` or `remote.cidr_block` must match this property, if they are + used. Alternatively, if `remote` references a security group, then this rule + only applies to IP addresses (network interfaces) in that group matching this IP + version. + :attr str protocol: The protocol to enforce. + :attr SecurityGroupRuleRemotePrototype remote: (optional) The IP addresses or + security groups from which this rule will allow traffic (or to + which, for outbound rules). Can be specified as an IP address, a CIDR block, or + a + security group. If omitted, a CIDR block of `0.0.0.0/0` will be used to allow + traffic + from any source (or to any source, for outbound rules). """ def __init__(self, - created_at: datetime, - crn: str, - href: str, - id: str, - name: str, - resource_group: 'ResourceGroupReference', - rules: List['SecurityGroupRule'], - targets: List['SecurityGroupTargetReference'], - vpc: 'VPCReference') -> None: + direction: str, + protocol: str, + *, + ip_version: str = None, + remote: 'SecurityGroupRuleRemotePrototype' = None) -> None: """ - Initialize a SecurityGroup object. + Initialize a SecurityGroupRulePrototype object. - :param datetime created_at: The date and time that this security group was - created. - :param str crn: The security group's CRN. - :param str href: The security group's canonical URL. - :param str id: The unique identifier for this security group. - :param str name: The user-defined name for this security group. Names must - be unique within the VPC the security group resides in. - :param ResourceGroupReference resource_group: The resource group for this - security group. - :param List[SecurityGroupRule] rules: The rules for this security group. If - no rules exist, all traffic will be denied. - :param List[SecurityGroupTargetReference] targets: The targets for this - security group. - :param VPCReference vpc: The VPC this security group is a part of. + :param str direction: The direction of traffic to enforce, either `inbound` + or `outbound`. + :param str protocol: The protocol to enforce. + :param str ip_version: (optional) The IP version to enforce. The format of + `remote.address` or `remote.cidr_block` must match this property, if they + are used. Alternatively, if `remote` references a security group, then this + rule only applies to IP addresses (network interfaces) in that group + matching this IP version. + :param SecurityGroupRuleRemotePrototype remote: (optional) The IP addresses + or security groups from which this rule will allow traffic (or to + which, for outbound rules). Can be specified as an IP address, a CIDR + block, or a + security group. If omitted, a CIDR block of `0.0.0.0/0` will be used to + allow traffic + from any source (or to any source, for outbound rules). """ - self.created_at = created_at - self.crn = crn - self.href = href - self.id = id - self.name = name - self.resource_group = resource_group - self.rules = rules - self.targets = targets - self.vpc = vpc + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll', 'SecurityGroupRulePrototypeSecurityGroupRuleProtocolICMP', 'SecurityGroupRulePrototypeSecurityGroupRuleProtocolTCPUDP'])) + raise Exception(msg) @classmethod - def from_dict(cls, _dict: Dict) -> 'SecurityGroup': - """Initialize a SecurityGroup object from a json dictionary.""" - args = {} - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - else: - raise ValueError('Required property \'created_at\' not present in SecurityGroup JSON') - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in SecurityGroup JSON') - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in SecurityGroup JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in SecurityGroup JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in SecurityGroup JSON') - if 'resource_group' in _dict: - args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) - else: - raise ValueError('Required property \'resource_group\' not present in SecurityGroup JSON') - if 'rules' in _dict: - args['rules'] = [SecurityGroupRule.from_dict(x) for x in _dict.get('rules')] - else: - raise ValueError('Required property \'rules\' not present in SecurityGroup JSON') - if 'targets' in _dict: - args['targets'] = _dict.get('targets') - else: - raise ValueError('Required property \'targets\' not present in SecurityGroup JSON') - if 'vpc' in _dict: - args['vpc'] = VPCReference.from_dict(_dict.get('vpc')) - else: - raise ValueError('Required property \'vpc\' not present in SecurityGroup JSON') - return cls(**args) + def from_dict(cls, _dict: Dict) -> 'SecurityGroupRulePrototype': + """Initialize a SecurityGroupRulePrototype object from a json dictionary.""" + disc_class = cls._get_class_by_discriminator(_dict) + if disc_class != cls: + return disc_class.from_dict(_dict) + msg = ("Cannot convert dictionary into an instance of base class 'SecurityGroupRulePrototype'. " + + "The discriminator value should map to a valid subclass: {1}").format( + ", ".join(['SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll', 'SecurityGroupRulePrototypeSecurityGroupRuleProtocolICMP', 'SecurityGroupRulePrototypeSecurityGroupRuleProtocolTCPUDP'])) + raise Exception(msg) @classmethod - def _from_dict(cls, _dict): - """Initialize a SecurityGroup object from a json dictionary.""" + def _from_dict(cls, _dict: Dict): + """Initialize a SecurityGroupRulePrototype object from a json dictionary.""" return cls.from_dict(_dict) - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'resource_group') and self.resource_group is not None: - _dict['resource_group'] = self.resource_group.to_dict() - if hasattr(self, 'rules') and self.rules is not None: - _dict['rules'] = [x.to_dict() for x in self.rules] - if hasattr(self, 'targets') and self.targets is not None: - targets_list = [] - for x in self.targets: - if isinstance(x, dict): - targets_list.append(x) - else: - targets_list.append(x.to_dict()) - _dict['targets'] = targets_list - if hasattr(self, 'vpc') and self.vpc is not None: - _dict['vpc'] = self.vpc.to_dict() - return _dict + @classmethod + def _get_class_by_discriminator(cls, _dict: Dict) -> object: + mapping = {} + mapping['all'] = 'SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll' + mapping['icmp'] = 'SecurityGroupRulePrototypeSecurityGroupRuleProtocolICMP' + mapping['tcp'] = 'SecurityGroupRulePrototypeSecurityGroupRuleProtocolTCPUDP' + mapping['udp'] = 'SecurityGroupRulePrototypeSecurityGroupRuleProtocolTCPUDP' + disc_value = _dict.get('protocol') + if disc_value is None: + raise ValueError('Discriminator property \'protocol\' not found in SecurityGroupRulePrototype JSON') + class_name = mapping.get(disc_value, disc_value) + try: + disc_class = getattr(sys.modules[__name__], class_name) + except AttributeError: + disc_class = cls + if isinstance(disc_class, object): + return disc_class + raise TypeError('%s is not a discriminator class' % class_name) - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() + class DirectionEnum(str, Enum): + """ + The direction of traffic to enforce, either `inbound` or `outbound`. + """ + INBOUND = 'inbound' + OUTBOUND = 'outbound' - def __str__(self) -> str: - """Return a `str` version of this SecurityGroup object.""" - return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'SecurityGroup') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ + class IpVersionEnum(str, Enum): + """ + The IP version to enforce. The format of `remote.address` or `remote.cidr_block` + must match this property, if they are used. Alternatively, if `remote` references + a security group, then this rule only applies to IP addresses (network interfaces) + in that group matching this IP version. + """ + IPV4 = 'ipv4' - def __ne__(self, other: 'SecurityGroup') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other -class SecurityGroupCollection(): +class SecurityGroupRuleRemote(): """ - SecurityGroupCollection. + The IP addresses or security groups from which this rule allows traffic (or to which, + for outbound rules). Can be specified as an IP address, a CIDR block, or a security + group. A CIDR block of `0.0.0.0/0` allows traffic from any source (or to any source, + for outbound rules). - :attr SecurityGroupCollectionFirst first: A link to the first page of resources. + """ + + def __init__(self) -> None: + """ + Initialize a SecurityGroupRuleRemote object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['SecurityGroupRuleRemoteIP', 'SecurityGroupRuleRemoteCIDR', 'SecurityGroupRuleRemoteSecurityGroupReference'])) + raise Exception(msg) + +class SecurityGroupRuleRemotePatch(): + """ + The IP addresses or security groups from which this rule will allow traffic (or to + which, for outbound rules). Can be specified as an IP address, a CIDR block, or a + security group. A CIDR block of `0.0.0.0/0` will allow traffic from any source (or to + any source, for outbound rules). + + """ + + def __init__(self) -> None: + """ + Initialize a SecurityGroupRuleRemotePatch object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['SecurityGroupRuleRemotePatchIP', 'SecurityGroupRuleRemotePatchCIDR', 'SecurityGroupRuleRemotePatchSecurityGroupIdentity'])) + raise Exception(msg) + +class SecurityGroupRuleRemotePrototype(): + """ + The IP addresses or security groups from which this rule will allow traffic (or to + which, for outbound rules). Can be specified as an IP address, a CIDR block, or a + security group. If omitted, a CIDR block of `0.0.0.0/0` will be used to allow traffic + from any source (or to any source, for outbound rules). + + """ + + def __init__(self) -> None: + """ + Initialize a SecurityGroupRuleRemotePrototype object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['SecurityGroupRuleRemotePrototypeIP', 'SecurityGroupRuleRemotePrototypeCIDR', 'SecurityGroupRuleRemotePrototypeSecurityGroupIdentity'])) + raise Exception(msg) + +class SecurityGroupTargetCollection(): + """ + SecurityGroupTargetCollection. + + :attr SecurityGroupTargetCollectionFirst first: A link to the first page of + resources. :attr int limit: The maximum number of resources that can be returned by the request. - :attr SecurityGroupCollectionNext next: (optional) A link to the next page of - resources. This property is present for all pages + :attr SecurityGroupTargetCollectionNext next: (optional) A link to the next page + of resources. This property is present for all pages except the last page. - :attr List[SecurityGroup] security_groups: Collection of security groups. + :attr List[SecurityGroupTargetReference] targets: Collection of targets for this + security group. :attr int total_count: The total number of resources across all pages. """ def __init__(self, - first: 'SecurityGroupCollectionFirst', + first: 'SecurityGroupTargetCollectionFirst', limit: int, - security_groups: List['SecurityGroup'], + targets: List['SecurityGroupTargetReference'], total_count: int, *, - next: 'SecurityGroupCollectionNext' = None) -> None: + next: 'SecurityGroupTargetCollectionNext' = None) -> None: """ - Initialize a SecurityGroupCollection object. + Initialize a SecurityGroupTargetCollection object. - :param SecurityGroupCollectionFirst first: A link to the first page of - resources. + :param SecurityGroupTargetCollectionFirst first: A link to the first page + of resources. :param int limit: The maximum number of resources that can be returned by the request. - :param List[SecurityGroup] security_groups: Collection of security groups. + :param List[SecurityGroupTargetReference] targets: Collection of targets + for this security group. :param int total_count: The total number of resources across all pages. - :param SecurityGroupCollectionNext next: (optional) A link to the next page - of resources. This property is present for all pages + :param SecurityGroupTargetCollectionNext next: (optional) A link to the + next page of resources. This property is present for all pages except the last page. """ self.first = first self.limit = limit self.next = next - self.security_groups = security_groups + self.targets = targets self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'SecurityGroupCollection': - """Initialize a SecurityGroupCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SecurityGroupTargetCollection': + """Initialize a SecurityGroupTargetCollection object from a json dictionary.""" args = {} if 'first' in _dict: - args['first'] = SecurityGroupCollectionFirst.from_dict(_dict.get('first')) + args['first'] = SecurityGroupTargetCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'first\' not present in SecurityGroupCollection JSON') + raise ValueError('Required property \'first\' not present in SecurityGroupTargetCollection JSON') if 'limit' in _dict: args['limit'] = _dict.get('limit') else: - raise ValueError('Required property \'limit\' not present in SecurityGroupCollection JSON') + raise ValueError('Required property \'limit\' not present in SecurityGroupTargetCollection JSON') if 'next' in _dict: - args['next'] = SecurityGroupCollectionNext.from_dict(_dict.get('next')) - if 'security_groups' in _dict: - args['security_groups'] = [SecurityGroup.from_dict(x) for x in _dict.get('security_groups')] + args['next'] = SecurityGroupTargetCollectionNext.from_dict(_dict.get('next')) + if 'targets' in _dict: + args['targets'] = _dict.get('targets') else: - raise ValueError('Required property \'security_groups\' not present in SecurityGroupCollection JSON') + raise ValueError('Required property \'targets\' not present in SecurityGroupTargetCollection JSON') if 'total_count' in _dict: args['total_count'] = _dict.get('total_count') else: - raise ValueError('Required property \'total_count\' not present in SecurityGroupCollection JSON') + raise ValueError('Required property \'total_count\' not present in SecurityGroupTargetCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a SecurityGroupCollection object from a json dictionary.""" + """Initialize a SecurityGroupTargetCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -50681,8 +54672,14 @@ def to_dict(self) -> Dict: _dict['limit'] = self.limit if hasattr(self, 'next') and self.next is not None: _dict['next'] = self.next.to_dict() - if hasattr(self, 'security_groups') and self.security_groups is not None: - _dict['security_groups'] = [x.to_dict() for x in self.security_groups] + if hasattr(self, 'targets') and self.targets is not None: + targets_list = [] + for x in self.targets: + if isinstance(x, dict): + targets_list.append(x) + else: + targets_list.append(x.to_dict()) + _dict['targets'] = targets_list if hasattr(self, 'total_count') and self.total_count is not None: _dict['total_count'] = self.total_count return _dict @@ -50692,20 +54689,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this SecurityGroupCollection object.""" + """Return a `str` version of this SecurityGroupTargetCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'SecurityGroupCollection') -> bool: + def __eq__(self, other: 'SecurityGroupTargetCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'SecurityGroupCollection') -> bool: + def __ne__(self, other: 'SecurityGroupTargetCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class SecurityGroupCollectionFirst(): +class SecurityGroupTargetCollectionFirst(): """ A link to the first page of resources. @@ -50715,25 +54712,25 @@ class SecurityGroupCollectionFirst(): def __init__(self, href: str) -> None: """ - Initialize a SecurityGroupCollectionFirst object. + Initialize a SecurityGroupTargetCollectionFirst object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'SecurityGroupCollectionFirst': - """Initialize a SecurityGroupCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SecurityGroupTargetCollectionFirst': + """Initialize a SecurityGroupTargetCollectionFirst object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in SecurityGroupCollectionFirst JSON') + raise ValueError('Required property \'href\' not present in SecurityGroupTargetCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a SecurityGroupCollectionFirst object from a json dictionary.""" + """Initialize a SecurityGroupTargetCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -50748,20 +54745,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this SecurityGroupCollectionFirst object.""" + """Return a `str` version of this SecurityGroupTargetCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'SecurityGroupCollectionFirst') -> bool: + def __eq__(self, other: 'SecurityGroupTargetCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'SecurityGroupCollectionFirst') -> bool: + def __ne__(self, other: 'SecurityGroupTargetCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class SecurityGroupCollectionNext(): +class SecurityGroupTargetCollectionNext(): """ A link to the next page of resources. This property is present for all pages except the last page. @@ -50772,25 +54769,25 @@ class SecurityGroupCollectionNext(): def __init__(self, href: str) -> None: """ - Initialize a SecurityGroupCollectionNext object. + Initialize a SecurityGroupTargetCollectionNext object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'SecurityGroupCollectionNext': - """Initialize a SecurityGroupCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SecurityGroupTargetCollectionNext': + """Initialize a SecurityGroupTargetCollectionNext object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in SecurityGroupCollectionNext JSON') + raise ValueError('Required property \'href\' not present in SecurityGroupTargetCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a SecurityGroupCollectionNext object from a json dictionary.""" + """Initialize a SecurityGroupTargetCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -50805,172 +54802,307 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this SecurityGroupCollectionNext object.""" + """Return a `str` version of this SecurityGroupTargetCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'SecurityGroupCollectionNext') -> bool: + def __eq__(self, other: 'SecurityGroupTargetCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'SecurityGroupCollectionNext') -> bool: + def __ne__(self, other: 'SecurityGroupTargetCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class SecurityGroupIdentity(): +class SecurityGroupTargetReference(): """ - Identifies a security group by a unique property. + The resource types that can be security group targets are expected to expand in the + future. When iterating over security group targets, do not assume that every target + resource will be from a known set of resource types. Optionally halt processing and + surface an error, or bypass resources of unrecognized types. """ def __init__(self) -> None: """ - Initialize a SecurityGroupIdentity object. + Initialize a SecurityGroupTargetReference object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['SecurityGroupIdentityById', 'SecurityGroupIdentityByCRN', 'SecurityGroupIdentityByHref'])) + ", ".join(['SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext', 'SecurityGroupTargetReferenceLoadBalancerReference', 'SecurityGroupTargetReferenceEndpointGatewayReference', 'SecurityGroupTargetReferenceVPNServerReference'])) raise Exception(msg) -class SecurityGroupPatch(): - """ - SecurityGroupPatch. - - :attr str name: (optional) The user-defined name for this security group. Names - must be unique within the VPC the security group resides in. - """ - - def __init__(self, - *, - name: str = None) -> None: - """ - Initialize a SecurityGroupPatch object. - - :param str name: (optional) The user-defined name for this security group. - Names must be unique within the VPC the security group resides in. - """ - self.name = name - - @classmethod - def from_dict(cls, _dict: Dict) -> 'SecurityGroupPatch': - """Initialize a SecurityGroupPatch object from a json dictionary.""" - args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a SecurityGroupPatch object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this SecurityGroupPatch object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'SecurityGroupPatch') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'SecurityGroupPatch') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - -class SecurityGroupReference(): +class Snapshot(): """ - SecurityGroupReference. + Snapshot. - :attr str crn: The security group's CRN. - :attr SecurityGroupReferenceDeleted deleted: (optional) If present, this - property indicates the referenced resource has been deleted and provides - some supplementary information. - :attr str href: The security group's canonical URL. - :attr str id: The unique identifier for this security group. - :attr str name: The user-defined name for this security group. Names must be - unique within the VPC the security group resides in. + :attr BackupPolicyPlanReference backup_policy_plan: (optional) If present, the + backup policy plan which created this snapshot. + :attr bool bootable: Indicates if a boot volume attachment can be created with a + volume created from this snapshot. + :attr datetime captured_at: (optional) The date and time the data capture for + this snapshot was completed. + If absent, this snapshot's data has not yet been captured. Additionally, this + property may be absent for snapshots created before 1 January 2022. + :attr datetime created_at: The date and time that this snapshot was created. + :attr str crn: The CRN of this snapshot. + :attr bool deletable: Indicates whether this snapshot can be deleted. This value + will always be `true`. + :attr str encryption: The type of encryption used on the source volume. + :attr EncryptionKeyReference encryption_key: (optional) The root key used to + wrap the data encryption key for the source volume. + This property will be present for volumes with an `encryption` type of + `user_managed`. + :attr str href: The URL for this snapshot. + :attr str id: The unique identifier for this snapshot. + :attr str lifecycle_state: The lifecycle state of this snapshot. + :attr int minimum_capacity: The minimum capacity of a volume created from this + snapshot. When a snapshot is created, this will be set to the capacity of the + `source_volume`. + :attr str name: The user-defined name for this snapshot. + :attr OperatingSystem operating_system: (optional) The operating system included + in this image. + :attr ResourceGroupReference resource_group: The resource group for this + snapshot. + :attr str resource_type: The resource type. + :attr List[str] service_tags: The [service + tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) prefixed with + `is.snapshot:` associated with this snapshot. + :attr int size: The size of this snapshot rounded up to the next gigabyte. + :attr ImageReference source_image: (optional) If present, the image from which + the data on this snapshot was most directly + provisioned. + :attr VolumeReference source_volume: The source volume this snapshot was created + from (may be + [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + :attr List[str] user_tags: The [user + tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this + snapshot. """ def __init__(self, + bootable: bool, + created_at: datetime, crn: str, + deletable: bool, + encryption: str, href: str, id: str, + lifecycle_state: str, + minimum_capacity: int, name: str, + resource_group: 'ResourceGroupReference', + resource_type: str, + service_tags: List[str], + size: int, + source_volume: 'VolumeReference', + user_tags: List[str], *, - deleted: 'SecurityGroupReferenceDeleted' = None) -> None: + backup_policy_plan: 'BackupPolicyPlanReference' = None, + captured_at: datetime = None, + encryption_key: 'EncryptionKeyReference' = None, + operating_system: 'OperatingSystem' = None, + source_image: 'ImageReference' = None) -> None: """ - Initialize a SecurityGroupReference object. + Initialize a Snapshot object. - :param str crn: The security group's CRN. - :param str href: The security group's canonical URL. - :param str id: The unique identifier for this security group. - :param str name: The user-defined name for this security group. Names must - be unique within the VPC the security group resides in. - :param SecurityGroupReferenceDeleted deleted: (optional) If present, this - property indicates the referenced resource has been deleted and provides - some supplementary information. + :param bool bootable: Indicates if a boot volume attachment can be created + with a volume created from this snapshot. + :param datetime created_at: The date and time that this snapshot was + created. + :param str crn: The CRN of this snapshot. + :param bool deletable: Indicates whether this snapshot can be deleted. This + value will always be `true`. + :param str encryption: The type of encryption used on the source volume. + :param str href: The URL for this snapshot. + :param str id: The unique identifier for this snapshot. + :param str lifecycle_state: The lifecycle state of this snapshot. + :param int minimum_capacity: The minimum capacity of a volume created from + this snapshot. When a snapshot is created, this will be set to the capacity + of the `source_volume`. + :param str name: The user-defined name for this snapshot. + :param ResourceGroupReference resource_group: The resource group for this + snapshot. + :param str resource_type: The resource type. + :param List[str] service_tags: The [service + tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) prefixed with + `is.snapshot:` associated with this snapshot. + :param int size: The size of this snapshot rounded up to the next gigabyte. + :param VolumeReference source_volume: The source volume this snapshot was + created from (may be + [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + :param List[str] user_tags: The [user + tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with + this snapshot. + :param BackupPolicyPlanReference backup_policy_plan: (optional) If present, + the backup policy plan which created this snapshot. + :param datetime captured_at: (optional) The date and time the data capture + for this snapshot was completed. + If absent, this snapshot's data has not yet been captured. Additionally, + this property may be absent for snapshots created before 1 January 2022. + :param EncryptionKeyReference encryption_key: (optional) The root key used + to wrap the data encryption key for the source volume. + This property will be present for volumes with an `encryption` type of + `user_managed`. + :param OperatingSystem operating_system: (optional) The operating system + included in this image. + :param ImageReference source_image: (optional) If present, the image from + which the data on this snapshot was most directly + provisioned. """ + self.backup_policy_plan = backup_policy_plan + self.bootable = bootable + self.captured_at = captured_at + self.created_at = created_at self.crn = crn - self.deleted = deleted + self.deletable = deletable + self.encryption = encryption + self.encryption_key = encryption_key self.href = href self.id = id + self.lifecycle_state = lifecycle_state + self.minimum_capacity = minimum_capacity self.name = name + self.operating_system = operating_system + self.resource_group = resource_group + self.resource_type = resource_type + self.service_tags = service_tags + self.size = size + self.source_image = source_image + self.source_volume = source_volume + self.user_tags = user_tags @classmethod - def from_dict(cls, _dict: Dict) -> 'SecurityGroupReference': - """Initialize a SecurityGroupReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'Snapshot': + """Initialize a Snapshot object from a json dictionary.""" args = {} + if 'backup_policy_plan' in _dict: + args['backup_policy_plan'] = BackupPolicyPlanReference.from_dict(_dict.get('backup_policy_plan')) + if 'bootable' in _dict: + args['bootable'] = _dict.get('bootable') + else: + raise ValueError('Required property \'bootable\' not present in Snapshot JSON') + if 'captured_at' in _dict: + args['captured_at'] = string_to_datetime(_dict.get('captured_at')) + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) + else: + raise ValueError('Required property \'created_at\' not present in Snapshot JSON') if 'crn' in _dict: args['crn'] = _dict.get('crn') else: - raise ValueError('Required property \'crn\' not present in SecurityGroupReference JSON') - if 'deleted' in _dict: - args['deleted'] = SecurityGroupReferenceDeleted.from_dict(_dict.get('deleted')) + raise ValueError('Required property \'crn\' not present in Snapshot JSON') + if 'deletable' in _dict: + args['deletable'] = _dict.get('deletable') + else: + raise ValueError('Required property \'deletable\' not present in Snapshot JSON') + if 'encryption' in _dict: + args['encryption'] = _dict.get('encryption') + else: + raise ValueError('Required property \'encryption\' not present in Snapshot JSON') + if 'encryption_key' in _dict: + args['encryption_key'] = EncryptionKeyReference.from_dict(_dict.get('encryption_key')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in SecurityGroupReference JSON') + raise ValueError('Required property \'href\' not present in Snapshot JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in SecurityGroupReference JSON') + raise ValueError('Required property \'id\' not present in Snapshot JSON') + if 'lifecycle_state' in _dict: + args['lifecycle_state'] = _dict.get('lifecycle_state') + else: + raise ValueError('Required property \'lifecycle_state\' not present in Snapshot JSON') + if 'minimum_capacity' in _dict: + args['minimum_capacity'] = _dict.get('minimum_capacity') + else: + raise ValueError('Required property \'minimum_capacity\' not present in Snapshot JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in SecurityGroupReference JSON') + raise ValueError('Required property \'name\' not present in Snapshot JSON') + if 'operating_system' in _dict: + args['operating_system'] = OperatingSystem.from_dict(_dict.get('operating_system')) + if 'resource_group' in _dict: + args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) + else: + raise ValueError('Required property \'resource_group\' not present in Snapshot JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in Snapshot JSON') + if 'service_tags' in _dict: + args['service_tags'] = _dict.get('service_tags') + else: + raise ValueError('Required property \'service_tags\' not present in Snapshot JSON') + if 'size' in _dict: + args['size'] = _dict.get('size') + else: + raise ValueError('Required property \'size\' not present in Snapshot JSON') + if 'source_image' in _dict: + args['source_image'] = ImageReference.from_dict(_dict.get('source_image')) + if 'source_volume' in _dict: + args['source_volume'] = VolumeReference.from_dict(_dict.get('source_volume')) + else: + raise ValueError('Required property \'source_volume\' not present in Snapshot JSON') + if 'user_tags' in _dict: + args['user_tags'] = _dict.get('user_tags') + else: + raise ValueError('Required property \'user_tags\' not present in Snapshot JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a SecurityGroupReference object from a json dictionary.""" + """Initialize a Snapshot object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'backup_policy_plan') and self.backup_policy_plan is not None: + _dict['backup_policy_plan'] = self.backup_policy_plan.to_dict() + if hasattr(self, 'bootable') and self.bootable is not None: + _dict['bootable'] = self.bootable + if hasattr(self, 'captured_at') and self.captured_at is not None: + _dict['captured_at'] = datetime_to_string(self.captured_at) + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) if hasattr(self, 'crn') and self.crn is not None: _dict['crn'] = self.crn - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() + if hasattr(self, 'deletable') and self.deletable is not None: + _dict['deletable'] = self.deletable + if hasattr(self, 'encryption') and self.encryption is not None: + _dict['encryption'] = self.encryption + if hasattr(self, 'encryption_key') and self.encryption_key is not None: + _dict['encryption_key'] = self.encryption_key.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id + if hasattr(self, 'lifecycle_state') and self.lifecycle_state is not None: + _dict['lifecycle_state'] = self.lifecycle_state + if hasattr(self, 'minimum_capacity') and self.minimum_capacity is not None: + _dict['minimum_capacity'] = self.minimum_capacity if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name + if hasattr(self, 'operating_system') and self.operating_system is not None: + _dict['operating_system'] = self.operating_system.to_dict() + if hasattr(self, 'resource_group') and self.resource_group is not None: + _dict['resource_group'] = self.resource_group.to_dict() + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + if hasattr(self, 'service_tags') and self.service_tags is not None: + _dict['service_tags'] = self.service_tags + if hasattr(self, 'size') and self.size is not None: + _dict['size'] = self.size + if hasattr(self, 'source_image') and self.source_image is not None: + _dict['source_image'] = self.source_image.to_dict() + if hasattr(self, 'source_volume') and self.source_volume is not None: + _dict['source_volume'] = self.source_volume.to_dict() + if hasattr(self, 'user_tags') and self.user_tags is not None: + _dict['user_tags'] = self.user_tags return _dict def _to_dict(self): @@ -50978,220 +55110,129 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this SecurityGroupReference object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'SecurityGroupReference') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'SecurityGroupReference') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - -class SecurityGroupReferenceDeleted(): - """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. - - :attr str more_info: Link to documentation about deleted resources. - """ - - def __init__(self, - more_info: str) -> None: - """ - Initialize a SecurityGroupReferenceDeleted object. - - :param str more_info: Link to documentation about deleted resources. - """ - self.more_info = more_info - - @classmethod - def from_dict(cls, _dict: Dict) -> 'SecurityGroupReferenceDeleted': - """Initialize a SecurityGroupReferenceDeleted object from a json dictionary.""" - args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') - else: - raise ValueError('Required property \'more_info\' not present in SecurityGroupReferenceDeleted JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a SecurityGroupReferenceDeleted object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this SecurityGroupReferenceDeleted object.""" + """Return a `str` version of this Snapshot object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'SecurityGroupReferenceDeleted') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'SecurityGroupReferenceDeleted') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - -class SecurityGroupRule(): - """ - SecurityGroupRule. - - :attr str direction: The direction of traffic to enforce, either `inbound` or - `outbound`. - :attr str href: The URL for this security group rule. - :attr str id: The unique identifier for this security group rule. - :attr str ip_version: The IP version to enforce. The format of `remote.address` - or `remote.cidr_block` must match this property, if they are used. - Alternatively, if `remote` references a security group, then this rule only - applies to IP addresses (network interfaces) in that group matching this IP - version. - :attr str protocol: The protocol to enforce. - :attr SecurityGroupRuleRemote remote: The IP addresses or security groups from - which this rule allows traffic (or to which, - for outbound rules). Can be specified as an IP address, a CIDR block, or a - security - group. A CIDR block of `0.0.0.0/0` allows traffic from any source (or to any - source, - for outbound rules). - """ - - def __init__(self, - direction: str, - href: str, - id: str, - ip_version: str, - protocol: str, - remote: 'SecurityGroupRuleRemote') -> None: - """ - Initialize a SecurityGroupRule object. - - :param str direction: The direction of traffic to enforce, either `inbound` - or `outbound`. - :param str href: The URL for this security group rule. - :param str id: The unique identifier for this security group rule. - :param str ip_version: The IP version to enforce. The format of - `remote.address` or `remote.cidr_block` must match this property, if they - are used. Alternatively, if `remote` references a security group, then this - rule only applies to IP addresses (network interfaces) in that group - matching this IP version. - :param str protocol: The protocol to enforce. - :param SecurityGroupRuleRemote remote: The IP addresses or security groups - from which this rule allows traffic (or to which, - for outbound rules). Can be specified as an IP address, a CIDR block, or a - security - group. A CIDR block of `0.0.0.0/0` allows traffic from any source (or to - any source, - for outbound rules). - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['SecurityGroupRuleSecurityGroupRuleProtocolAll', 'SecurityGroupRuleSecurityGroupRuleProtocolICMP', 'SecurityGroupRuleSecurityGroupRuleProtocolTCPUDP'])) - raise Exception(msg) + def __eq__(self, other: 'Snapshot') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ - @classmethod - def from_dict(cls, _dict: Dict) -> 'SecurityGroupRule': - """Initialize a SecurityGroupRule object from a json dictionary.""" - disc_class = cls._get_class_by_discriminator(_dict) - if disc_class != cls: - return disc_class.from_dict(_dict) - msg = ("Cannot convert dictionary into an instance of base class 'SecurityGroupRule'. " + - "The discriminator value should map to a valid subclass: {1}").format( - ", ".join(['SecurityGroupRuleSecurityGroupRuleProtocolAll', 'SecurityGroupRuleSecurityGroupRuleProtocolICMP', 'SecurityGroupRuleSecurityGroupRuleProtocolTCPUDP'])) - raise Exception(msg) + def __ne__(self, other: 'Snapshot') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other - @classmethod - def _from_dict(cls, _dict: Dict): - """Initialize a SecurityGroupRule object from a json dictionary.""" - return cls.from_dict(_dict) + class EncryptionEnum(str, Enum): + """ + The type of encryption used on the source volume. + """ + PROVIDER_MANAGED = 'provider_managed' + USER_MANAGED = 'user_managed' - @classmethod - def _get_class_by_discriminator(cls, _dict: Dict) -> object: - mapping = {} - mapping['all'] = 'SecurityGroupRuleSecurityGroupRuleProtocolAll' - mapping['icmp'] = 'SecurityGroupRuleSecurityGroupRuleProtocolICMP' - mapping['tcp'] = 'SecurityGroupRuleSecurityGroupRuleProtocolTCPUDP' - mapping['udp'] = 'SecurityGroupRuleSecurityGroupRuleProtocolTCPUDP' - disc_value = _dict.get('protocol') - if disc_value is None: - raise ValueError('Discriminator property \'protocol\' not found in SecurityGroupRule JSON') - class_name = mapping.get(disc_value, disc_value) - try: - disc_class = getattr(sys.modules[__name__], class_name) - except AttributeError: - disc_class = cls - if isinstance(disc_class, object): - return disc_class - raise TypeError('%s is not a discriminator class' % class_name) - class DirectionEnum(str, Enum): + class LifecycleStateEnum(str, Enum): """ - The direction of traffic to enforce, either `inbound` or `outbound`. + The lifecycle state of this snapshot. """ - INBOUND = 'inbound' - OUTBOUND = 'outbound' + DELETING = 'deleting' + FAILED = 'failed' + PENDING = 'pending' + STABLE = 'stable' + SUSPENDED = 'suspended' + UPDATING = 'updating' + WAITING = 'waiting' - class IpVersionEnum(str, Enum): + class ResourceTypeEnum(str, Enum): """ - The IP version to enforce. The format of `remote.address` or `remote.cidr_block` - must match this property, if they are used. Alternatively, if `remote` references - a security group, then this rule only applies to IP addresses (network interfaces) - in that group matching this IP version. + The resource type. """ - IPV4 = 'ipv4' + SNAPSHOT = 'snapshot' -class SecurityGroupRuleCollection(): +class SnapshotCollection(): """ - Collection of rules in a security group. + SnapshotCollection. - :attr List[SecurityGroupRule] rules: Array of rules. + :attr SnapshotCollectionFirst first: A link to the first page of resources. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr SnapshotCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages + except the last page. + :attr List[Snapshot] snapshots: Collection of snapshots. + :attr int total_count: The total number of resources across all pages. """ def __init__(self, - rules: List['SecurityGroupRule']) -> None: + first: 'SnapshotCollectionFirst', + limit: int, + snapshots: List['Snapshot'], + total_count: int, + *, + next: 'SnapshotCollectionNext' = None) -> None: """ - Initialize a SecurityGroupRuleCollection object. + Initialize a SnapshotCollection object. - :param List[SecurityGroupRule] rules: Array of rules. + :param SnapshotCollectionFirst first: A link to the first page of + resources. + :param int limit: The maximum number of resources that can be returned by + the request. + :param List[Snapshot] snapshots: Collection of snapshots. + :param int total_count: The total number of resources across all pages. + :param SnapshotCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages + except the last page. """ - self.rules = rules + self.first = first + self.limit = limit + self.next = next + self.snapshots = snapshots + self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'SecurityGroupRuleCollection': - """Initialize a SecurityGroupRuleCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SnapshotCollection': + """Initialize a SnapshotCollection object from a json dictionary.""" args = {} - if 'rules' in _dict: - args['rules'] = [SecurityGroupRule.from_dict(x) for x in _dict.get('rules')] + if 'first' in _dict: + args['first'] = SnapshotCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'rules\' not present in SecurityGroupRuleCollection JSON') + raise ValueError('Required property \'first\' not present in SnapshotCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') + else: + raise ValueError('Required property \'limit\' not present in SnapshotCollection JSON') + if 'next' in _dict: + args['next'] = SnapshotCollectionNext.from_dict(_dict.get('next')) + if 'snapshots' in _dict: + args['snapshots'] = [Snapshot.from_dict(x) for x in _dict.get('snapshots')] + else: + raise ValueError('Required property \'snapshots\' not present in SnapshotCollection JSON') + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') + else: + raise ValueError('Required property \'total_count\' not present in SnapshotCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a SecurityGroupRuleCollection object from a json dictionary.""" + """Initialize a SnapshotCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'rules') and self.rules is not None: - _dict['rules'] = [x.to_dict() for x in self.rules] + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'snapshots') and self.snapshots is not None: + _dict['snapshots'] = [x.to_dict() for x in self.snapshots] + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count return _dict def _to_dict(self): @@ -51199,141 +55240,55 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this SecurityGroupRuleCollection object.""" + """Return a `str` version of this SnapshotCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'SecurityGroupRuleCollection') -> bool: + def __eq__(self, other: 'SnapshotCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'SecurityGroupRuleCollection') -> bool: + def __ne__(self, other: 'SnapshotCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class SecurityGroupRulePatch(): +class SnapshotCollectionFirst(): """ - SecurityGroupRulePatch. + A link to the first page of resources. - :attr int code: (optional) The ICMP traffic code to allow. Specify `null` to - remove an existing ICMP traffic code value. - :attr str direction: (optional) The direction of traffic to enforce, either - `inbound` or `outbound`. - :attr str ip_version: (optional) The IP version to enforce. The format of - `remote.address` or `remote.cidr_block` must match this property, if they are - used. Alternatively, if `remote` references a security group, then this rule - only applies to IP addresses (network interfaces) in that group matching this IP - version. - :attr int port_max: (optional) The inclusive upper bound of the protocol port - range. Specify `null` to clear an existing upper bound. If a lower bound has - been set, the upper bound must also be set, and must not be smaller. - :attr int port_min: (optional) The inclusive lower bound of the protocol port - range. Specify `null` to clear an existing lower bound. If an upper bound has - been set, the lower bound must also be set, and must not be larger. - :attr SecurityGroupRuleRemotePatch remote: (optional) The IP addresses or - security groups from which this rule will allow traffic (or to - which, for outbound rules). Can be specified as an IP address, a CIDR block, or - a - security group. A CIDR block of `0.0.0.0/0` will allow traffic from any source - (or to - any source, for outbound rules). - :attr int type: (optional) The ICMP traffic type to allow. Specify `null` to - remove an existing ICMP traffic type value. + :attr str href: The URL for a page of resources. """ def __init__(self, - *, - code: int = None, - direction: str = None, - ip_version: str = None, - port_max: int = None, - port_min: int = None, - remote: 'SecurityGroupRuleRemotePatch' = None, - type: int = None) -> None: + href: str) -> None: """ - Initialize a SecurityGroupRulePatch object. + Initialize a SnapshotCollectionFirst object. - :param int code: (optional) The ICMP traffic code to allow. Specify `null` - to remove an existing ICMP traffic code value. - :param str direction: (optional) The direction of traffic to enforce, - either `inbound` or `outbound`. - :param str ip_version: (optional) The IP version to enforce. The format of - `remote.address` or `remote.cidr_block` must match this property, if they - are used. Alternatively, if `remote` references a security group, then this - rule only applies to IP addresses (network interfaces) in that group - matching this IP version. - :param int port_max: (optional) The inclusive upper bound of the protocol - port range. Specify `null` to clear an existing upper bound. If a lower - bound has been set, the upper bound must also be set, and must not be - smaller. - :param int port_min: (optional) The inclusive lower bound of the protocol - port range. Specify `null` to clear an existing lower bound. If an upper - bound has been set, the lower bound must also be set, and must not be - larger. - :param SecurityGroupRuleRemotePatch remote: (optional) The IP addresses or - security groups from which this rule will allow traffic (or to - which, for outbound rules). Can be specified as an IP address, a CIDR - block, or a - security group. A CIDR block of `0.0.0.0/0` will allow traffic from any - source (or to - any source, for outbound rules). - :param int type: (optional) The ICMP traffic type to allow. Specify `null` - to remove an existing ICMP traffic type value. + :param str href: The URL for a page of resources. """ - self.code = code - self.direction = direction - self.ip_version = ip_version - self.port_max = port_max - self.port_min = port_min - self.remote = remote - self.type = type + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'SecurityGroupRulePatch': - """Initialize a SecurityGroupRulePatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SnapshotCollectionFirst': + """Initialize a SnapshotCollectionFirst object from a json dictionary.""" args = {} - if 'code' in _dict: - args['code'] = _dict.get('code') - if 'direction' in _dict: - args['direction'] = _dict.get('direction') - if 'ip_version' in _dict: - args['ip_version'] = _dict.get('ip_version') - if 'port_max' in _dict: - args['port_max'] = _dict.get('port_max') - if 'port_min' in _dict: - args['port_min'] = _dict.get('port_min') - if 'remote' in _dict: - args['remote'] = _dict.get('remote') - if 'type' in _dict: - args['type'] = _dict.get('type') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in SnapshotCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a SecurityGroupRulePatch object from a json dictionary.""" + """Initialize a SnapshotCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'code') and self.code is not None: - _dict['code'] = self.code - if hasattr(self, 'direction') and self.direction is not None: - _dict['direction'] = self.direction - if hasattr(self, 'ip_version') and self.ip_version is not None: - _dict['ip_version'] = self.ip_version - if hasattr(self, 'port_max') and self.port_max is not None: - _dict['port_max'] = self.port_max - if hasattr(self, 'port_min') and self.port_min is not None: - _dict['port_min'] = self.port_min - if hasattr(self, 'remote') and self.remote is not None: - if isinstance(self.remote, dict): - _dict['remote'] = self.remote - else: - _dict['remote'] = self.remote.to_dict() - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -51341,285 +55296,138 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this SecurityGroupRulePatch object.""" + """Return a `str` version of this SnapshotCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'SecurityGroupRulePatch') -> bool: + def __eq__(self, other: 'SnapshotCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'SecurityGroupRulePatch') -> bool: + def __ne__(self, other: 'SnapshotCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class DirectionEnum(str, Enum): - """ - The direction of traffic to enforce, either `inbound` or `outbound`. - """ - INBOUND = 'inbound' - OUTBOUND = 'outbound' - - - class IpVersionEnum(str, Enum): - """ - The IP version to enforce. The format of `remote.address` or `remote.cidr_block` - must match this property, if they are used. Alternatively, if `remote` references - a security group, then this rule only applies to IP addresses (network interfaces) - in that group matching this IP version. - """ - IPV4 = 'ipv4' - - -class SecurityGroupRulePrototype(): +class SnapshotCollectionNext(): """ - SecurityGroupRulePrototype. + A link to the next page of resources. This property is present for all pages except + the last page. - :attr str direction: The direction of traffic to enforce, either `inbound` or - `outbound`. - :attr str ip_version: (optional) The IP version to enforce. The format of - `remote.address` or `remote.cidr_block` must match this property, if they are - used. Alternatively, if `remote` references a security group, then this rule - only applies to IP addresses (network interfaces) in that group matching this IP - version. - :attr str protocol: The protocol to enforce. - :attr SecurityGroupRuleRemotePrototype remote: (optional) The IP addresses or - security groups from which this rule will allow traffic (or to - which, for outbound rules). Can be specified as an IP address, a CIDR block, or - a - security group. If omitted, a CIDR block of `0.0.0.0/0` will be used to allow - traffic - from any source (or to any source, for outbound rules). + :attr str href: The URL for a page of resources. """ def __init__(self, - direction: str, - protocol: str, - *, - ip_version: str = None, - remote: 'SecurityGroupRuleRemotePrototype' = None) -> None: + href: str) -> None: """ - Initialize a SecurityGroupRulePrototype object. + Initialize a SnapshotCollectionNext object. - :param str direction: The direction of traffic to enforce, either `inbound` - or `outbound`. - :param str protocol: The protocol to enforce. - :param str ip_version: (optional) The IP version to enforce. The format of - `remote.address` or `remote.cidr_block` must match this property, if they - are used. Alternatively, if `remote` references a security group, then this - rule only applies to IP addresses (network interfaces) in that group - matching this IP version. - :param SecurityGroupRuleRemotePrototype remote: (optional) The IP addresses - or security groups from which this rule will allow traffic (or to - which, for outbound rules). Can be specified as an IP address, a CIDR - block, or a - security group. If omitted, a CIDR block of `0.0.0.0/0` will be used to - allow traffic - from any source (or to any source, for outbound rules). + :param str href: The URL for a page of resources. """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll', 'SecurityGroupRulePrototypeSecurityGroupRuleProtocolICMP', 'SecurityGroupRulePrototypeSecurityGroupRuleProtocolTCPUDP'])) - raise Exception(msg) + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'SecurityGroupRulePrototype': - """Initialize a SecurityGroupRulePrototype object from a json dictionary.""" - disc_class = cls._get_class_by_discriminator(_dict) - if disc_class != cls: - return disc_class.from_dict(_dict) - msg = ("Cannot convert dictionary into an instance of base class 'SecurityGroupRulePrototype'. " + - "The discriminator value should map to a valid subclass: {1}").format( - ", ".join(['SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll', 'SecurityGroupRulePrototypeSecurityGroupRuleProtocolICMP', 'SecurityGroupRulePrototypeSecurityGroupRuleProtocolTCPUDP'])) - raise Exception(msg) + def from_dict(cls, _dict: Dict) -> 'SnapshotCollectionNext': + """Initialize a SnapshotCollectionNext object from a json dictionary.""" + args = {} + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in SnapshotCollectionNext JSON') + return cls(**args) @classmethod - def _from_dict(cls, _dict: Dict): - """Initialize a SecurityGroupRulePrototype object from a json dictionary.""" + def _from_dict(cls, _dict): + """Initialize a SnapshotCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) - @classmethod - def _get_class_by_discriminator(cls, _dict: Dict) -> object: - mapping = {} - mapping['all'] = 'SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll' - mapping['icmp'] = 'SecurityGroupRulePrototypeSecurityGroupRuleProtocolICMP' - mapping['tcp'] = 'SecurityGroupRulePrototypeSecurityGroupRuleProtocolTCPUDP' - mapping['udp'] = 'SecurityGroupRulePrototypeSecurityGroupRuleProtocolTCPUDP' - disc_value = _dict.get('protocol') - if disc_value is None: - raise ValueError('Discriminator property \'protocol\' not found in SecurityGroupRulePrototype JSON') - class_name = mapping.get(disc_value, disc_value) - try: - disc_class = getattr(sys.modules[__name__], class_name) - except AttributeError: - disc_class = cls - if isinstance(disc_class, object): - return disc_class - raise TypeError('%s is not a discriminator class' % class_name) - - class DirectionEnum(str, Enum): - """ - The direction of traffic to enforce, either `inbound` or `outbound`. - """ - INBOUND = 'inbound' - OUTBOUND = 'outbound' - - - class IpVersionEnum(str, Enum): - """ - The IP version to enforce. The format of `remote.address` or `remote.cidr_block` - must match this property, if they are used. Alternatively, if `remote` references - a security group, then this rule only applies to IP addresses (network interfaces) - in that group matching this IP version. - """ - IPV4 = 'ipv4' - - -class SecurityGroupRuleRemote(): - """ - The IP addresses or security groups from which this rule allows traffic (or to which, - for outbound rules). Can be specified as an IP address, a CIDR block, or a security - group. A CIDR block of `0.0.0.0/0` allows traffic from any source (or to any source, - for outbound rules). - - """ - - def __init__(self) -> None: - """ - Initialize a SecurityGroupRuleRemote object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['SecurityGroupRuleRemoteIP', 'SecurityGroupRuleRemoteCIDR', 'SecurityGroupRuleRemoteSecurityGroupReference'])) - raise Exception(msg) + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + return _dict -class SecurityGroupRuleRemotePatch(): - """ - The IP addresses or security groups from which this rule will allow traffic (or to - which, for outbound rules). Can be specified as an IP address, a CIDR block, or a - security group. A CIDR block of `0.0.0.0/0` will allow traffic from any source (or to - any source, for outbound rules). + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() - """ + def __str__(self) -> str: + """Return a `str` version of this SnapshotCollectionNext object.""" + return json.dumps(self.to_dict(), indent=2) - def __init__(self) -> None: - """ - Initialize a SecurityGroupRuleRemotePatch object. + def __eq__(self, other: 'SnapshotCollectionNext') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['SecurityGroupRuleRemotePatchIP', 'SecurityGroupRuleRemotePatchCIDR', 'SecurityGroupRuleRemotePatchSecurityGroupIdentity'])) - raise Exception(msg) + def __ne__(self, other: 'SnapshotCollectionNext') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other -class SecurityGroupRuleRemotePrototype(): +class SnapshotIdentity(): """ - The IP addresses or security groups from which this rule will allow traffic (or to - which, for outbound rules). Can be specified as an IP address, a CIDR block, or a - security group. If omitted, a CIDR block of `0.0.0.0/0` will be used to allow traffic - from any source (or to any source, for outbound rules). + Identifies a snapshot by a unique property. """ def __init__(self) -> None: """ - Initialize a SecurityGroupRuleRemotePrototype object. + Initialize a SnapshotIdentity object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['SecurityGroupRuleRemotePrototypeIP', 'SecurityGroupRuleRemotePrototypeCIDR', 'SecurityGroupRuleRemotePrototypeSecurityGroupIdentity'])) + ", ".join(['SnapshotIdentityById', 'SnapshotIdentityByCRN', 'SnapshotIdentityByHref'])) raise Exception(msg) -class SecurityGroupTargetCollection(): +class SnapshotPatch(): """ - SecurityGroupTargetCollection. + SnapshotPatch. - :attr SecurityGroupTargetCollectionFirst first: A link to the first page of - resources. - :attr int limit: The maximum number of resources that can be returned by the - request. - :attr SecurityGroupTargetCollectionNext next: (optional) A link to the next page - of resources. This property is present for all pages - except the last page. - :attr List[SecurityGroupTargetReference] targets: Collection of targets for this - security group. - :attr int total_count: The total number of resources across all pages. + :attr str name: (optional) The user-defined name for this snapshot. + :attr List[str] user_tags: (optional) The [user + tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this + snapshot. """ def __init__(self, - first: 'SecurityGroupTargetCollectionFirst', - limit: int, - targets: List['SecurityGroupTargetReference'], - total_count: int, *, - next: 'SecurityGroupTargetCollectionNext' = None) -> None: + name: str = None, + user_tags: List[str] = None) -> None: """ - Initialize a SecurityGroupTargetCollection object. + Initialize a SnapshotPatch object. - :param SecurityGroupTargetCollectionFirst first: A link to the first page - of resources. - :param int limit: The maximum number of resources that can be returned by - the request. - :param List[SecurityGroupTargetReference] targets: Collection of targets - for this security group. - :param int total_count: The total number of resources across all pages. - :param SecurityGroupTargetCollectionNext next: (optional) A link to the - next page of resources. This property is present for all pages - except the last page. + :param str name: (optional) The user-defined name for this snapshot. + :param List[str] user_tags: (optional) The [user + tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with + this snapshot. """ - self.first = first - self.limit = limit - self.next = next - self.targets = targets - self.total_count = total_count + self.name = name + self.user_tags = user_tags @classmethod - def from_dict(cls, _dict: Dict) -> 'SecurityGroupTargetCollection': - """Initialize a SecurityGroupTargetCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SnapshotPatch': + """Initialize a SnapshotPatch object from a json dictionary.""" args = {} - if 'first' in _dict: - args['first'] = SecurityGroupTargetCollectionFirst.from_dict(_dict.get('first')) - else: - raise ValueError('Required property \'first\' not present in SecurityGroupTargetCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') - else: - raise ValueError('Required property \'limit\' not present in SecurityGroupTargetCollection JSON') - if 'next' in _dict: - args['next'] = SecurityGroupTargetCollectionNext.from_dict(_dict.get('next')) - if 'targets' in _dict: - args['targets'] = _dict.get('targets') - else: - raise ValueError('Required property \'targets\' not present in SecurityGroupTargetCollection JSON') - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') - else: - raise ValueError('Required property \'total_count\' not present in SecurityGroupTargetCollection JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + if 'user_tags' in _dict: + args['user_tags'] = _dict.get('user_tags') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a SecurityGroupTargetCollection object from a json dictionary.""" + """Initialize a SnapshotPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'targets') and self.targets is not None: - targets_list = [] - for x in self.targets: - if isinstance(x, dict): - targets_list.append(x) - else: - targets_list.append(x.to_dict()) - _dict['targets'] = targets_list - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'user_tags') and self.user_tags is not None: + _dict['user_tags'] = self.user_tags return _dict def _to_dict(self): @@ -51627,55 +55435,145 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this SecurityGroupTargetCollection object.""" + """Return a `str` version of this SnapshotPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'SecurityGroupTargetCollection') -> bool: + def __eq__(self, other: 'SnapshotPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'SecurityGroupTargetCollection') -> bool: + def __ne__(self, other: 'SnapshotPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class SecurityGroupTargetCollectionFirst(): +class SnapshotPrototype(): """ - A link to the first page of resources. + SnapshotPrototype. - :attr str href: The URL for a page of resources. + :attr str name: (optional) The unique user-defined name for this snapshot. If + unspecified, the name will be a hyphenated list of randomly-selected words. + :attr ResourceGroupIdentity resource_group: (optional) The resource group to + use. If unspecified, the account's [default resource + group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + :attr List[str] user_tags: (optional) The [user + tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this + snapshot. """ def __init__(self, - href: str) -> None: + *, + name: str = None, + resource_group: 'ResourceGroupIdentity' = None, + user_tags: List[str] = None) -> None: """ - Initialize a SecurityGroupTargetCollectionFirst object. + Initialize a SnapshotPrototype object. - :param str href: The URL for a page of resources. + :param str name: (optional) The unique user-defined name for this snapshot. + If unspecified, the name will be a hyphenated list of randomly-selected + words. + :param ResourceGroupIdentity resource_group: (optional) The resource group + to use. If unspecified, the account's [default resource + group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is + used. + :param List[str] user_tags: (optional) The [user + tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with + this snapshot. + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['SnapshotPrototypeSnapshotBySourceVolume'])) + raise Exception(msg) + +class SnapshotReference(): + """ + SnapshotReference. + + :attr str crn: The CRN of this snapshot. + :attr SnapshotReferenceDeleted deleted: (optional) If present, this property + indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str href: The URL for this snapshot. + :attr str id: The unique identifier for this snapshot. + :attr str name: The user-defined name for this snapshot. + :attr str resource_type: The resource type. + """ + + def __init__(self, + crn: str, + href: str, + id: str, + name: str, + resource_type: str, + *, + deleted: 'SnapshotReferenceDeleted' = None) -> None: + """ + Initialize a SnapshotReference object. + + :param str crn: The CRN of this snapshot. + :param str href: The URL for this snapshot. + :param str id: The unique identifier for this snapshot. + :param str name: The user-defined name for this snapshot. + :param str resource_type: The resource type. + :param SnapshotReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides + some supplementary information. """ + self.crn = crn + self.deleted = deleted self.href = href + self.id = id + self.name = name + self.resource_type = resource_type @classmethod - def from_dict(cls, _dict: Dict) -> 'SecurityGroupTargetCollectionFirst': - """Initialize a SecurityGroupTargetCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SnapshotReference': + """Initialize a SnapshotReference object from a json dictionary.""" args = {} + if 'crn' in _dict: + args['crn'] = _dict.get('crn') + else: + raise ValueError('Required property \'crn\' not present in SnapshotReference JSON') + if 'deleted' in _dict: + args['deleted'] = SnapshotReferenceDeleted.from_dict(_dict.get('deleted')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in SecurityGroupTargetCollectionFirst JSON') + raise ValueError('Required property \'href\' not present in SnapshotReference JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in SnapshotReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in SnapshotReference JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in SnapshotReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a SecurityGroupTargetCollectionFirst object from a json dictionary.""" + """Initialize a SnapshotReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type return _dict def _to_dict(self): @@ -51683,56 +55581,63 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this SecurityGroupTargetCollectionFirst object.""" + """Return a `str` version of this SnapshotReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'SecurityGroupTargetCollectionFirst') -> bool: + def __eq__(self, other: 'SnapshotReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'SecurityGroupTargetCollectionFirst') -> bool: + def __ne__(self, other: 'SnapshotReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class SecurityGroupTargetCollectionNext(): + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + SNAPSHOT = 'snapshot' + + +class SnapshotReferenceDeleted(): """ - A link to the next page of resources. This property is present for all pages except - the last page. + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. - :attr str href: The URL for a page of resources. + :attr str more_info: Link to documentation about deleted resources. """ def __init__(self, - href: str) -> None: + more_info: str) -> None: """ - Initialize a SecurityGroupTargetCollectionNext object. + Initialize a SnapshotReferenceDeleted object. - :param str href: The URL for a page of resources. + :param str more_info: Link to documentation about deleted resources. """ - self.href = href + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'SecurityGroupTargetCollectionNext': - """Initialize a SecurityGroupTargetCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SnapshotReferenceDeleted': + """Initialize a SnapshotReferenceDeleted object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'href\' not present in SecurityGroupTargetCollectionNext JSON') + raise ValueError('Required property \'more_info\' not present in SnapshotReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a SecurityGroupTargetCollectionNext object from a json dictionary.""" + """Initialize a SnapshotReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -51740,297 +55645,232 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this SecurityGroupTargetCollectionNext object.""" + """Return a `str` version of this SnapshotReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'SecurityGroupTargetCollectionNext') -> bool: + def __eq__(self, other: 'SnapshotReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'SecurityGroupTargetCollectionNext') -> bool: + def __ne__(self, other: 'SnapshotReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class SecurityGroupTargetReference(): - """ - The resource types that can be security group targets are expected to expand in the - future. When iterating over security group targets, do not assume that every target - resource will be from a known set of resource types. Optionally halt processing and - surface an error, or bypass resources of unrecognized types. - - """ - - def __init__(self) -> None: - """ - Initialize a SecurityGroupTargetReference object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext', 'SecurityGroupTargetReferenceLoadBalancerReference', 'SecurityGroupTargetReferenceEndpointGatewayReference'])) - raise Exception(msg) - -class Snapshot(): +class Subnet(): """ - Snapshot. + Subnet. - :attr bool bootable: Indicates if a boot volume attachment can be created with a - volume created from this snapshot. - :attr datetime captured_at: (optional) The date and time the data capture for - this snapshot was completed. - If absent, this snapshot's data has not yet been captured. Additionally, this - property may be absent for snapshots created before 1 January 2022. - :attr datetime created_at: The date and time that this snapshot was created. - :attr str crn: The CRN of this snapshot. - :attr bool deletable: Indicates whether this snapshot can be deleted. This value - will always be `true`. - :attr str encryption: The type of encryption used on the source volume. - :attr EncryptionKeyReference encryption_key: (optional) The root key used to - wrap the data encryption key for the source volume. - This property will be present for volumes with an `encryption` type of - `user_managed`. - :attr str href: The URL for this snapshot. - :attr str id: The unique identifier for this snapshot. - :attr str lifecycle_state: The lifecycle state of this snapshot. - :attr int minimum_capacity: The minimum capacity of a volume created from this - snapshot. When a snapshot is created, this will be set to the capacity of the - `source_volume`. - :attr str name: The user-defined name for this snapshot. - :attr OperatingSystem operating_system: (optional) The operating system included - in this image. - :attr ResourceGroupReference resource_group: The resource group for this - snapshot. + :attr int available_ipv4_address_count: The number of IPv4 addresses in this + subnet that are not in-use, and have not been reserved by the user or the + provider. + :attr datetime created_at: The date and time that the subnet was created. + :attr str crn: The CRN for this subnet. + :attr str href: The URL for this subnet. + :attr str id: The unique identifier for this subnet. + :attr str ip_version: The IP version(s) supported by this subnet. + :attr str ipv4_cidr_block: The IPv4 range of the subnet, expressed in CIDR + format. + :attr str name: The user-defined name for this subnet. + :attr NetworkACLReference network_acl: The network ACL for this subnet. + :attr PublicGatewayReference public_gateway: (optional) The public gateway to + use for internet-bound traffic for this subnet. + :attr ResourceGroupReference resource_group: The resource group for this subnet. :attr str resource_type: The resource type. - :attr List[str] service_tags: The [service - tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) prefixed with - `is.snapshot:` associated with this snapshot. - :attr int size: The size of this snapshot rounded up to the next gigabyte. - :attr ImageReference source_image: (optional) If present, the image from which - the data on this snapshot was most directly - provisioned. - :attr VolumeReference source_volume: The source volume this snapshot was created - from (may be - [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). - :attr List[str] user_tags: The [user - tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this - snapshot. + :attr RoutingTableReference routing_table: The routing table for this subnet. + :attr str status: The status of the subnet. + :attr int total_ipv4_address_count: The total number of IPv4 addresses in this + subnet. + Note: This is calculated as 2(32 - prefix length). For example, the + prefix length `/24` gives:
2(32 - 24) = 28 = 256 + addresses. + :attr VPCReference vpc: The VPC this subnet is a part of. + :attr ZoneReference zone: The zone this subnet resides in. """ def __init__(self, - bootable: bool, + available_ipv4_address_count: int, created_at: datetime, crn: str, - deletable: bool, - encryption: str, href: str, id: str, - lifecycle_state: str, - minimum_capacity: int, + ip_version: str, + ipv4_cidr_block: str, name: str, + network_acl: 'NetworkACLReference', resource_group: 'ResourceGroupReference', resource_type: str, - service_tags: List[str], - size: int, - source_volume: 'VolumeReference', - user_tags: List[str], + routing_table: 'RoutingTableReference', + status: str, + total_ipv4_address_count: int, + vpc: 'VPCReference', + zone: 'ZoneReference', *, - captured_at: datetime = None, - encryption_key: 'EncryptionKeyReference' = None, - operating_system: 'OperatingSystem' = None, - source_image: 'ImageReference' = None) -> None: + public_gateway: 'PublicGatewayReference' = None) -> None: """ - Initialize a Snapshot object. + Initialize a Subnet object. - :param bool bootable: Indicates if a boot volume attachment can be created - with a volume created from this snapshot. - :param datetime created_at: The date and time that this snapshot was - created. - :param str crn: The CRN of this snapshot. - :param bool deletable: Indicates whether this snapshot can be deleted. This - value will always be `true`. - :param str encryption: The type of encryption used on the source volume. - :param str href: The URL for this snapshot. - :param str id: The unique identifier for this snapshot. - :param str lifecycle_state: The lifecycle state of this snapshot. - :param int minimum_capacity: The minimum capacity of a volume created from - this snapshot. When a snapshot is created, this will be set to the capacity - of the `source_volume`. - :param str name: The user-defined name for this snapshot. + :param int available_ipv4_address_count: The number of IPv4 addresses in + this subnet that are not in-use, and have not been reserved by the user or + the provider. + :param datetime created_at: The date and time that the subnet was created. + :param str crn: The CRN for this subnet. + :param str href: The URL for this subnet. + :param str id: The unique identifier for this subnet. + :param str ip_version: The IP version(s) supported by this subnet. + :param str ipv4_cidr_block: The IPv4 range of the subnet, expressed in CIDR + format. + :param str name: The user-defined name for this subnet. + :param NetworkACLReference network_acl: The network ACL for this subnet. :param ResourceGroupReference resource_group: The resource group for this - snapshot. + subnet. :param str resource_type: The resource type. - :param List[str] service_tags: The [service - tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) prefixed with - `is.snapshot:` associated with this snapshot. - :param int size: The size of this snapshot rounded up to the next gigabyte. - :param VolumeReference source_volume: The source volume this snapshot was - created from (may be - [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). - :param List[str] user_tags: The [user - tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with - this snapshot. - :param datetime captured_at: (optional) The date and time the data capture - for this snapshot was completed. - If absent, this snapshot's data has not yet been captured. Additionally, - this property may be absent for snapshots created before 1 January 2022. - :param EncryptionKeyReference encryption_key: (optional) The root key used - to wrap the data encryption key for the source volume. - This property will be present for volumes with an `encryption` type of - `user_managed`. - :param OperatingSystem operating_system: (optional) The operating system - included in this image. - :param ImageReference source_image: (optional) If present, the image from - which the data on this snapshot was most directly - provisioned. + :param RoutingTableReference routing_table: The routing table for this + subnet. + :param str status: The status of the subnet. + :param int total_ipv4_address_count: The total number of IPv4 addresses in + this subnet. + Note: This is calculated as 2(32 - prefix length). For example, + the prefix length `/24` gives:
2(32 - 24) = 28 = + 256 addresses. + :param VPCReference vpc: The VPC this subnet is a part of. + :param ZoneReference zone: The zone this subnet resides in. + :param PublicGatewayReference public_gateway: (optional) The public gateway + to use for internet-bound traffic for this subnet. """ - self.bootable = bootable - self.captured_at = captured_at + self.available_ipv4_address_count = available_ipv4_address_count self.created_at = created_at self.crn = crn - self.deletable = deletable - self.encryption = encryption - self.encryption_key = encryption_key self.href = href self.id = id - self.lifecycle_state = lifecycle_state - self.minimum_capacity = minimum_capacity + self.ip_version = ip_version + self.ipv4_cidr_block = ipv4_cidr_block self.name = name - self.operating_system = operating_system + self.network_acl = network_acl + self.public_gateway = public_gateway self.resource_group = resource_group self.resource_type = resource_type - self.service_tags = service_tags - self.size = size - self.source_image = source_image - self.source_volume = source_volume - self.user_tags = user_tags + self.routing_table = routing_table + self.status = status + self.total_ipv4_address_count = total_ipv4_address_count + self.vpc = vpc + self.zone = zone @classmethod - def from_dict(cls, _dict: Dict) -> 'Snapshot': - """Initialize a Snapshot object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'Subnet': + """Initialize a Subnet object from a json dictionary.""" args = {} - if 'bootable' in _dict: - args['bootable'] = _dict.get('bootable') + if 'available_ipv4_address_count' in _dict: + args['available_ipv4_address_count'] = _dict.get('available_ipv4_address_count') else: - raise ValueError('Required property \'bootable\' not present in Snapshot JSON') - if 'captured_at' in _dict: - args['captured_at'] = string_to_datetime(_dict.get('captured_at')) + raise ValueError('Required property \'available_ipv4_address_count\' not present in Subnet JSON') if 'created_at' in _dict: args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError('Required property \'created_at\' not present in Snapshot JSON') + raise ValueError('Required property \'created_at\' not present in Subnet JSON') if 'crn' in _dict: args['crn'] = _dict.get('crn') else: - raise ValueError('Required property \'crn\' not present in Snapshot JSON') - if 'deletable' in _dict: - args['deletable'] = _dict.get('deletable') - else: - raise ValueError('Required property \'deletable\' not present in Snapshot JSON') - if 'encryption' in _dict: - args['encryption'] = _dict.get('encryption') - else: - raise ValueError('Required property \'encryption\' not present in Snapshot JSON') - if 'encryption_key' in _dict: - args['encryption_key'] = EncryptionKeyReference.from_dict(_dict.get('encryption_key')) + raise ValueError('Required property \'crn\' not present in Subnet JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in Snapshot JSON') + raise ValueError('Required property \'href\' not present in Subnet JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in Snapshot JSON') - if 'lifecycle_state' in _dict: - args['lifecycle_state'] = _dict.get('lifecycle_state') + raise ValueError('Required property \'id\' not present in Subnet JSON') + if 'ip_version' in _dict: + args['ip_version'] = _dict.get('ip_version') else: - raise ValueError('Required property \'lifecycle_state\' not present in Snapshot JSON') - if 'minimum_capacity' in _dict: - args['minimum_capacity'] = _dict.get('minimum_capacity') + raise ValueError('Required property \'ip_version\' not present in Subnet JSON') + if 'ipv4_cidr_block' in _dict: + args['ipv4_cidr_block'] = _dict.get('ipv4_cidr_block') else: - raise ValueError('Required property \'minimum_capacity\' not present in Snapshot JSON') + raise ValueError('Required property \'ipv4_cidr_block\' not present in Subnet JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in Snapshot JSON') - if 'operating_system' in _dict: - args['operating_system'] = OperatingSystem.from_dict(_dict.get('operating_system')) + raise ValueError('Required property \'name\' not present in Subnet JSON') + if 'network_acl' in _dict: + args['network_acl'] = NetworkACLReference.from_dict(_dict.get('network_acl')) + else: + raise ValueError('Required property \'network_acl\' not present in Subnet JSON') + if 'public_gateway' in _dict: + args['public_gateway'] = PublicGatewayReference.from_dict(_dict.get('public_gateway')) if 'resource_group' in _dict: args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) else: - raise ValueError('Required property \'resource_group\' not present in Snapshot JSON') + raise ValueError('Required property \'resource_group\' not present in Subnet JSON') if 'resource_type' in _dict: args['resource_type'] = _dict.get('resource_type') else: - raise ValueError('Required property \'resource_type\' not present in Snapshot JSON') - if 'service_tags' in _dict: - args['service_tags'] = _dict.get('service_tags') + raise ValueError('Required property \'resource_type\' not present in Subnet JSON') + if 'routing_table' in _dict: + args['routing_table'] = RoutingTableReference.from_dict(_dict.get('routing_table')) else: - raise ValueError('Required property \'service_tags\' not present in Snapshot JSON') - if 'size' in _dict: - args['size'] = _dict.get('size') + raise ValueError('Required property \'routing_table\' not present in Subnet JSON') + if 'status' in _dict: + args['status'] = _dict.get('status') else: - raise ValueError('Required property \'size\' not present in Snapshot JSON') - if 'source_image' in _dict: - args['source_image'] = ImageReference.from_dict(_dict.get('source_image')) - if 'source_volume' in _dict: - args['source_volume'] = VolumeReference.from_dict(_dict.get('source_volume')) + raise ValueError('Required property \'status\' not present in Subnet JSON') + if 'total_ipv4_address_count' in _dict: + args['total_ipv4_address_count'] = _dict.get('total_ipv4_address_count') else: - raise ValueError('Required property \'source_volume\' not present in Snapshot JSON') - if 'user_tags' in _dict: - args['user_tags'] = _dict.get('user_tags') + raise ValueError('Required property \'total_ipv4_address_count\' not present in Subnet JSON') + if 'vpc' in _dict: + args['vpc'] = VPCReference.from_dict(_dict.get('vpc')) else: - raise ValueError('Required property \'user_tags\' not present in Snapshot JSON') + raise ValueError('Required property \'vpc\' not present in Subnet JSON') + if 'zone' in _dict: + args['zone'] = ZoneReference.from_dict(_dict.get('zone')) + else: + raise ValueError('Required property \'zone\' not present in Subnet JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a Snapshot object from a json dictionary.""" + """Initialize a Subnet object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'bootable') and self.bootable is not None: - _dict['bootable'] = self.bootable - if hasattr(self, 'captured_at') and self.captured_at is not None: - _dict['captured_at'] = datetime_to_string(self.captured_at) + if hasattr(self, 'available_ipv4_address_count') and self.available_ipv4_address_count is not None: + _dict['available_ipv4_address_count'] = self.available_ipv4_address_count if hasattr(self, 'created_at') and self.created_at is not None: _dict['created_at'] = datetime_to_string(self.created_at) if hasattr(self, 'crn') and self.crn is not None: _dict['crn'] = self.crn - if hasattr(self, 'deletable') and self.deletable is not None: - _dict['deletable'] = self.deletable - if hasattr(self, 'encryption') and self.encryption is not None: - _dict['encryption'] = self.encryption - if hasattr(self, 'encryption_key') and self.encryption_key is not None: - _dict['encryption_key'] = self.encryption_key.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id - if hasattr(self, 'lifecycle_state') and self.lifecycle_state is not None: - _dict['lifecycle_state'] = self.lifecycle_state - if hasattr(self, 'minimum_capacity') and self.minimum_capacity is not None: - _dict['minimum_capacity'] = self.minimum_capacity + if hasattr(self, 'ip_version') and self.ip_version is not None: + _dict['ip_version'] = self.ip_version + if hasattr(self, 'ipv4_cidr_block') and self.ipv4_cidr_block is not None: + _dict['ipv4_cidr_block'] = self.ipv4_cidr_block if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'operating_system') and self.operating_system is not None: - _dict['operating_system'] = self.operating_system.to_dict() + if hasattr(self, 'network_acl') and self.network_acl is not None: + _dict['network_acl'] = self.network_acl.to_dict() + if hasattr(self, 'public_gateway') and self.public_gateway is not None: + _dict['public_gateway'] = self.public_gateway.to_dict() if hasattr(self, 'resource_group') and self.resource_group is not None: _dict['resource_group'] = self.resource_group.to_dict() if hasattr(self, 'resource_type') and self.resource_type is not None: _dict['resource_type'] = self.resource_type - if hasattr(self, 'service_tags') and self.service_tags is not None: - _dict['service_tags'] = self.service_tags - if hasattr(self, 'size') and self.size is not None: - _dict['size'] = self.size - if hasattr(self, 'source_image') and self.source_image is not None: - _dict['source_image'] = self.source_image.to_dict() - if hasattr(self, 'source_volume') and self.source_volume is not None: - _dict['source_volume'] = self.source_volume.to_dict() - if hasattr(self, 'user_tags') and self.user_tags is not None: - _dict['user_tags'] = self.user_tags + if hasattr(self, 'routing_table') and self.routing_table is not None: + _dict['routing_table'] = self.routing_table.to_dict() + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'total_ipv4_address_count') and self.total_ipv4_address_count is not None: + _dict['total_ipv4_address_count'] = self.total_ipv4_address_count + if hasattr(self, 'vpc') and self.vpc is not None: + _dict['vpc'] = self.vpc.to_dict() + if hasattr(self, 'zone') and self.zone is not None: + _dict['zone'] = self.zone.to_dict() return _dict def _to_dict(self): @@ -52038,114 +55878,109 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this Snapshot object.""" + """Return a `str` version of this Subnet object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'Snapshot') -> bool: + def __eq__(self, other: 'Subnet') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'Snapshot') -> bool: + def __ne__(self, other: 'Subnet') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class EncryptionEnum(str, Enum): + class IpVersionEnum(str, Enum): """ - The type of encryption used on the source volume. + The IP version(s) supported by this subnet. """ - PROVIDER_MANAGED = 'provider_managed' - USER_MANAGED = 'user_managed' + IPV4 = 'ipv4' - class LifecycleStateEnum(str, Enum): + class ResourceTypeEnum(str, Enum): """ - The lifecycle state of this snapshot. + The resource type. """ - DELETING = 'deleting' - FAILED = 'failed' - PENDING = 'pending' - STABLE = 'stable' - SUSPENDED = 'suspended' - UPDATING = 'updating' - WAITING = 'waiting' + SUBNET = 'subnet' - class ResourceTypeEnum(str, Enum): + class StatusEnum(str, Enum): """ - The resource type. + The status of the subnet. """ - SNAPSHOT = 'snapshot' + AVAILABLE = 'available' + DELETING = 'deleting' + FAILED = 'failed' + PENDING = 'pending' -class SnapshotCollection(): +class SubnetCollection(): """ - SnapshotCollection. + SubnetCollection. - :attr SnapshotCollectionFirst first: A link to the first page of resources. + :attr SubnetCollectionFirst first: A link to the first page of resources. :attr int limit: The maximum number of resources that can be returned by the request. - :attr SnapshotCollectionNext next: (optional) A link to the next page of + :attr SubnetCollectionNext next: (optional) A link to the next page of resources. This property is present for all pages except the last page. - :attr List[Snapshot] snapshots: Collection of snapshots. + :attr List[Subnet] subnets: Collection of subnets. :attr int total_count: The total number of resources across all pages. """ def __init__(self, - first: 'SnapshotCollectionFirst', + first: 'SubnetCollectionFirst', limit: int, - snapshots: List['Snapshot'], + subnets: List['Subnet'], total_count: int, *, - next: 'SnapshotCollectionNext' = None) -> None: + next: 'SubnetCollectionNext' = None) -> None: """ - Initialize a SnapshotCollection object. + Initialize a SubnetCollection object. - :param SnapshotCollectionFirst first: A link to the first page of - resources. + :param SubnetCollectionFirst first: A link to the first page of resources. :param int limit: The maximum number of resources that can be returned by the request. - :param List[Snapshot] snapshots: Collection of snapshots. + :param List[Subnet] subnets: Collection of subnets. :param int total_count: The total number of resources across all pages. - :param SnapshotCollectionNext next: (optional) A link to the next page of + :param SubnetCollectionNext next: (optional) A link to the next page of resources. This property is present for all pages except the last page. """ self.first = first self.limit = limit self.next = next - self.snapshots = snapshots + self.subnets = subnets self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'SnapshotCollection': - """Initialize a SnapshotCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SubnetCollection': + """Initialize a SubnetCollection object from a json dictionary.""" args = {} if 'first' in _dict: - args['first'] = SnapshotCollectionFirst.from_dict(_dict.get('first')) + args['first'] = SubnetCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'first\' not present in SnapshotCollection JSON') + raise ValueError('Required property \'first\' not present in SubnetCollection JSON') if 'limit' in _dict: args['limit'] = _dict.get('limit') else: - raise ValueError('Required property \'limit\' not present in SnapshotCollection JSON') + raise ValueError('Required property \'limit\' not present in SubnetCollection JSON') if 'next' in _dict: - args['next'] = SnapshotCollectionNext.from_dict(_dict.get('next')) - if 'snapshots' in _dict: - args['snapshots'] = [Snapshot.from_dict(x) for x in _dict.get('snapshots')] + args['next'] = SubnetCollectionNext.from_dict(_dict.get('next')) + if 'subnets' in _dict: + args['subnets'] = [Subnet.from_dict(x) for x in _dict.get('subnets')] else: - raise ValueError('Required property \'snapshots\' not present in SnapshotCollection JSON') + raise ValueError('Required property \'subnets\' not present in SubnetCollection JSON') if 'total_count' in _dict: args['total_count'] = _dict.get('total_count') else: - raise ValueError('Required property \'total_count\' not present in SnapshotCollection JSON') + raise ValueError('Required property \'total_count\' not present in SubnetCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a SnapshotCollection object from a json dictionary.""" + """Initialize a SubnetCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -52157,8 +55992,8 @@ def to_dict(self) -> Dict: _dict['limit'] = self.limit if hasattr(self, 'next') and self.next is not None: _dict['next'] = self.next.to_dict() - if hasattr(self, 'snapshots') and self.snapshots is not None: - _dict['snapshots'] = [x.to_dict() for x in self.snapshots] + if hasattr(self, 'subnets') and self.subnets is not None: + _dict['subnets'] = [x.to_dict() for x in self.subnets] if hasattr(self, 'total_count') and self.total_count is not None: _dict['total_count'] = self.total_count return _dict @@ -52168,20 +56003,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this SnapshotCollection object.""" + """Return a `str` version of this SubnetCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'SnapshotCollection') -> bool: + def __eq__(self, other: 'SubnetCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'SnapshotCollection') -> bool: + def __ne__(self, other: 'SubnetCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class SnapshotCollectionFirst(): +class SubnetCollectionFirst(): """ A link to the first page of resources. @@ -52191,25 +56026,25 @@ class SnapshotCollectionFirst(): def __init__(self, href: str) -> None: """ - Initialize a SnapshotCollectionFirst object. + Initialize a SubnetCollectionFirst object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'SnapshotCollectionFirst': - """Initialize a SnapshotCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SubnetCollectionFirst': + """Initialize a SubnetCollectionFirst object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in SnapshotCollectionFirst JSON') + raise ValueError('Required property \'href\' not present in SubnetCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a SnapshotCollectionFirst object from a json dictionary.""" + """Initialize a SubnetCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -52224,20 +56059,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this SnapshotCollectionFirst object.""" + """Return a `str` version of this SubnetCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'SnapshotCollectionFirst') -> bool: + def __eq__(self, other: 'SubnetCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'SnapshotCollectionFirst') -> bool: + def __ne__(self, other: 'SubnetCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class SnapshotCollectionNext(): +class SubnetCollectionNext(): """ A link to the next page of resources. This property is present for all pages except the last page. @@ -52248,25 +56083,25 @@ class SnapshotCollectionNext(): def __init__(self, href: str) -> None: """ - Initialize a SnapshotCollectionNext object. + Initialize a SubnetCollectionNext object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'SnapshotCollectionNext': - """Initialize a SnapshotCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SubnetCollectionNext': + """Initialize a SubnetCollectionNext object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in SnapshotCollectionNext JSON') + raise ValueError('Required property \'href\' not present in SubnetCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a SnapshotCollectionNext object from a json dictionary.""" + """Initialize a SubnetCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -52281,72 +56116,92 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this SnapshotCollectionNext object.""" + """Return a `str` version of this SubnetCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'SnapshotCollectionNext') -> bool: + def __eq__(self, other: 'SubnetCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'SnapshotCollectionNext') -> bool: + def __ne__(self, other: 'SubnetCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class SnapshotIdentity(): +class SubnetIdentity(): """ - Identifies a snapshot by a unique property. + Identifies a subnet by a unique property. """ def __init__(self) -> None: """ - Initialize a SnapshotIdentity object. + Initialize a SubnetIdentity object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['SnapshotIdentityById', 'SnapshotIdentityByCRN', 'SnapshotIdentityByHref'])) + ", ".join(['SubnetIdentityById', 'SubnetIdentityByCRN', 'SubnetIdentityByHref'])) raise Exception(msg) -class SnapshotPatch(): +class SubnetPatch(): """ - SnapshotPatch. + SubnetPatch. - :attr str name: (optional) The user-defined name for this snapshot. - :attr List[str] user_tags: (optional) The [user - tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this - snapshot. + :attr str name: (optional) The user-defined name for this subnet. Names must be + unique within the VPC the subnet resides in. + :attr NetworkACLIdentity network_acl: (optional) The network ACL to use for this + subnet. + :attr SubnetPublicGatewayPatch public_gateway: (optional) The public gateway to + use for internet-bound traffic for this subnet. + :attr RoutingTableIdentity routing_table: (optional) The routing table to use + for this subnet. The routing table properties + `route_direct_link_ingress`, `route_transit_gateway_ingress`, and + `route_vpc_zone_ingress` must be `false`. """ def __init__(self, *, name: str = None, - user_tags: List[str] = None) -> None: + network_acl: 'NetworkACLIdentity' = None, + public_gateway: 'SubnetPublicGatewayPatch' = None, + routing_table: 'RoutingTableIdentity' = None) -> None: """ - Initialize a SnapshotPatch object. + Initialize a SubnetPatch object. - :param str name: (optional) The user-defined name for this snapshot. - :param List[str] user_tags: (optional) The [user - tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with - this snapshot. + :param str name: (optional) The user-defined name for this subnet. Names + must be unique within the VPC the subnet resides in. + :param NetworkACLIdentity network_acl: (optional) The network ACL to use + for this subnet. + :param SubnetPublicGatewayPatch public_gateway: (optional) The public + gateway to use for internet-bound traffic for this subnet. + :param RoutingTableIdentity routing_table: (optional) The routing table to + use for this subnet. The routing table properties + `route_direct_link_ingress`, `route_transit_gateway_ingress`, and + `route_vpc_zone_ingress` must be `false`. """ self.name = name - self.user_tags = user_tags + self.network_acl = network_acl + self.public_gateway = public_gateway + self.routing_table = routing_table @classmethod - def from_dict(cls, _dict: Dict) -> 'SnapshotPatch': - """Initialize a SnapshotPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SubnetPatch': + """Initialize a SubnetPatch object from a json dictionary.""" args = {} if 'name' in _dict: args['name'] = _dict.get('name') - if 'user_tags' in _dict: - args['user_tags'] = _dict.get('user_tags') + if 'network_acl' in _dict: + args['network_acl'] = _dict.get('network_acl') + if 'public_gateway' in _dict: + args['public_gateway'] = _dict.get('public_gateway') + if 'routing_table' in _dict: + args['routing_table'] = _dict.get('routing_table') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a SnapshotPatch object from a json dictionary.""" + """Initialize a SubnetPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -52354,8 +56209,21 @@ def to_dict(self) -> Dict: _dict = {} if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'user_tags') and self.user_tags is not None: - _dict['user_tags'] = self.user_tags + if hasattr(self, 'network_acl') and self.network_acl is not None: + if isinstance(self.network_acl, dict): + _dict['network_acl'] = self.network_acl + else: + _dict['network_acl'] = self.network_acl.to_dict() + if hasattr(self, 'public_gateway') and self.public_gateway is not None: + if isinstance(self.public_gateway, dict): + _dict['public_gateway'] = self.public_gateway + else: + _dict['public_gateway'] = self.public_gateway.to_dict() + if hasattr(self, 'routing_table') and self.routing_table is not None: + if isinstance(self.routing_table, dict): + _dict['routing_table'] = self.routing_table + else: + _dict['routing_table'] = self.routing_table.to_dict() return _dict def _to_dict(self): @@ -52363,128 +56231,335 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this SnapshotPatch object.""" + """Return a `str` version of this SubnetPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'SnapshotPatch') -> bool: + def __eq__(self, other: 'SubnetPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'SnapshotPatch') -> bool: + def __ne__(self, other: 'SubnetPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class SnapshotPrototype(): +class SubnetPrototype(): """ - SnapshotPrototype. + SubnetPrototype. - :attr str name: (optional) The unique user-defined name for this snapshot. If - unspecified, the name will be a hyphenated list of randomly-selected words. + :attr str ip_version: (optional) The IP version(s) to support for this subnet. + :attr str name: (optional) The user-defined name for this subnet. Names must be + unique within the VPC the subnet resides in. If unspecified, the name will be a + hyphenated list of randomly-selected words. + :attr NetworkACLIdentity network_acl: (optional) The network ACL to use for this + subnet. + :attr PublicGatewayIdentity public_gateway: (optional) The public gateway to use + for internet-bound traffic for this subnet. If + unspecified, the subnet will not be attached to a public gateway. :attr ResourceGroupIdentity resource_group: (optional) The resource group to use. If unspecified, the account's [default resource group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - :attr List[str] user_tags: (optional) The [user - tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this - snapshot. + :attr RoutingTableIdentity routing_table: (optional) The routing table to use + for this subnet. If unspecified, the default routing table + for the VPC is used. The routing table properties `route_direct_link_ingress`, + `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` must be `false`. + :attr VPCIdentity vpc: The VPC the subnet is to be a part of. """ def __init__(self, + vpc: 'VPCIdentity', *, + ip_version: str = None, name: str = None, + network_acl: 'NetworkACLIdentity' = None, + public_gateway: 'PublicGatewayIdentity' = None, resource_group: 'ResourceGroupIdentity' = None, - user_tags: List[str] = None) -> None: + routing_table: 'RoutingTableIdentity' = None) -> None: """ - Initialize a SnapshotPrototype object. + Initialize a SubnetPrototype object. - :param str name: (optional) The unique user-defined name for this snapshot. - If unspecified, the name will be a hyphenated list of randomly-selected - words. + :param VPCIdentity vpc: The VPC the subnet is to be a part of. + :param str ip_version: (optional) The IP version(s) to support for this + subnet. + :param str name: (optional) The user-defined name for this subnet. Names + must be unique within the VPC the subnet resides in. If unspecified, the + name will be a hyphenated list of randomly-selected words. + :param NetworkACLIdentity network_acl: (optional) The network ACL to use + for this subnet. + :param PublicGatewayIdentity public_gateway: (optional) The public gateway + to use for internet-bound traffic for this subnet. If + unspecified, the subnet will not be attached to a public gateway. :param ResourceGroupIdentity resource_group: (optional) The resource group to use. If unspecified, the account's [default resource group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - :param List[str] user_tags: (optional) The [user - tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with - this snapshot. + :param RoutingTableIdentity routing_table: (optional) The routing table to + use for this subnet. If unspecified, the default routing table + for the VPC is used. The routing table properties + `route_direct_link_ingress`, + `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` must be + `false`. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['SnapshotPrototypeSnapshotBySourceVolume'])) + ", ".join(['SubnetPrototypeSubnetByTotalCount', 'SubnetPrototypeSubnetByCIDR'])) raise Exception(msg) -class SnapshotReference(): + class IpVersionEnum(str, Enum): + """ + The IP version(s) to support for this subnet. + """ + IPV4 = 'ipv4' + + +class SubnetPublicGatewayPatch(): + """ + The public gateway to use for internet-bound traffic for this subnet. + + """ + + def __init__(self) -> None: + """ + Initialize a SubnetPublicGatewayPatch object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['SubnetPublicGatewayPatchPublicGatewayIdentityById', 'SubnetPublicGatewayPatchPublicGatewayIdentityByCRN', 'SubnetPublicGatewayPatchPublicGatewayIdentityByHref'])) + raise Exception(msg) + +class SubnetReference(): + """ + SubnetReference. + + :attr str crn: The CRN for this subnet. + :attr SubnetReferenceDeleted deleted: (optional) If present, this property + indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str href: The URL for this subnet. + :attr str id: The unique identifier for this subnet. + :attr str name: The user-defined name for this subnet. + :attr str resource_type: The resource type. + """ + + def __init__(self, + crn: str, + href: str, + id: str, + name: str, + resource_type: str, + *, + deleted: 'SubnetReferenceDeleted' = None) -> None: + """ + Initialize a SubnetReference object. + + :param str crn: The CRN for this subnet. + :param str href: The URL for this subnet. + :param str id: The unique identifier for this subnet. + :param str name: The user-defined name for this subnet. + :param str resource_type: The resource type. + :param SubnetReferenceDeleted deleted: (optional) If present, this property + indicates the referenced resource has been deleted and provides + some supplementary information. + """ + self.crn = crn + self.deleted = deleted + self.href = href + self.id = id + self.name = name + self.resource_type = resource_type + + @classmethod + def from_dict(cls, _dict: Dict) -> 'SubnetReference': + """Initialize a SubnetReference object from a json dictionary.""" + args = {} + if 'crn' in _dict: + args['crn'] = _dict.get('crn') + else: + raise ValueError('Required property \'crn\' not present in SubnetReference JSON') + if 'deleted' in _dict: + args['deleted'] = SubnetReferenceDeleted.from_dict(_dict.get('deleted')) + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in SubnetReference JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in SubnetReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in SubnetReference JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in SubnetReference JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a SubnetReference object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this SubnetReference object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'SubnetReference') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'SubnetReference') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + SUBNET = 'subnet' + + +class SubnetReferenceDeleted(): + """ + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. + + :attr str more_info: Link to documentation about deleted resources. + """ + + def __init__(self, + more_info: str) -> None: + """ + Initialize a SubnetReferenceDeleted object. + + :param str more_info: Link to documentation about deleted resources. + """ + self.more_info = more_info + + @classmethod + def from_dict(cls, _dict: Dict) -> 'SubnetReferenceDeleted': + """Initialize a SubnetReferenceDeleted object from a json dictionary.""" + args = {} + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') + else: + raise ValueError('Required property \'more_info\' not present in SubnetReferenceDeleted JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a SubnetReferenceDeleted object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this SubnetReferenceDeleted object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'SubnetReferenceDeleted') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'SubnetReferenceDeleted') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class TrustedProfileIdentity(): + """ + Identifies a trusted profile by a unique property. + + """ + + def __init__(self) -> None: + """ + Initialize a TrustedProfileIdentity object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['TrustedProfileIdentityTrustedProfileById', 'TrustedProfileIdentityTrustedProfileByCRN'])) + raise Exception(msg) + +class TrustedProfileReference(): """ - SnapshotReference. + TrustedProfileReference. - :attr str crn: The CRN of this snapshot. - :attr SnapshotReferenceDeleted deleted: (optional) If present, this property - indicates the referenced resource has been deleted and provides - some supplementary information. - :attr str href: The URL for this snapshot. - :attr str id: The unique identifier for this snapshot. - :attr str name: The user-defined name for this snapshot. + :attr str crn: The CRN for this trusted profile. + :attr str id: The unique identifier for this trusted profile. :attr str resource_type: The resource type. """ def __init__(self, crn: str, - href: str, id: str, - name: str, - resource_type: str, - *, - deleted: 'SnapshotReferenceDeleted' = None) -> None: + resource_type: str) -> None: """ - Initialize a SnapshotReference object. + Initialize a TrustedProfileReference object. - :param str crn: The CRN of this snapshot. - :param str href: The URL for this snapshot. - :param str id: The unique identifier for this snapshot. - :param str name: The user-defined name for this snapshot. + :param str crn: The CRN for this trusted profile. + :param str id: The unique identifier for this trusted profile. :param str resource_type: The resource type. - :param SnapshotReferenceDeleted deleted: (optional) If present, this - property indicates the referenced resource has been deleted and provides - some supplementary information. """ self.crn = crn - self.deleted = deleted - self.href = href self.id = id - self.name = name self.resource_type = resource_type @classmethod - def from_dict(cls, _dict: Dict) -> 'SnapshotReference': - """Initialize a SnapshotReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'TrustedProfileReference': + """Initialize a TrustedProfileReference object from a json dictionary.""" args = {} if 'crn' in _dict: args['crn'] = _dict.get('crn') else: - raise ValueError('Required property \'crn\' not present in SnapshotReference JSON') - if 'deleted' in _dict: - args['deleted'] = SnapshotReferenceDeleted.from_dict(_dict.get('deleted')) - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in SnapshotReference JSON') + raise ValueError('Required property \'crn\' not present in TrustedProfileReference JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in SnapshotReference JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in SnapshotReference JSON') + raise ValueError('Required property \'id\' not present in TrustedProfileReference JSON') if 'resource_type' in _dict: args['resource_type'] = _dict.get('resource_type') else: - raise ValueError('Required property \'resource_type\' not present in SnapshotReference JSON') + raise ValueError('Required property \'resource_type\' not present in TrustedProfileReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a SnapshotReference object from a json dictionary.""" + """Initialize a TrustedProfileReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -52492,14 +56567,8 @@ def to_dict(self) -> Dict: _dict = {} if hasattr(self, 'crn') and self.crn is not None: _dict['crn'] = self.crn - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name if hasattr(self, 'resource_type') and self.resource_type is not None: _dict['resource_type'] = self.resource_type return _dict @@ -52509,16 +56578,16 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this SnapshotReference object.""" + """Return a `str` version of this TrustedProfileReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'SnapshotReference') -> bool: + def __eq__(self, other: 'TrustedProfileReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'SnapshotReference') -> bool: + def __ne__(self, other: 'TrustedProfileReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other @@ -52526,46 +56595,55 @@ class ResourceTypeEnum(str, Enum): """ The resource type. """ - SNAPSHOT = 'snapshot' + TRUSTED_PROFILE = 'trusted_profile' -class SnapshotReferenceDeleted(): +class VCPU(): """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. + The VCPU configuration. - :attr str more_info: Link to documentation about deleted resources. + :attr str architecture: The VCPU architecture. + :attr int count: The number of VCPUs assigned. """ def __init__(self, - more_info: str) -> None: + architecture: str, + count: int) -> None: """ - Initialize a SnapshotReferenceDeleted object. + Initialize a VCPU object. - :param str more_info: Link to documentation about deleted resources. + :param str architecture: The VCPU architecture. + :param int count: The number of VCPUs assigned. """ - self.more_info = more_info + self.architecture = architecture + self.count = count @classmethod - def from_dict(cls, _dict: Dict) -> 'SnapshotReferenceDeleted': - """Initialize a SnapshotReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VCPU': + """Initialize a VCPU object from a json dictionary.""" args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') + if 'architecture' in _dict: + args['architecture'] = _dict.get('architecture') else: - raise ValueError('Required property \'more_info\' not present in SnapshotReferenceDeleted JSON') + raise ValueError('Required property \'architecture\' not present in VCPU JSON') + if 'count' in _dict: + args['count'] = _dict.get('count') + else: + raise ValueError('Required property \'count\' not present in VCPU JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a SnapshotReferenceDeleted object from a json dictionary.""" + """Initialize a VCPU object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'architecture') and self.architecture is not None: + _dict['architecture'] = self.architecture + if hasattr(self, 'count') and self.count is not None: + _dict['count'] = self.count return _dict def _to_dict(self): @@ -52573,232 +56651,196 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this SnapshotReferenceDeleted object.""" + """Return a `str` version of this VCPU object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'SnapshotReferenceDeleted') -> bool: + def __eq__(self, other: 'VCPU') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'SnapshotReferenceDeleted') -> bool: + def __ne__(self, other: 'VCPU') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class Subnet(): +class VPC(): """ - Subnet. + VPC. - :attr int available_ipv4_address_count: The number of IPv4 addresses in this - subnet that are not in-use, and have not been reserved by the user or the - provider. - :attr datetime created_at: The date and time that the subnet was created. - :attr str crn: The CRN for this subnet. - :attr str href: The URL for this subnet. - :attr str id: The unique identifier for this subnet. - :attr str ip_version: The IP version(s) supported by this subnet. - :attr str ipv4_cidr_block: The IPv4 range of the subnet, expressed in CIDR - format. - :attr str name: The user-defined name for this subnet. - :attr NetworkACLReference network_acl: The network ACL for this subnet. - :attr PublicGatewayReference public_gateway: (optional) The public gateway to - use for internet-bound traffic for this subnet. - :attr ResourceGroupReference resource_group: The resource group for this subnet. + :attr bool classic_access: Indicates whether this VPC is connected to Classic + Infrastructure. If true, this VPC's resources have private network connectivity + to the account's Classic Infrastructure resources. Only one VPC, per region, may + be connected in this way. This value is set at creation and subsequently + immutable. + :attr datetime created_at: The date and time that the VPC was created. + :attr str crn: The CRN for this VPC. + :attr List[VPCCSESourceIP] cse_source_ips: (optional) The CSE ([Cloud Service + Endpoint](https://cloud.ibm.com/docs/resources?topic=resources-service-endpoints)) + source IP addresses for the VPC. The VPC will have one CSE source IP address per + zone. + :attr NetworkACLReference default_network_acl: The default network ACL to use + for subnets created in this VPC. + :attr RoutingTableReference default_routing_table: The default routing table to + use for subnets created in this VPC. + :attr SecurityGroupReference default_security_group: The default security group + to use for network interfaces created in this VPC. + :attr str href: The URL for this VPC. + :attr str id: The unique identifier for this VPC. + :attr str name: The unique user-defined name for this VPC. + :attr ResourceGroupReference resource_group: The resource group for this VPC. :attr str resource_type: The resource type. - :attr RoutingTableReference routing_table: The routing table for this subnet. - :attr str status: The status of the subnet. - :attr int total_ipv4_address_count: The total number of IPv4 addresses in this - subnet. - Note: This is calculated as 2(32 - prefix length). For example, the - prefix length `/24` gives:
2(32 - 24) = 28 = 256 - addresses. - :attr VPCReference vpc: The VPC this subnet is a part of. - :attr ZoneReference zone: The zone this subnet resides in. + :attr str status: The status of this VPC. """ def __init__(self, - available_ipv4_address_count: int, + classic_access: bool, created_at: datetime, crn: str, + default_network_acl: 'NetworkACLReference', + default_routing_table: 'RoutingTableReference', + default_security_group: 'SecurityGroupReference', href: str, id: str, - ip_version: str, - ipv4_cidr_block: str, name: str, - network_acl: 'NetworkACLReference', resource_group: 'ResourceGroupReference', resource_type: str, - routing_table: 'RoutingTableReference', status: str, - total_ipv4_address_count: int, - vpc: 'VPCReference', - zone: 'ZoneReference', *, - public_gateway: 'PublicGatewayReference' = None) -> None: + cse_source_ips: List['VPCCSESourceIP'] = None) -> None: """ - Initialize a Subnet object. + Initialize a VPC object. - :param int available_ipv4_address_count: The number of IPv4 addresses in - this subnet that are not in-use, and have not been reserved by the user or - the provider. - :param datetime created_at: The date and time that the subnet was created. - :param str crn: The CRN for this subnet. - :param str href: The URL for this subnet. - :param str id: The unique identifier for this subnet. - :param str ip_version: The IP version(s) supported by this subnet. - :param str ipv4_cidr_block: The IPv4 range of the subnet, expressed in CIDR - format. - :param str name: The user-defined name for this subnet. - :param NetworkACLReference network_acl: The network ACL for this subnet. + :param bool classic_access: Indicates whether this VPC is connected to + Classic Infrastructure. If true, this VPC's resources have private network + connectivity to the account's Classic Infrastructure resources. Only one + VPC, per region, may be connected in this way. This value is set at + creation and subsequently immutable. + :param datetime created_at: The date and time that the VPC was created. + :param str crn: The CRN for this VPC. + :param NetworkACLReference default_network_acl: The default network ACL to + use for subnets created in this VPC. + :param RoutingTableReference default_routing_table: The default routing + table to use for subnets created in this VPC. + :param SecurityGroupReference default_security_group: The default security + group to use for network interfaces created in this VPC. + :param str href: The URL for this VPC. + :param str id: The unique identifier for this VPC. + :param str name: The unique user-defined name for this VPC. :param ResourceGroupReference resource_group: The resource group for this - subnet. + VPC. :param str resource_type: The resource type. - :param RoutingTableReference routing_table: The routing table for this - subnet. - :param str status: The status of the subnet. - :param int total_ipv4_address_count: The total number of IPv4 addresses in - this subnet. - Note: This is calculated as 2(32 - prefix length). For example, - the prefix length `/24` gives:
2(32 - 24) = 28 = - 256 addresses. - :param VPCReference vpc: The VPC this subnet is a part of. - :param ZoneReference zone: The zone this subnet resides in. - :param PublicGatewayReference public_gateway: (optional) The public gateway - to use for internet-bound traffic for this subnet. + :param str status: The status of this VPC. + :param List[VPCCSESourceIP] cse_source_ips: (optional) The CSE ([Cloud + Service + Endpoint](https://cloud.ibm.com/docs/resources?topic=resources-service-endpoints)) + source IP addresses for the VPC. The VPC will have one CSE source IP + address per zone. """ - self.available_ipv4_address_count = available_ipv4_address_count + self.classic_access = classic_access self.created_at = created_at self.crn = crn + self.cse_source_ips = cse_source_ips + self.default_network_acl = default_network_acl + self.default_routing_table = default_routing_table + self.default_security_group = default_security_group self.href = href self.id = id - self.ip_version = ip_version - self.ipv4_cidr_block = ipv4_cidr_block self.name = name - self.network_acl = network_acl - self.public_gateway = public_gateway self.resource_group = resource_group self.resource_type = resource_type - self.routing_table = routing_table self.status = status - self.total_ipv4_address_count = total_ipv4_address_count - self.vpc = vpc - self.zone = zone @classmethod - def from_dict(cls, _dict: Dict) -> 'Subnet': - """Initialize a Subnet object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPC': + """Initialize a VPC object from a json dictionary.""" args = {} - if 'available_ipv4_address_count' in _dict: - args['available_ipv4_address_count'] = _dict.get('available_ipv4_address_count') + if 'classic_access' in _dict: + args['classic_access'] = _dict.get('classic_access') else: - raise ValueError('Required property \'available_ipv4_address_count\' not present in Subnet JSON') + raise ValueError('Required property \'classic_access\' not present in VPC JSON') if 'created_at' in _dict: args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError('Required property \'created_at\' not present in Subnet JSON') + raise ValueError('Required property \'created_at\' not present in VPC JSON') if 'crn' in _dict: args['crn'] = _dict.get('crn') else: - raise ValueError('Required property \'crn\' not present in Subnet JSON') + raise ValueError('Required property \'crn\' not present in VPC JSON') + if 'cse_source_ips' in _dict: + args['cse_source_ips'] = [VPCCSESourceIP.from_dict(x) for x in _dict.get('cse_source_ips')] + if 'default_network_acl' in _dict: + args['default_network_acl'] = NetworkACLReference.from_dict(_dict.get('default_network_acl')) + else: + raise ValueError('Required property \'default_network_acl\' not present in VPC JSON') + if 'default_routing_table' in _dict: + args['default_routing_table'] = RoutingTableReference.from_dict(_dict.get('default_routing_table')) + else: + raise ValueError('Required property \'default_routing_table\' not present in VPC JSON') + if 'default_security_group' in _dict: + args['default_security_group'] = SecurityGroupReference.from_dict(_dict.get('default_security_group')) + else: + raise ValueError('Required property \'default_security_group\' not present in VPC JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in Subnet JSON') + raise ValueError('Required property \'href\' not present in VPC JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in Subnet JSON') - if 'ip_version' in _dict: - args['ip_version'] = _dict.get('ip_version') - else: - raise ValueError('Required property \'ip_version\' not present in Subnet JSON') - if 'ipv4_cidr_block' in _dict: - args['ipv4_cidr_block'] = _dict.get('ipv4_cidr_block') - else: - raise ValueError('Required property \'ipv4_cidr_block\' not present in Subnet JSON') + raise ValueError('Required property \'id\' not present in VPC JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in Subnet JSON') - if 'network_acl' in _dict: - args['network_acl'] = NetworkACLReference.from_dict(_dict.get('network_acl')) - else: - raise ValueError('Required property \'network_acl\' not present in Subnet JSON') - if 'public_gateway' in _dict: - args['public_gateway'] = PublicGatewayReference.from_dict(_dict.get('public_gateway')) + raise ValueError('Required property \'name\' not present in VPC JSON') if 'resource_group' in _dict: args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) else: - raise ValueError('Required property \'resource_group\' not present in Subnet JSON') + raise ValueError('Required property \'resource_group\' not present in VPC JSON') if 'resource_type' in _dict: args['resource_type'] = _dict.get('resource_type') else: - raise ValueError('Required property \'resource_type\' not present in Subnet JSON') - if 'routing_table' in _dict: - args['routing_table'] = RoutingTableReference.from_dict(_dict.get('routing_table')) - else: - raise ValueError('Required property \'routing_table\' not present in Subnet JSON') + raise ValueError('Required property \'resource_type\' not present in VPC JSON') if 'status' in _dict: args['status'] = _dict.get('status') else: - raise ValueError('Required property \'status\' not present in Subnet JSON') - if 'total_ipv4_address_count' in _dict: - args['total_ipv4_address_count'] = _dict.get('total_ipv4_address_count') - else: - raise ValueError('Required property \'total_ipv4_address_count\' not present in Subnet JSON') - if 'vpc' in _dict: - args['vpc'] = VPCReference.from_dict(_dict.get('vpc')) - else: - raise ValueError('Required property \'vpc\' not present in Subnet JSON') - if 'zone' in _dict: - args['zone'] = ZoneReference.from_dict(_dict.get('zone')) - else: - raise ValueError('Required property \'zone\' not present in Subnet JSON') + raise ValueError('Required property \'status\' not present in VPC JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a Subnet object from a json dictionary.""" + """Initialize a VPC object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'available_ipv4_address_count') and self.available_ipv4_address_count is not None: - _dict['available_ipv4_address_count'] = self.available_ipv4_address_count + if hasattr(self, 'classic_access') and self.classic_access is not None: + _dict['classic_access'] = self.classic_access if hasattr(self, 'created_at') and self.created_at is not None: _dict['created_at'] = datetime_to_string(self.created_at) if hasattr(self, 'crn') and self.crn is not None: _dict['crn'] = self.crn + if hasattr(self, 'cse_source_ips') and self.cse_source_ips is not None: + _dict['cse_source_ips'] = [x.to_dict() for x in self.cse_source_ips] + if hasattr(self, 'default_network_acl') and self.default_network_acl is not None: + _dict['default_network_acl'] = self.default_network_acl.to_dict() + if hasattr(self, 'default_routing_table') and self.default_routing_table is not None: + _dict['default_routing_table'] = self.default_routing_table.to_dict() + if hasattr(self, 'default_security_group') and self.default_security_group is not None: + _dict['default_security_group'] = self.default_security_group.to_dict() if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id - if hasattr(self, 'ip_version') and self.ip_version is not None: - _dict['ip_version'] = self.ip_version - if hasattr(self, 'ipv4_cidr_block') and self.ipv4_cidr_block is not None: - _dict['ipv4_cidr_block'] = self.ipv4_cidr_block if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'network_acl') and self.network_acl is not None: - _dict['network_acl'] = self.network_acl.to_dict() - if hasattr(self, 'public_gateway') and self.public_gateway is not None: - _dict['public_gateway'] = self.public_gateway.to_dict() if hasattr(self, 'resource_group') and self.resource_group is not None: _dict['resource_group'] = self.resource_group.to_dict() if hasattr(self, 'resource_type') and self.resource_type is not None: _dict['resource_type'] = self.resource_type - if hasattr(self, 'routing_table') and self.routing_table is not None: - _dict['routing_table'] = self.routing_table.to_dict() if hasattr(self, 'status') and self.status is not None: _dict['status'] = self.status - if hasattr(self, 'total_ipv4_address_count') and self.total_ipv4_address_count is not None: - _dict['total_ipv4_address_count'] = self.total_ipv4_address_count - if hasattr(self, 'vpc') and self.vpc is not None: - _dict['vpc'] = self.vpc.to_dict() - if hasattr(self, 'zone') and self.zone is not None: - _dict['zone'] = self.zone.to_dict() return _dict def _to_dict(self): @@ -52806,36 +56848,29 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this Subnet object.""" + """Return a `str` version of this VPC object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'Subnet') -> bool: + def __eq__(self, other: 'VPC') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'Subnet') -> bool: + def __ne__(self, other: 'VPC') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class IpVersionEnum(str, Enum): - """ - The IP version(s) supported by this subnet. - """ - IPV4 = 'ipv4' - - class ResourceTypeEnum(str, Enum): """ The resource type. """ - SUBNET = 'subnet' + VPC = 'vpc' class StatusEnum(str, Enum): """ - The status of the subnet. + The status of this VPC. """ AVAILABLE = 'available' DELETING = 'deleting' @@ -52843,72 +56878,140 @@ class StatusEnum(str, Enum): PENDING = 'pending' -class SubnetCollection(): +class VPCCSESourceIP(): """ - SubnetCollection. + VPCCSESourceIP. - :attr SubnetCollectionFirst first: A link to the first page of resources. + :attr IP ip: The cloud service endpoint source IP address for this zone. + :attr ZoneReference zone: The zone this cloud service endpoint source IP resides + in. + """ + + def __init__(self, + ip: 'IP', + zone: 'ZoneReference') -> None: + """ + Initialize a VPCCSESourceIP object. + + :param IP ip: The cloud service endpoint source IP address for this zone. + :param ZoneReference zone: The zone this cloud service endpoint source IP + resides in. + """ + self.ip = ip + self.zone = zone + + @classmethod + def from_dict(cls, _dict: Dict) -> 'VPCCSESourceIP': + """Initialize a VPCCSESourceIP object from a json dictionary.""" + args = {} + if 'ip' in _dict: + args['ip'] = IP.from_dict(_dict.get('ip')) + else: + raise ValueError('Required property \'ip\' not present in VPCCSESourceIP JSON') + if 'zone' in _dict: + args['zone'] = ZoneReference.from_dict(_dict.get('zone')) + else: + raise ValueError('Required property \'zone\' not present in VPCCSESourceIP JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a VPCCSESourceIP object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'ip') and self.ip is not None: + _dict['ip'] = self.ip.to_dict() + if hasattr(self, 'zone') and self.zone is not None: + _dict['zone'] = self.zone.to_dict() + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this VPCCSESourceIP object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'VPCCSESourceIP') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'VPCCSESourceIP') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class VPCCollection(): + """ + VPCCollection. + + :attr VPCCollectionFirst first: A link to the first page of resources. :attr int limit: The maximum number of resources that can be returned by the request. - :attr SubnetCollectionNext next: (optional) A link to the next page of - resources. This property is present for all pages + :attr VPCCollectionNext next: (optional) A link to the next page of resources. + This property is present for all pages except the last page. - :attr List[Subnet] subnets: Collection of subnets. :attr int total_count: The total number of resources across all pages. + :attr List[VPC] vpcs: Collection of VPCs. """ def __init__(self, - first: 'SubnetCollectionFirst', + first: 'VPCCollectionFirst', limit: int, - subnets: List['Subnet'], total_count: int, + vpcs: List['VPC'], *, - next: 'SubnetCollectionNext' = None) -> None: + next: 'VPCCollectionNext' = None) -> None: """ - Initialize a SubnetCollection object. + Initialize a VPCCollection object. - :param SubnetCollectionFirst first: A link to the first page of resources. + :param VPCCollectionFirst first: A link to the first page of resources. :param int limit: The maximum number of resources that can be returned by the request. - :param List[Subnet] subnets: Collection of subnets. :param int total_count: The total number of resources across all pages. - :param SubnetCollectionNext next: (optional) A link to the next page of + :param List[VPC] vpcs: Collection of VPCs. + :param VPCCollectionNext next: (optional) A link to the next page of resources. This property is present for all pages except the last page. """ self.first = first self.limit = limit self.next = next - self.subnets = subnets self.total_count = total_count + self.vpcs = vpcs @classmethod - def from_dict(cls, _dict: Dict) -> 'SubnetCollection': - """Initialize a SubnetCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPCCollection': + """Initialize a VPCCollection object from a json dictionary.""" args = {} if 'first' in _dict: - args['first'] = SubnetCollectionFirst.from_dict(_dict.get('first')) + args['first'] = VPCCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'first\' not present in SubnetCollection JSON') + raise ValueError('Required property \'first\' not present in VPCCollection JSON') if 'limit' in _dict: args['limit'] = _dict.get('limit') else: - raise ValueError('Required property \'limit\' not present in SubnetCollection JSON') + raise ValueError('Required property \'limit\' not present in VPCCollection JSON') if 'next' in _dict: - args['next'] = SubnetCollectionNext.from_dict(_dict.get('next')) - if 'subnets' in _dict: - args['subnets'] = [Subnet.from_dict(x) for x in _dict.get('subnets')] - else: - raise ValueError('Required property \'subnets\' not present in SubnetCollection JSON') + args['next'] = VPCCollectionNext.from_dict(_dict.get('next')) if 'total_count' in _dict: args['total_count'] = _dict.get('total_count') else: - raise ValueError('Required property \'total_count\' not present in SubnetCollection JSON') + raise ValueError('Required property \'total_count\' not present in VPCCollection JSON') + if 'vpcs' in _dict: + args['vpcs'] = [VPC.from_dict(x) for x in _dict.get('vpcs')] + else: + raise ValueError('Required property \'vpcs\' not present in VPCCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a SubnetCollection object from a json dictionary.""" + """Initialize a VPCCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -52920,10 +57023,10 @@ def to_dict(self) -> Dict: _dict['limit'] = self.limit if hasattr(self, 'next') and self.next is not None: _dict['next'] = self.next.to_dict() - if hasattr(self, 'subnets') and self.subnets is not None: - _dict['subnets'] = [x.to_dict() for x in self.subnets] if hasattr(self, 'total_count') and self.total_count is not None: _dict['total_count'] = self.total_count + if hasattr(self, 'vpcs') and self.vpcs is not None: + _dict['vpcs'] = [x.to_dict() for x in self.vpcs] return _dict def _to_dict(self): @@ -52931,20 +57034,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this SubnetCollection object.""" + """Return a `str` version of this VPCCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'SubnetCollection') -> bool: + def __eq__(self, other: 'VPCCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'SubnetCollection') -> bool: + def __ne__(self, other: 'VPCCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class SubnetCollectionFirst(): +class VPCCollectionFirst(): """ A link to the first page of resources. @@ -52954,25 +57057,25 @@ class SubnetCollectionFirst(): def __init__(self, href: str) -> None: """ - Initialize a SubnetCollectionFirst object. + Initialize a VPCCollectionFirst object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'SubnetCollectionFirst': - """Initialize a SubnetCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPCCollectionFirst': + """Initialize a VPCCollectionFirst object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in SubnetCollectionFirst JSON') + raise ValueError('Required property \'href\' not present in VPCCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a SubnetCollectionFirst object from a json dictionary.""" + """Initialize a VPCCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -52987,20 +57090,20 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this SubnetCollectionFirst object.""" + """Return a `str` version of this VPCCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'SubnetCollectionFirst') -> bool: + def __eq__(self, other: 'VPCCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'SubnetCollectionFirst') -> bool: + def __ne__(self, other: 'VPCCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class SubnetCollectionNext(): +class VPCCollectionNext(): """ A link to the next page of resources. This property is present for all pages except the last page. @@ -53011,25 +57114,25 @@ class SubnetCollectionNext(): def __init__(self, href: str) -> None: """ - Initialize a SubnetCollectionNext object. + Initialize a VPCCollectionNext object. :param str href: The URL for a page of resources. """ self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'SubnetCollectionNext': - """Initialize a SubnetCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPCCollectionNext': + """Initialize a VPCCollectionNext object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in SubnetCollectionNext JSON') + raise ValueError('Required property \'href\' not present in VPCCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a SubnetCollectionNext object from a json dictionary.""" + """Initialize a VPCCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -53044,92 +57147,62 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this SubnetCollectionNext object.""" + """Return a `str` version of this VPCCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'SubnetCollectionNext') -> bool: + def __eq__(self, other: 'VPCCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'SubnetCollectionNext') -> bool: + def __ne__(self, other: 'VPCCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class SubnetIdentity(): +class VPCIdentity(): """ - Identifies a subnet by a unique property. + Identifies a VPC by a unique property. """ def __init__(self) -> None: """ - Initialize a SubnetIdentity object. + Initialize a VPCIdentity object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['SubnetIdentityById', 'SubnetIdentityByCRN', 'SubnetIdentityByHref'])) + ", ".join(['VPCIdentityById', 'VPCIdentityByCRN', 'VPCIdentityByHref'])) raise Exception(msg) -class SubnetPatch(): +class VPCPatch(): """ - SubnetPatch. + VPCPatch. - :attr str name: (optional) The user-defined name for this subnet. Names must be - unique within the VPC the subnet resides in. - :attr NetworkACLIdentity network_acl: (optional) The network ACL to use for this - subnet. - :attr SubnetPublicGatewayPatch public_gateway: (optional) The public gateway to - use for internet-bound traffic for this subnet. - :attr RoutingTableIdentity routing_table: (optional) The routing table to use - for this subnet. The routing table properties - `route_direct_link_ingress`, `route_transit_gateway_ingress`, and - `route_vpc_zone_ingress` must be `false`. + :attr str name: (optional) The unique user-defined name for this VPC. """ def __init__(self, *, - name: str = None, - network_acl: 'NetworkACLIdentity' = None, - public_gateway: 'SubnetPublicGatewayPatch' = None, - routing_table: 'RoutingTableIdentity' = None) -> None: + name: str = None) -> None: """ - Initialize a SubnetPatch object. + Initialize a VPCPatch object. - :param str name: (optional) The user-defined name for this subnet. Names - must be unique within the VPC the subnet resides in. - :param NetworkACLIdentity network_acl: (optional) The network ACL to use - for this subnet. - :param SubnetPublicGatewayPatch public_gateway: (optional) The public - gateway to use for internet-bound traffic for this subnet. - :param RoutingTableIdentity routing_table: (optional) The routing table to - use for this subnet. The routing table properties - `route_direct_link_ingress`, `route_transit_gateway_ingress`, and - `route_vpc_zone_ingress` must be `false`. + :param str name: (optional) The unique user-defined name for this VPC. """ self.name = name - self.network_acl = network_acl - self.public_gateway = public_gateway - self.routing_table = routing_table @classmethod - def from_dict(cls, _dict: Dict) -> 'SubnetPatch': - """Initialize a SubnetPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPCPatch': + """Initialize a VPCPatch object from a json dictionary.""" args = {} if 'name' in _dict: args['name'] = _dict.get('name') - if 'network_acl' in _dict: - args['network_acl'] = _dict.get('network_acl') - if 'public_gateway' in _dict: - args['public_gateway'] = _dict.get('public_gateway') - if 'routing_table' in _dict: - args['routing_table'] = _dict.get('routing_table') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a SubnetPatch object from a json dictionary.""" + """Initialize a VPCPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -53137,21 +57210,6 @@ def to_dict(self) -> Dict: _dict = {} if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'network_acl') and self.network_acl is not None: - if isinstance(self.network_acl, dict): - _dict['network_acl'] = self.network_acl - else: - _dict['network_acl'] = self.network_acl.to_dict() - if hasattr(self, 'public_gateway') and self.public_gateway is not None: - if isinstance(self.public_gateway, dict): - _dict['public_gateway'] = self.public_gateway - else: - _dict['public_gateway'] = self.public_gateway.to_dict() - if hasattr(self, 'routing_table') and self.routing_table is not None: - if isinstance(self.routing_table, dict): - _dict['routing_table'] = self.routing_table - else: - _dict['routing_table'] = self.routing_table.to_dict() return _dict def _to_dict(self): @@ -53159,113 +57217,30 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this SubnetPatch object.""" + """Return a `str` version of this VPCPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'SubnetPatch') -> bool: + def __eq__(self, other: 'VPCPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'SubnetPatch') -> bool: + def __ne__(self, other: 'VPCPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class SubnetPrototype(): - """ - SubnetPrototype. - - :attr str ip_version: (optional) The IP version(s) to support for this subnet. - :attr str name: (optional) The user-defined name for this subnet. Names must be - unique within the VPC the subnet resides in. If unspecified, the name will be a - hyphenated list of randomly-selected words. - :attr NetworkACLIdentity network_acl: (optional) The network ACL to use for this - subnet. - :attr PublicGatewayIdentity public_gateway: (optional) The public gateway to use - for internet-bound traffic for this subnet. If - unspecified, the subnet will not be attached to a public gateway. - :attr ResourceGroupIdentity resource_group: (optional) The resource group to - use. If unspecified, the account's [default resource - group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - :attr RoutingTableIdentity routing_table: (optional) The routing table to use - for this subnet. If unspecified, the default routing table - for the VPC is used. The routing table properties `route_direct_link_ingress`, - `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` must be `false`. - :attr VPCIdentity vpc: The VPC the subnet is to be a part of. - """ - - def __init__(self, - vpc: 'VPCIdentity', - *, - ip_version: str = None, - name: str = None, - network_acl: 'NetworkACLIdentity' = None, - public_gateway: 'PublicGatewayIdentity' = None, - resource_group: 'ResourceGroupIdentity' = None, - routing_table: 'RoutingTableIdentity' = None) -> None: - """ - Initialize a SubnetPrototype object. - - :param VPCIdentity vpc: The VPC the subnet is to be a part of. - :param str ip_version: (optional) The IP version(s) to support for this - subnet. - :param str name: (optional) The user-defined name for this subnet. Names - must be unique within the VPC the subnet resides in. If unspecified, the - name will be a hyphenated list of randomly-selected words. - :param NetworkACLIdentity network_acl: (optional) The network ACL to use - for this subnet. - :param PublicGatewayIdentity public_gateway: (optional) The public gateway - to use for internet-bound traffic for this subnet. If - unspecified, the subnet will not be attached to a public gateway. - :param ResourceGroupIdentity resource_group: (optional) The resource group - to use. If unspecified, the account's [default resource - group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is - used. - :param RoutingTableIdentity routing_table: (optional) The routing table to - use for this subnet. If unspecified, the default routing table - for the VPC is used. The routing table properties - `route_direct_link_ingress`, - `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` must be - `false`. - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['SubnetPrototypeSubnetByTotalCount', 'SubnetPrototypeSubnetByCIDR'])) - raise Exception(msg) - - class IpVersionEnum(str, Enum): - """ - The IP version(s) to support for this subnet. - """ - IPV4 = 'ipv4' - - -class SubnetPublicGatewayPatch(): - """ - The public gateway to use for internet-bound traffic for this subnet. - - """ - - def __init__(self) -> None: - """ - Initialize a SubnetPublicGatewayPatch object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['SubnetPublicGatewayPatchPublicGatewayIdentityById', 'SubnetPublicGatewayPatchPublicGatewayIdentityByCRN', 'SubnetPublicGatewayPatchPublicGatewayIdentityByHref'])) - raise Exception(msg) - -class SubnetReference(): +class VPCReference(): """ - SubnetReference. + VPCReference. - :attr str crn: The CRN for this subnet. - :attr SubnetReferenceDeleted deleted: (optional) If present, this property + :attr str crn: The CRN for this VPC. + :attr VPCReferenceDeleted deleted: (optional) If present, this property indicates the referenced resource has been deleted and provides some supplementary information. - :attr str href: The URL for this subnet. - :attr str id: The unique identifier for this subnet. - :attr str name: The user-defined name for this subnet. + :attr str href: The URL for this VPC. + :attr str id: The unique identifier for this VPC. + :attr str name: The unique user-defined name for this VPC. :attr str resource_type: The resource type. """ @@ -53276,16 +57251,16 @@ def __init__(self, name: str, resource_type: str, *, - deleted: 'SubnetReferenceDeleted' = None) -> None: + deleted: 'VPCReferenceDeleted' = None) -> None: """ - Initialize a SubnetReference object. + Initialize a VPCReference object. - :param str crn: The CRN for this subnet. - :param str href: The URL for this subnet. - :param str id: The unique identifier for this subnet. - :param str name: The user-defined name for this subnet. + :param str crn: The CRN for this VPC. + :param str href: The URL for this VPC. + :param str id: The unique identifier for this VPC. + :param str name: The unique user-defined name for this VPC. :param str resource_type: The resource type. - :param SubnetReferenceDeleted deleted: (optional) If present, this property + :param VPCReferenceDeleted deleted: (optional) If present, this property indicates the referenced resource has been deleted and provides some supplementary information. """ @@ -53297,36 +57272,36 @@ def __init__(self, self.resource_type = resource_type @classmethod - def from_dict(cls, _dict: Dict) -> 'SubnetReference': - """Initialize a SubnetReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPCReference': + """Initialize a VPCReference object from a json dictionary.""" args = {} if 'crn' in _dict: args['crn'] = _dict.get('crn') else: - raise ValueError('Required property \'crn\' not present in SubnetReference JSON') + raise ValueError('Required property \'crn\' not present in VPCReference JSON') if 'deleted' in _dict: - args['deleted'] = SubnetReferenceDeleted.from_dict(_dict.get('deleted')) + args['deleted'] = VPCReferenceDeleted.from_dict(_dict.get('deleted')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in SubnetReference JSON') + raise ValueError('Required property \'href\' not present in VPCReference JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in SubnetReference JSON') + raise ValueError('Required property \'id\' not present in VPCReference JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in SubnetReference JSON') + raise ValueError('Required property \'name\' not present in VPCReference JSON') if 'resource_type' in _dict: args['resource_type'] = _dict.get('resource_type') else: - raise ValueError('Required property \'resource_type\' not present in SubnetReference JSON') + raise ValueError('Required property \'resource_type\' not present in VPCReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a SubnetReference object from a json dictionary.""" + """Initialize a VPCReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -53351,16 +57326,16 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this SubnetReference object.""" + """Return a `str` version of this VPCReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'SubnetReference') -> bool: + def __eq__(self, other: 'VPCReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'SubnetReference') -> bool: + def __ne__(self, other: 'VPCReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other @@ -53368,10 +57343,10 @@ class ResourceTypeEnum(str, Enum): """ The resource type. """ - SUBNET = 'subnet' + VPC = 'vpc' -class SubnetReferenceDeleted(): +class VPCReferenceDeleted(): """ If present, this property indicates the referenced resource has been deleted and provides some supplementary information. @@ -53382,25 +57357,25 @@ class SubnetReferenceDeleted(): def __init__(self, more_info: str) -> None: """ - Initialize a SubnetReferenceDeleted object. + Initialize a VPCReferenceDeleted object. :param str more_info: Link to documentation about deleted resources. """ self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'SubnetReferenceDeleted': - """Initialize a SubnetReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPCReferenceDeleted': + """Initialize a VPCReferenceDeleted object from a json dictionary.""" args = {} if 'more_info' in _dict: args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'more_info\' not present in SubnetReferenceDeleted JSON') + raise ValueError('Required property \'more_info\' not present in VPCReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a SubnetReferenceDeleted object from a json dictionary.""" + """Initialize a VPCReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -53415,90 +57390,177 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this SubnetReferenceDeleted object.""" + """Return a `str` version of this VPCReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'SubnetReferenceDeleted') -> bool: + def __eq__(self, other: 'VPCReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'SubnetReferenceDeleted') -> bool: + def __ne__(self, other: 'VPCReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class TrustedProfileIdentity(): +class VPNGateway(): """ - Identifies a trusted profile by a unique property. + VPNGateway. + :attr List[VPNGatewayConnectionReference] connections: Connections for this VPN + gateway. + :attr datetime created_at: The date and time that this VPN gateway was created. + :attr str crn: The VPN gateway's CRN. + :attr str href: The VPN gateway's canonical URL. + :attr str id: The unique identifier for this VPN gateway. + :attr List[VPNGatewayMember] members: Collection of VPN gateway members. + :attr str name: The user-defined name for this VPN gateway. + :attr ResourceGroupReference resource_group: The resource group for this VPN + gateway. + :attr str resource_type: The resource type. + :attr str status: The status of the VPN gateway. + :attr SubnetReference subnet: """ - def __init__(self) -> None: + def __init__(self, + connections: List['VPNGatewayConnectionReference'], + created_at: datetime, + crn: str, + href: str, + id: str, + members: List['VPNGatewayMember'], + name: str, + resource_group: 'ResourceGroupReference', + resource_type: str, + status: str, + subnet: 'SubnetReference') -> None: """ - Initialize a TrustedProfileIdentity object. + Initialize a VPNGateway object. + :param List[VPNGatewayConnectionReference] connections: Connections for + this VPN gateway. + :param datetime created_at: The date and time that this VPN gateway was + created. + :param str crn: The VPN gateway's CRN. + :param str href: The VPN gateway's canonical URL. + :param str id: The unique identifier for this VPN gateway. + :param List[VPNGatewayMember] members: Collection of VPN gateway members. + :param str name: The user-defined name for this VPN gateway. + :param ResourceGroupReference resource_group: The resource group for this + VPN gateway. + :param str resource_type: The resource type. + :param str status: The status of the VPN gateway. + :param SubnetReference subnet: """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['TrustedProfileIdentityTrustedProfileById', 'TrustedProfileIdentityTrustedProfileByCRN'])) + ", ".join(['VPNGatewayRouteMode', 'VPNGatewayPolicyMode'])) raise Exception(msg) -class TrustedProfileReference(): + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + VPN_GATEWAY = 'vpn_gateway' + + + class StatusEnum(str, Enum): + """ + The status of the VPN gateway. + """ + AVAILABLE = 'available' + DELETING = 'deleting' + FAILED = 'failed' + PENDING = 'pending' + + +class VPNGatewayCollection(): """ - TrustedProfileReference. + VPNGatewayCollection. - :attr str crn: The CRN for this trusted profile. - :attr str id: The unique identifier for this trusted profile. - :attr str resource_type: The resource type. + :attr VPNGatewayCollectionFirst first: A link to the first page of resources. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr VPNGatewayCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages + except the last page. + :attr int total_count: The total number of resources across all pages. + :attr List[VPNGateway] vpn_gateways: Collection of VPN gateways. """ def __init__(self, - crn: str, - id: str, - resource_type: str) -> None: + first: 'VPNGatewayCollectionFirst', + limit: int, + total_count: int, + vpn_gateways: List['VPNGateway'], + *, + next: 'VPNGatewayCollectionNext' = None) -> None: """ - Initialize a TrustedProfileReference object. + Initialize a VPNGatewayCollection object. - :param str crn: The CRN for this trusted profile. - :param str id: The unique identifier for this trusted profile. - :param str resource_type: The resource type. + :param VPNGatewayCollectionFirst first: A link to the first page of + resources. + :param int limit: The maximum number of resources that can be returned by + the request. + :param int total_count: The total number of resources across all pages. + :param List[VPNGateway] vpn_gateways: Collection of VPN gateways. + :param VPNGatewayCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages + except the last page. """ - self.crn = crn - self.id = id - self.resource_type = resource_type + self.first = first + self.limit = limit + self.next = next + self.total_count = total_count + self.vpn_gateways = vpn_gateways @classmethod - def from_dict(cls, _dict: Dict) -> 'TrustedProfileReference': - """Initialize a TrustedProfileReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPNGatewayCollection': + """Initialize a VPNGatewayCollection object from a json dictionary.""" args = {} - if 'crn' in _dict: - args['crn'] = _dict.get('crn') + if 'first' in _dict: + args['first'] = VPNGatewayCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'crn\' not present in TrustedProfileReference JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') + raise ValueError('Required property \'first\' not present in VPNGatewayCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') else: - raise ValueError('Required property \'id\' not present in TrustedProfileReference JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') + raise ValueError('Required property \'limit\' not present in VPNGatewayCollection JSON') + if 'next' in _dict: + args['next'] = VPNGatewayCollectionNext.from_dict(_dict.get('next')) + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') else: - raise ValueError('Required property \'resource_type\' not present in TrustedProfileReference JSON') + raise ValueError('Required property \'total_count\' not present in VPNGatewayCollection JSON') + if 'vpn_gateways' in _dict: + args['vpn_gateways'] = _dict.get('vpn_gateways') + else: + raise ValueError('Required property \'vpn_gateways\' not present in VPNGatewayCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a TrustedProfileReference object from a json dictionary.""" + """Initialize a VPNGatewayCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + if hasattr(self, 'vpn_gateways') and self.vpn_gateways is not None: + vpn_gateways_list = [] + for x in self.vpn_gateways: + if isinstance(x, dict): + vpn_gateways_list.append(x) + else: + vpn_gateways_list.append(x.to_dict()) + _dict['vpn_gateways'] = vpn_gateways_list return _dict def _to_dict(self): @@ -53506,72 +57568,112 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this TrustedProfileReference object.""" + """Return a `str` version of this VPNGatewayCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'TrustedProfileReference') -> bool: + def __eq__(self, other: 'VPNGatewayCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'TrustedProfileReference') -> bool: + def __ne__(self, other: 'VPNGatewayCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ResourceTypeEnum(str, Enum): +class VPNGatewayCollectionFirst(): + """ + A link to the first page of resources. + + :attr str href: The URL for a page of resources. + """ + + def __init__(self, + href: str) -> None: """ - The resource type. + Initialize a VPNGatewayCollectionFirst object. + + :param str href: The URL for a page of resources. """ - TRUSTED_PROFILE = 'trusted_profile' + self.href = href + + @classmethod + def from_dict(cls, _dict: Dict) -> 'VPNGatewayCollectionFirst': + """Initialize a VPNGatewayCollectionFirst object from a json dictionary.""" + args = {} + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in VPNGatewayCollectionFirst JSON') + return cls(**args) + @classmethod + def _from_dict(cls, _dict): + """Initialize a VPNGatewayCollectionFirst object from a json dictionary.""" + return cls.from_dict(_dict) -class VCPU(): + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this VPNGatewayCollectionFirst object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'VPNGatewayCollectionFirst') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'VPNGatewayCollectionFirst') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class VPNGatewayCollectionNext(): """ - The VCPU configuration. + A link to the next page of resources. This property is present for all pages except + the last page. - :attr str architecture: The VCPU architecture. - :attr int count: The number of VCPUs assigned. + :attr str href: The URL for a page of resources. """ def __init__(self, - architecture: str, - count: int) -> None: + href: str) -> None: """ - Initialize a VCPU object. + Initialize a VPNGatewayCollectionNext object. - :param str architecture: The VCPU architecture. - :param int count: The number of VCPUs assigned. + :param str href: The URL for a page of resources. """ - self.architecture = architecture - self.count = count + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'VCPU': - """Initialize a VCPU object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPNGatewayCollectionNext': + """Initialize a VPNGatewayCollectionNext object from a json dictionary.""" args = {} - if 'architecture' in _dict: - args['architecture'] = _dict.get('architecture') - else: - raise ValueError('Required property \'architecture\' not present in VCPU JSON') - if 'count' in _dict: - args['count'] = _dict.get('count') + if 'href' in _dict: + args['href'] = _dict.get('href') else: - raise ValueError('Required property \'count\' not present in VCPU JSON') + raise ValueError('Required property \'href\' not present in VPNGatewayCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a VCPU object from a json dictionary.""" + """Initialize a VPNGatewayCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'architecture') and self.architecture is not None: - _dict['architecture'] = self.architecture - if hasattr(self, 'count') and self.count is not None: - _dict['count'] = self.count + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -53579,196 +57681,166 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this VCPU object.""" + """Return a `str` version of this VPNGatewayCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'VCPU') -> bool: + def __eq__(self, other: 'VPNGatewayCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'VCPU') -> bool: + def __ne__(self, other: 'VPNGatewayCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class VPC(): +class VPNGatewayConnection(): """ - VPC. + VPNGatewayConnection. - :attr bool classic_access: Indicates whether this VPC is connected to Classic - Infrastructure. If true, this VPC's resources have private network connectivity - to the account's Classic Infrastructure resources. Only one VPC, per region, may - be connected in this way. This value is set at creation and subsequently - immutable. - :attr datetime created_at: The date and time that the VPC was created. - :attr str crn: The CRN for this VPC. - :attr List[VPCCSESourceIP] cse_source_ips: (optional) The CSE ([Cloud Service - Endpoint](https://cloud.ibm.com/docs/resources?topic=resources-service-endpoints)) - source IP addresses for the VPC. The VPC will have one CSE source IP address per - zone. - :attr NetworkACLReference default_network_acl: The default network ACL to use - for subnets created in this VPC. - :attr RoutingTableReference default_routing_table: The default routing table to - use for subnets created in this VPC. - :attr SecurityGroupReference default_security_group: The default security group - to use for network interfaces created in this VPC. - :attr str href: The URL for this VPC. - :attr str id: The unique identifier for this VPC. - :attr str name: The unique user-defined name for this VPC. - :attr ResourceGroupReference resource_group: The resource group for this VPC. + :attr bool admin_state_up: If set to false, the VPN gateway connection is shut + down. + :attr str authentication_mode: The authentication mode. Only `psk` is currently + supported. + :attr datetime created_at: The date and time that this VPN gateway connection + was created. + :attr VPNGatewayConnectionDPD dead_peer_detection: The Dead Peer Detection + settings. + :attr str href: The VPN connection's canonical URL. + :attr str id: The unique identifier for this VPN gateway connection. + :attr IKEPolicyReference ike_policy: (optional) The IKE policy. If absent, + [auto-negotiation is + used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + :attr IPsecPolicyReference ipsec_policy: (optional) The IPsec policy. If absent, + [auto-negotiation is + used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + :attr str mode: The mode of the VPN gateway. + :attr str name: The user-defined name for this VPN gateway connection. + :attr str peer_address: The IP address of the peer VPN gateway. + :attr str psk: The preshared key. :attr str resource_type: The resource type. - :attr str status: The status of this VPC. + :attr str status: The status of a VPN gateway connection. """ def __init__(self, - classic_access: bool, + admin_state_up: bool, + authentication_mode: str, created_at: datetime, - crn: str, - default_network_acl: 'NetworkACLReference', - default_routing_table: 'RoutingTableReference', - default_security_group: 'SecurityGroupReference', + dead_peer_detection: 'VPNGatewayConnectionDPD', href: str, id: str, + mode: str, name: str, - resource_group: 'ResourceGroupReference', + peer_address: str, + psk: str, resource_type: str, status: str, *, - cse_source_ips: List['VPCCSESourceIP'] = None) -> None: + ike_policy: 'IKEPolicyReference' = None, + ipsec_policy: 'IPsecPolicyReference' = None) -> None: """ - Initialize a VPC object. + Initialize a VPNGatewayConnection object. - :param bool classic_access: Indicates whether this VPC is connected to - Classic Infrastructure. If true, this VPC's resources have private network - connectivity to the account's Classic Infrastructure resources. Only one - VPC, per region, may be connected in this way. This value is set at - creation and subsequently immutable. - :param datetime created_at: The date and time that the VPC was created. - :param str crn: The CRN for this VPC. - :param NetworkACLReference default_network_acl: The default network ACL to - use for subnets created in this VPC. - :param RoutingTableReference default_routing_table: The default routing - table to use for subnets created in this VPC. - :param SecurityGroupReference default_security_group: The default security - group to use for network interfaces created in this VPC. - :param str href: The URL for this VPC. - :param str id: The unique identifier for this VPC. - :param str name: The unique user-defined name for this VPC. - :param ResourceGroupReference resource_group: The resource group for this - VPC. + :param bool admin_state_up: If set to false, the VPN gateway connection is + shut down. + :param str authentication_mode: The authentication mode. Only `psk` is + currently supported. + :param datetime created_at: The date and time that this VPN gateway + connection was created. + :param VPNGatewayConnectionDPD dead_peer_detection: The Dead Peer Detection + settings. + :param str href: The VPN connection's canonical URL. + :param str id: The unique identifier for this VPN gateway connection. + :param str mode: The mode of the VPN gateway. + :param str name: The user-defined name for this VPN gateway connection. + :param str peer_address: The IP address of the peer VPN gateway. + :param str psk: The preshared key. :param str resource_type: The resource type. - :param str status: The status of this VPC. - :param List[VPCCSESourceIP] cse_source_ips: (optional) The CSE ([Cloud - Service - Endpoint](https://cloud.ibm.com/docs/resources?topic=resources-service-endpoints)) - source IP addresses for the VPC. The VPC will have one CSE source IP - address per zone. + :param str status: The status of a VPN gateway connection. + :param IKEPolicyReference ike_policy: (optional) The IKE policy. If absent, + [auto-negotiation is + used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + :param IPsecPolicyReference ipsec_policy: (optional) The IPsec policy. If + absent, [auto-negotiation is + used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). """ - self.classic_access = classic_access - self.created_at = created_at - self.crn = crn - self.cse_source_ips = cse_source_ips - self.default_network_acl = default_network_acl - self.default_routing_table = default_routing_table - self.default_security_group = default_security_group - self.href = href - self.id = id - self.name = name - self.resource_group = resource_group - self.resource_type = resource_type - self.status = status + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['VPNGatewayConnectionStaticRouteMode', 'VPNGatewayConnectionPolicyMode'])) + raise Exception(msg) + + class AuthenticationModeEnum(str, Enum): + """ + The authentication mode. Only `psk` is currently supported. + """ + PSK = 'psk' + + + class ModeEnum(str, Enum): + """ + The mode of the VPN gateway. + """ + POLICY = 'policy' + ROUTE = 'route' + + + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + VPN_GATEWAY_CONNECTION = 'vpn_gateway_connection' + + + class StatusEnum(str, Enum): + """ + The status of a VPN gateway connection. + """ + DOWN = 'down' + UP = 'up' + + +class VPNGatewayConnectionCollection(): + """ + Collection of VPN gateway connections in a VPN gateway. + + :attr List[VPNGatewayConnection] connections: Array of VPN gateway connections. + """ + + def __init__(self, + connections: List['VPNGatewayConnection']) -> None: + """ + Initialize a VPNGatewayConnectionCollection object. + + :param List[VPNGatewayConnection] connections: Array of VPN gateway + connections. + """ + self.connections = connections @classmethod - def from_dict(cls, _dict: Dict) -> 'VPC': - """Initialize a VPC object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPNGatewayConnectionCollection': + """Initialize a VPNGatewayConnectionCollection object from a json dictionary.""" args = {} - if 'classic_access' in _dict: - args['classic_access'] = _dict.get('classic_access') - else: - raise ValueError('Required property \'classic_access\' not present in VPC JSON') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - else: - raise ValueError('Required property \'created_at\' not present in VPC JSON') - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in VPC JSON') - if 'cse_source_ips' in _dict: - args['cse_source_ips'] = [VPCCSESourceIP.from_dict(x) for x in _dict.get('cse_source_ips')] - if 'default_network_acl' in _dict: - args['default_network_acl'] = NetworkACLReference.from_dict(_dict.get('default_network_acl')) - else: - raise ValueError('Required property \'default_network_acl\' not present in VPC JSON') - if 'default_routing_table' in _dict: - args['default_routing_table'] = RoutingTableReference.from_dict(_dict.get('default_routing_table')) - else: - raise ValueError('Required property \'default_routing_table\' not present in VPC JSON') - if 'default_security_group' in _dict: - args['default_security_group'] = SecurityGroupReference.from_dict(_dict.get('default_security_group')) - else: - raise ValueError('Required property \'default_security_group\' not present in VPC JSON') - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in VPC JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in VPC JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in VPC JSON') - if 'resource_group' in _dict: - args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) - else: - raise ValueError('Required property \'resource_group\' not present in VPC JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in VPC JSON') - if 'status' in _dict: - args['status'] = _dict.get('status') + if 'connections' in _dict: + args['connections'] = _dict.get('connections') else: - raise ValueError('Required property \'status\' not present in VPC JSON') + raise ValueError('Required property \'connections\' not present in VPNGatewayConnectionCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a VPC object from a json dictionary.""" + """Initialize a VPNGatewayConnectionCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'classic_access') and self.classic_access is not None: - _dict['classic_access'] = self.classic_access - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - if hasattr(self, 'cse_source_ips') and self.cse_source_ips is not None: - _dict['cse_source_ips'] = [x.to_dict() for x in self.cse_source_ips] - if hasattr(self, 'default_network_acl') and self.default_network_acl is not None: - _dict['default_network_acl'] = self.default_network_acl.to_dict() - if hasattr(self, 'default_routing_table') and self.default_routing_table is not None: - _dict['default_routing_table'] = self.default_routing_table.to_dict() - if hasattr(self, 'default_security_group') and self.default_security_group is not None: - _dict['default_security_group'] = self.default_security_group.to_dict() - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'resource_group') and self.resource_group is not None: - _dict['resource_group'] = self.resource_group.to_dict() - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status + if hasattr(self, 'connections') and self.connections is not None: + connections_list = [] + for x in self.connections: + if isinstance(x, dict): + connections_list.append(x) + else: + connections_list.append(x.to_dict()) + _dict['connections'] = connections_list return _dict def _to_dict(self): @@ -53776,84 +57848,77 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this VPC object.""" + """Return a `str` version of this VPNGatewayConnectionCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'VPC') -> bool: + def __eq__(self, other: 'VPNGatewayConnectionCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'VPC') -> bool: + def __ne__(self, other: 'VPNGatewayConnectionCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ResourceTypeEnum(str, Enum): - """ - The resource type. - """ - VPC = 'vpc' - - - class StatusEnum(str, Enum): - """ - The status of this VPC. - """ - AVAILABLE = 'available' - DELETING = 'deleting' - FAILED = 'failed' - PENDING = 'pending' - - -class VPCCSESourceIP(): +class VPNGatewayConnectionDPD(): """ - VPCCSESourceIP. + The Dead Peer Detection settings. - :attr IP ip: The cloud service endpoint source IP address for this zone. - :attr ZoneReference zone: The zone this cloud service endpoint source IP resides - in. + :attr str action: Dead Peer Detection actions. + :attr int interval: Dead Peer Detection interval in seconds. + :attr int timeout: Dead Peer Detection timeout in seconds. Must be at least the + interval. """ def __init__(self, - ip: 'IP', - zone: 'ZoneReference') -> None: + action: str, + interval: int, + timeout: int) -> None: """ - Initialize a VPCCSESourceIP object. + Initialize a VPNGatewayConnectionDPD object. - :param IP ip: The cloud service endpoint source IP address for this zone. - :param ZoneReference zone: The zone this cloud service endpoint source IP - resides in. + :param str action: Dead Peer Detection actions. + :param int interval: Dead Peer Detection interval in seconds. + :param int timeout: Dead Peer Detection timeout in seconds. Must be at + least the interval. """ - self.ip = ip - self.zone = zone + self.action = action + self.interval = interval + self.timeout = timeout @classmethod - def from_dict(cls, _dict: Dict) -> 'VPCCSESourceIP': - """Initialize a VPCCSESourceIP object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPNGatewayConnectionDPD': + """Initialize a VPNGatewayConnectionDPD object from a json dictionary.""" args = {} - if 'ip' in _dict: - args['ip'] = IP.from_dict(_dict.get('ip')) + if 'action' in _dict: + args['action'] = _dict.get('action') else: - raise ValueError('Required property \'ip\' not present in VPCCSESourceIP JSON') - if 'zone' in _dict: - args['zone'] = ZoneReference.from_dict(_dict.get('zone')) + raise ValueError('Required property \'action\' not present in VPNGatewayConnectionDPD JSON') + if 'interval' in _dict: + args['interval'] = _dict.get('interval') else: - raise ValueError('Required property \'zone\' not present in VPCCSESourceIP JSON') + raise ValueError('Required property \'interval\' not present in VPNGatewayConnectionDPD JSON') + if 'timeout' in _dict: + args['timeout'] = _dict.get('timeout') + else: + raise ValueError('Required property \'timeout\' not present in VPNGatewayConnectionDPD JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a VPCCSESourceIP object from a json dictionary.""" + """Initialize a VPNGatewayConnectionDPD object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'ip') and self.ip is not None: - _dict['ip'] = self.ip.to_dict() - if hasattr(self, 'zone') and self.zone is not None: - _dict['zone'] = self.zone.to_dict() + if hasattr(self, 'action') and self.action is not None: + _dict['action'] = self.action + if hasattr(self, 'interval') and self.interval is not None: + _dict['interval'] = self.interval + if hasattr(self, 'timeout') and self.timeout is not None: + _dict['timeout'] = self.timeout return _dict def _to_dict(self): @@ -53861,100 +57926,82 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this VPCCSESourceIP object.""" + """Return a `str` version of this VPNGatewayConnectionDPD object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'VPCCSESourceIP') -> bool: + def __eq__(self, other: 'VPNGatewayConnectionDPD') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'VPCCSESourceIP') -> bool: + def __ne__(self, other: 'VPNGatewayConnectionDPD') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class VPCCollection(): + class ActionEnum(str, Enum): + """ + Dead Peer Detection actions. + """ + CLEAR = 'clear' + HOLD = 'hold' + NONE = 'none' + RESTART = 'restart' + + +class VPNGatewayConnectionDPDPatch(): """ - VPCCollection. + The Dead Peer Detection settings. - :attr VPCCollectionFirst first: A link to the first page of resources. - :attr int limit: The maximum number of resources that can be returned by the - request. - :attr VPCCollectionNext next: (optional) A link to the next page of resources. - This property is present for all pages - except the last page. - :attr int total_count: The total number of resources across all pages. - :attr List[VPC] vpcs: Collection of VPCs. + :attr str action: (optional) Dead Peer Detection actions. + :attr int interval: (optional) Dead Peer Detection interval in seconds. + :attr int timeout: (optional) Dead Peer Detection timeout in seconds. Must be at + least the interval. """ def __init__(self, - first: 'VPCCollectionFirst', - limit: int, - total_count: int, - vpcs: List['VPC'], *, - next: 'VPCCollectionNext' = None) -> None: + action: str = None, + interval: int = None, + timeout: int = None) -> None: """ - Initialize a VPCCollection object. + Initialize a VPNGatewayConnectionDPDPatch object. - :param VPCCollectionFirst first: A link to the first page of resources. - :param int limit: The maximum number of resources that can be returned by - the request. - :param int total_count: The total number of resources across all pages. - :param List[VPC] vpcs: Collection of VPCs. - :param VPCCollectionNext next: (optional) A link to the next page of - resources. This property is present for all pages - except the last page. + :param str action: (optional) Dead Peer Detection actions. + :param int interval: (optional) Dead Peer Detection interval in seconds. + :param int timeout: (optional) Dead Peer Detection timeout in seconds. Must + be at least the interval. """ - self.first = first - self.limit = limit - self.next = next - self.total_count = total_count - self.vpcs = vpcs + self.action = action + self.interval = interval + self.timeout = timeout @classmethod - def from_dict(cls, _dict: Dict) -> 'VPCCollection': - """Initialize a VPCCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPNGatewayConnectionDPDPatch': + """Initialize a VPNGatewayConnectionDPDPatch object from a json dictionary.""" args = {} - if 'first' in _dict: - args['first'] = VPCCollectionFirst.from_dict(_dict.get('first')) - else: - raise ValueError('Required property \'first\' not present in VPCCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') - else: - raise ValueError('Required property \'limit\' not present in VPCCollection JSON') - if 'next' in _dict: - args['next'] = VPCCollectionNext.from_dict(_dict.get('next')) - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') - else: - raise ValueError('Required property \'total_count\' not present in VPCCollection JSON') - if 'vpcs' in _dict: - args['vpcs'] = [VPC.from_dict(x) for x in _dict.get('vpcs')] - else: - raise ValueError('Required property \'vpcs\' not present in VPCCollection JSON') + if 'action' in _dict: + args['action'] = _dict.get('action') + if 'interval' in _dict: + args['interval'] = _dict.get('interval') + if 'timeout' in _dict: + args['timeout'] = _dict.get('timeout') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a VPCCollection object from a json dictionary.""" + """Initialize a VPNGatewayConnectionDPDPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count - if hasattr(self, 'vpcs') and self.vpcs is not None: - _dict['vpcs'] = [x.to_dict() for x in self.vpcs] + if hasattr(self, 'action') and self.action is not None: + _dict['action'] = self.action + if hasattr(self, 'interval') and self.interval is not None: + _dict['interval'] = self.interval + if hasattr(self, 'timeout') and self.timeout is not None: + _dict['timeout'] = self.timeout return _dict def _to_dict(self): @@ -53962,55 +58009,82 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this VPCCollection object.""" + """Return a `str` version of this VPNGatewayConnectionDPDPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'VPCCollection') -> bool: + def __eq__(self, other: 'VPNGatewayConnectionDPDPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'VPCCollection') -> bool: + def __ne__(self, other: 'VPNGatewayConnectionDPDPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class VPCCollectionFirst(): + class ActionEnum(str, Enum): + """ + Dead Peer Detection actions. + """ + CLEAR = 'clear' + HOLD = 'hold' + NONE = 'none' + RESTART = 'restart' + + +class VPNGatewayConnectionDPDPrototype(): """ - A link to the first page of resources. + The Dead Peer Detection settings. - :attr str href: The URL for a page of resources. + :attr str action: (optional) Dead Peer Detection actions. + :attr int interval: (optional) Dead Peer Detection interval in seconds. + :attr int timeout: (optional) Dead Peer Detection timeout in seconds. Must be at + least the interval. """ def __init__(self, - href: str) -> None: + *, + action: str = None, + interval: int = None, + timeout: int = None) -> None: """ - Initialize a VPCCollectionFirst object. + Initialize a VPNGatewayConnectionDPDPrototype object. - :param str href: The URL for a page of resources. + :param str action: (optional) Dead Peer Detection actions. + :param int interval: (optional) Dead Peer Detection interval in seconds. + :param int timeout: (optional) Dead Peer Detection timeout in seconds. Must + be at least the interval. """ - self.href = href + self.action = action + self.interval = interval + self.timeout = timeout - @classmethod - def from_dict(cls, _dict: Dict) -> 'VPCCollectionFirst': - """Initialize a VPCCollectionFirst object from a json dictionary.""" + @classmethod + def from_dict(cls, _dict: Dict) -> 'VPNGatewayConnectionDPDPrototype': + """Initialize a VPNGatewayConnectionDPDPrototype object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in VPCCollectionFirst JSON') + if 'action' in _dict: + args['action'] = _dict.get('action') + if 'interval' in _dict: + args['interval'] = _dict.get('interval') + if 'timeout' in _dict: + args['timeout'] = _dict.get('timeout') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a VPCCollectionFirst object from a json dictionary.""" + """Initialize a VPNGatewayConnectionDPDPrototype object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'action') and self.action is not None: + _dict['action'] = self.action + if hasattr(self, 'interval') and self.interval is not None: + _dict['interval'] = self.interval + if hasattr(self, 'timeout') and self.timeout is not None: + _dict['timeout'] = self.timeout return _dict def _to_dict(self): @@ -54018,56 +58092,128 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this VPCCollectionFirst object.""" + """Return a `str` version of this VPNGatewayConnectionDPDPrototype object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'VPCCollectionFirst') -> bool: + def __eq__(self, other: 'VPNGatewayConnectionDPDPrototype') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'VPCCollectionFirst') -> bool: + def __ne__(self, other: 'VPNGatewayConnectionDPDPrototype') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class VPCCollectionNext(): + class ActionEnum(str, Enum): + """ + Dead Peer Detection actions. + """ + CLEAR = 'clear' + HOLD = 'hold' + NONE = 'none' + RESTART = 'restart' + + +class VPNGatewayConnectionIKEPolicyPatch(): """ - A link to the next page of resources. This property is present for all pages except - the last page. + The IKE policy to use. Specify `null` to remove any existing policy, [resulting in + auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). - :attr str href: The URL for a page of resources. + """ + + def __init__(self) -> None: + """ + Initialize a VPNGatewayConnectionIKEPolicyPatch object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['VPNGatewayConnectionIKEPolicyPatchIKEPolicyIdentityById', 'VPNGatewayConnectionIKEPolicyPatchIKEPolicyIdentityByHref'])) + raise Exception(msg) + +class VPNGatewayConnectionIKEPolicyPrototype(): + """ + The IKE policy to use. If unspecified, [auto-negotiation will be + used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + + """ + + def __init__(self) -> None: + """ + Initialize a VPNGatewayConnectionIKEPolicyPrototype object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['VPNGatewayConnectionIKEPolicyPrototypeIKEPolicyIdentityById', 'VPNGatewayConnectionIKEPolicyPrototypeIKEPolicyIdentityByHref'])) + raise Exception(msg) + +class VPNGatewayConnectionIPsecPolicyPatch(): + """ + The IPsec policy to use. Specify `null` to remove any existing policy, [resulting in + auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + + """ + + def __init__(self) -> None: + """ + Initialize a VPNGatewayConnectionIPsecPolicyPatch object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityById', 'VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref'])) + raise Exception(msg) + +class VPNGatewayConnectionIPsecPolicyPrototype(): + """ + The IPsec policy to use. If unspecified, [auto-negotiation will be + used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + + """ + + def __init__(self) -> None: + """ + Initialize a VPNGatewayConnectionIPsecPolicyPrototype object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityById', 'VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref'])) + raise Exception(msg) + +class VPNGatewayConnectionLocalCIDRs(): + """ + VPNGatewayConnectionLocalCIDRs. + + :attr List[str] local_cidrs: (optional) The local CIDRs for this resource. """ def __init__(self, - href: str) -> None: + *, + local_cidrs: List[str] = None) -> None: """ - Initialize a VPCCollectionNext object. + Initialize a VPNGatewayConnectionLocalCIDRs object. - :param str href: The URL for a page of resources. + :param List[str] local_cidrs: (optional) The local CIDRs for this resource. """ - self.href = href + self.local_cidrs = local_cidrs @classmethod - def from_dict(cls, _dict: Dict) -> 'VPCCollectionNext': - """Initialize a VPCCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPNGatewayConnectionLocalCIDRs': + """Initialize a VPNGatewayConnectionLocalCIDRs object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in VPCCollectionNext JSON') + if 'local_cidrs' in _dict: + args['local_cidrs'] = _dict.get('local_cidrs') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a VPCCollectionNext object from a json dictionary.""" + """Initialize a VPNGatewayConnectionLocalCIDRs object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'local_cidrs') and self.local_cidrs is not None: + _dict['local_cidrs'] = self.local_cidrs return _dict def _to_dict(self): @@ -54075,69 +58221,106 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this VPCCollectionNext object.""" + """Return a `str` version of this VPNGatewayConnectionLocalCIDRs object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'VPCCollectionNext') -> bool: + def __eq__(self, other: 'VPNGatewayConnectionLocalCIDRs') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'VPCCollectionNext') -> bool: + def __ne__(self, other: 'VPNGatewayConnectionLocalCIDRs') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class VPCIdentity(): +class VPNGatewayConnectionPatch(): """ - Identifies a VPC by a unique property. + VPNGatewayConnectionPatch. + :attr bool admin_state_up: (optional) If set to false, the VPN gateway + connection is shut down. + :attr VPNGatewayConnectionDPDPatch dead_peer_detection: (optional) The Dead Peer + Detection settings. + :attr VPNGatewayConnectionIKEPolicyPatch ike_policy: (optional) The IKE policy + to use. Specify `null` to remove any existing policy, [resulting in + auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + :attr VPNGatewayConnectionIPsecPolicyPatch ipsec_policy: (optional) The IPsec + policy to use. Specify `null` to remove any existing policy, [resulting in + auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + :attr str name: (optional) The user-defined name for this VPN gateway + connection. + :attr str peer_address: (optional) The IP address of the peer VPN gateway. + :attr str psk: (optional) The preshared key. """ - def __init__(self) -> None: + def __init__(self, + *, + admin_state_up: bool = None, + dead_peer_detection: 'VPNGatewayConnectionDPDPatch' = None, + ike_policy: 'VPNGatewayConnectionIKEPolicyPatch' = None, + ipsec_policy: 'VPNGatewayConnectionIPsecPolicyPatch' = None, + name: str = None, + peer_address: str = None, + psk: str = None) -> None: """ - Initialize a VPCIdentity object. + Initialize a VPNGatewayConnectionPatch object. + :param bool admin_state_up: (optional) If set to false, the VPN gateway + connection is shut down. + :param VPNGatewayConnectionDPDPatch dead_peer_detection: (optional) The + Dead Peer Detection settings. + :param VPNGatewayConnectionIKEPolicyPatch ike_policy: (optional) The IKE + policy to use. Specify `null` to remove any existing policy, [resulting in + auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + :param VPNGatewayConnectionIPsecPolicyPatch ipsec_policy: (optional) The + IPsec policy to use. Specify `null` to remove any existing policy, + [resulting in + auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + :param str name: (optional) The user-defined name for this VPN gateway + connection. + :param str peer_address: (optional) The IP address of the peer VPN gateway. + :param str psk: (optional) The preshared key. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['VPCIdentityById', 'VPCIdentityByCRN', 'VPCIdentityByHref'])) + ", ".join(['VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch'])) raise Exception(msg) -class VPCPatch(): +class VPNGatewayConnectionPeerCIDRs(): """ - VPCPatch. + VPNGatewayConnectionPeerCIDRs. - :attr str name: (optional) The unique user-defined name for this VPC. + :attr List[str] peer_cidrs: (optional) The peer CIDRs for this resource. """ def __init__(self, *, - name: str = None) -> None: + peer_cidrs: List[str] = None) -> None: """ - Initialize a VPCPatch object. + Initialize a VPNGatewayConnectionPeerCIDRs object. - :param str name: (optional) The unique user-defined name for this VPC. + :param List[str] peer_cidrs: (optional) The peer CIDRs for this resource. """ - self.name = name + self.peer_cidrs = peer_cidrs @classmethod - def from_dict(cls, _dict: Dict) -> 'VPCPatch': - """Initialize a VPCPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPNGatewayConnectionPeerCIDRs': + """Initialize a VPNGatewayConnectionPeerCIDRs object from a json dictionary.""" args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') + if 'peer_cidrs' in _dict: + args['peer_cidrs'] = _dict.get('peer_cidrs') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a VPCPatch object from a json dictionary.""" + """Initialize a VPNGatewayConnectionPeerCIDRs object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name + if hasattr(self, 'peer_cidrs') and self.peer_cidrs is not None: + _dict['peer_cidrs'] = self.peer_cidrs return _dict def _to_dict(self): @@ -54145,54 +58328,102 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this VPCPatch object.""" + """Return a `str` version of this VPNGatewayConnectionPeerCIDRs object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'VPCPatch') -> bool: + def __eq__(self, other: 'VPNGatewayConnectionPeerCIDRs') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'VPCPatch') -> bool: + def __ne__(self, other: 'VPNGatewayConnectionPeerCIDRs') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class VPCReference(): +class VPNGatewayConnectionPrototype(): """ - VPCReference. + VPNGatewayConnectionPrototype. - :attr str crn: The CRN for this VPC. - :attr VPCReferenceDeleted deleted: (optional) If present, this property - indicates the referenced resource has been deleted and provides + :attr bool admin_state_up: (optional) If set to false, the VPN gateway + connection is shut down. + :attr VPNGatewayConnectionDPDPrototype dead_peer_detection: (optional) The Dead + Peer Detection settings. + :attr VPNGatewayConnectionIKEPolicyPrototype ike_policy: (optional) The IKE + policy to use. If unspecified, [auto-negotiation will be + used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + :attr VPNGatewayConnectionIPsecPolicyPrototype ipsec_policy: (optional) The + IPsec policy to use. If unspecified, [auto-negotiation will be + used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + :attr str name: (optional) The user-defined name for this VPN gateway + connection. + :attr str peer_address: The IP address of the peer VPN gateway. + :attr str psk: The preshared key. + """ + + def __init__(self, + peer_address: str, + psk: str, + *, + admin_state_up: bool = None, + dead_peer_detection: 'VPNGatewayConnectionDPDPrototype' = None, + ike_policy: 'VPNGatewayConnectionIKEPolicyPrototype' = None, + ipsec_policy: 'VPNGatewayConnectionIPsecPolicyPrototype' = None, + name: str = None) -> None: + """ + Initialize a VPNGatewayConnectionPrototype object. + + :param str peer_address: The IP address of the peer VPN gateway. + :param str psk: The preshared key. + :param bool admin_state_up: (optional) If set to false, the VPN gateway + connection is shut down. + :param VPNGatewayConnectionDPDPrototype dead_peer_detection: (optional) The + Dead Peer Detection settings. + :param VPNGatewayConnectionIKEPolicyPrototype ike_policy: (optional) The + IKE policy to use. If unspecified, [auto-negotiation will be + used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + :param VPNGatewayConnectionIPsecPolicyPrototype ipsec_policy: (optional) + The IPsec policy to use. If unspecified, [auto-negotiation will be + used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + :param str name: (optional) The user-defined name for this VPN gateway + connection. + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype', 'VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype'])) + raise Exception(msg) + +class VPNGatewayConnectionReference(): + """ + VPNGatewayConnectionReference. + + :attr VPNGatewayConnectionReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides some supplementary information. - :attr str href: The URL for this VPC. - :attr str id: The unique identifier for this VPC. - :attr str name: The unique user-defined name for this VPC. + :attr str href: The VPN connection's canonical URL. + :attr str id: The unique identifier for this VPN gateway connection. + :attr str name: The user-defined name for this VPN connection. :attr str resource_type: The resource type. """ def __init__(self, - crn: str, href: str, id: str, name: str, resource_type: str, *, - deleted: 'VPCReferenceDeleted' = None) -> None: + deleted: 'VPNGatewayConnectionReferenceDeleted' = None) -> None: """ - Initialize a VPCReference object. + Initialize a VPNGatewayConnectionReference object. - :param str crn: The CRN for this VPC. - :param str href: The URL for this VPC. - :param str id: The unique identifier for this VPC. - :param str name: The unique user-defined name for this VPC. + :param str href: The VPN connection's canonical URL. + :param str id: The unique identifier for this VPN gateway connection. + :param str name: The user-defined name for this VPN connection. :param str resource_type: The resource type. - :param VPCReferenceDeleted deleted: (optional) If present, this property - indicates the referenced resource has been deleted and provides + :param VPNGatewayConnectionReferenceDeleted deleted: (optional) If present, + this property indicates the referenced resource has been deleted and + provides some supplementary information. """ - self.crn = crn self.deleted = deleted self.href = href self.id = id @@ -54200,43 +58431,37 @@ def __init__(self, self.resource_type = resource_type @classmethod - def from_dict(cls, _dict: Dict) -> 'VPCReference': - """Initialize a VPCReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPNGatewayConnectionReference': + """Initialize a VPNGatewayConnectionReference object from a json dictionary.""" args = {} - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in VPCReference JSON') if 'deleted' in _dict: - args['deleted'] = VPCReferenceDeleted.from_dict(_dict.get('deleted')) + args['deleted'] = VPNGatewayConnectionReferenceDeleted.from_dict(_dict.get('deleted')) if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in VPCReference JSON') + raise ValueError('Required property \'href\' not present in VPNGatewayConnectionReference JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in VPCReference JSON') + raise ValueError('Required property \'id\' not present in VPNGatewayConnectionReference JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError('Required property \'name\' not present in VPCReference JSON') + raise ValueError('Required property \'name\' not present in VPNGatewayConnectionReference JSON') if 'resource_type' in _dict: args['resource_type'] = _dict.get('resource_type') else: - raise ValueError('Required property \'resource_type\' not present in VPCReference JSON') + raise ValueError('Required property \'resource_type\' not present in VPNGatewayConnectionReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a VPCReference object from a json dictionary.""" + """Initialize a VPNGatewayConnectionReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn if hasattr(self, 'deleted') and self.deleted is not None: _dict['deleted'] = self.deleted.to_dict() if hasattr(self, 'href') and self.href is not None: @@ -54254,16 +58479,16 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this VPCReference object.""" + """Return a `str` version of this VPNGatewayConnectionReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'VPCReference') -> bool: + def __eq__(self, other: 'VPNGatewayConnectionReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'VPCReference') -> bool: + def __ne__(self, other: 'VPNGatewayConnectionReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other @@ -54271,10 +58496,10 @@ class ResourceTypeEnum(str, Enum): """ The resource type. """ - VPC = 'vpc' + VPN_GATEWAY_CONNECTION = 'vpn_gateway_connection' -class VPCReferenceDeleted(): +class VPNGatewayConnectionReferenceDeleted(): """ If present, this property indicates the referenced resource has been deleted and provides some supplementary information. @@ -54285,25 +58510,25 @@ class VPCReferenceDeleted(): def __init__(self, more_info: str) -> None: """ - Initialize a VPCReferenceDeleted object. + Initialize a VPNGatewayConnectionReferenceDeleted object. :param str more_info: Link to documentation about deleted resources. """ self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'VPCReferenceDeleted': - """Initialize a VPCReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPNGatewayConnectionReferenceDeleted': + """Initialize a VPNGatewayConnectionReferenceDeleted object from a json dictionary.""" args = {} if 'more_info' in _dict: args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'more_info\' not present in VPCReferenceDeleted JSON') + raise ValueError('Required property \'more_info\' not present in VPNGatewayConnectionReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a VPCReferenceDeleted object from a json dictionary.""" + """Initialize a VPNGatewayConnectionReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -54318,82 +58543,198 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this VPCReferenceDeleted object.""" + """Return a `str` version of this VPNGatewayConnectionReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'VPCReferenceDeleted') -> bool: + def __eq__(self, other: 'VPNGatewayConnectionReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'VPCReferenceDeleted') -> bool: + def __ne__(self, other: 'VPNGatewayConnectionReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class VPNGateway(): +class VPNGatewayConnectionStaticRouteModeTunnel(): """ - VPNGateway. + VPNGatewayConnectionStaticRouteModeTunnel. - :attr List[VPNGatewayConnectionReference] connections: Connections for this VPN - gateway. - :attr datetime created_at: The date and time that this VPN gateway was created. - :attr str crn: The VPN gateway's CRN. - :attr str href: The VPN gateway's canonical URL. - :attr str id: The unique identifier for this VPN gateway. - :attr List[VPNGatewayMember] members: Collection of VPN gateway members. - :attr str name: The user-defined name for this VPN gateway. - :attr ResourceGroupReference resource_group: The resource group for this VPN - gateway. - :attr str resource_type: The resource type. - :attr str status: The status of the VPN gateway. - :attr SubnetReference subnet: + :attr IP public_ip: The IP address of the VPN gateway member in which the tunnel + resides. + :attr str status: The status of the VPN Tunnel. + """ + + def __init__(self, + public_ip: 'IP', + status: str) -> None: + """ + Initialize a VPNGatewayConnectionStaticRouteModeTunnel object. + + :param IP public_ip: The IP address of the VPN gateway member in which the + tunnel resides. + :param str status: The status of the VPN Tunnel. + """ + self.public_ip = public_ip + self.status = status + + @classmethod + def from_dict(cls, _dict: Dict) -> 'VPNGatewayConnectionStaticRouteModeTunnel': + """Initialize a VPNGatewayConnectionStaticRouteModeTunnel object from a json dictionary.""" + args = {} + if 'public_ip' in _dict: + args['public_ip'] = IP.from_dict(_dict.get('public_ip')) + else: + raise ValueError('Required property \'public_ip\' not present in VPNGatewayConnectionStaticRouteModeTunnel JSON') + if 'status' in _dict: + args['status'] = _dict.get('status') + else: + raise ValueError('Required property \'status\' not present in VPNGatewayConnectionStaticRouteModeTunnel JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a VPNGatewayConnectionStaticRouteModeTunnel object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'public_ip') and self.public_ip is not None: + _dict['public_ip'] = self.public_ip.to_dict() + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this VPNGatewayConnectionStaticRouteModeTunnel object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'VPNGatewayConnectionStaticRouteModeTunnel') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'VPNGatewayConnectionStaticRouteModeTunnel') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class StatusEnum(str, Enum): + """ + The status of the VPN Tunnel. + """ + DOWN = 'down' + UP = 'up' + + +class VPNGatewayMember(): + """ + VPNGatewayMember. + + :attr IP private_ip: (optional) The private IP address assigned to the VPN + gateway member. + This property will be present only when the VPN gateway status is `available`. + :attr IP public_ip: The public IP address assigned to the VPN gateway member. + :attr str role: The high availability role assigned to the VPN gateway member. + :attr str status: The status of the VPN gateway member. """ - def __init__(self, - connections: List['VPNGatewayConnectionReference'], - created_at: datetime, - crn: str, - href: str, - id: str, - members: List['VPNGatewayMember'], - name: str, - resource_group: 'ResourceGroupReference', - resource_type: str, - status: str, - subnet: 'SubnetReference') -> None: - """ - Initialize a VPNGateway object. + def __init__(self, + public_ip: 'IP', + role: str, + status: str, + *, + private_ip: 'IP' = None) -> None: + """ + Initialize a VPNGatewayMember object. + + :param IP public_ip: The public IP address assigned to the VPN gateway + member. + :param str role: The high availability role assigned to the VPN gateway + member. + :param str status: The status of the VPN gateway member. + :param IP private_ip: (optional) The private IP address assigned to the VPN + gateway member. + This property will be present only when the VPN gateway status is + `available`. + """ + self.private_ip = private_ip + self.public_ip = public_ip + self.role = role + self.status = status + + @classmethod + def from_dict(cls, _dict: Dict) -> 'VPNGatewayMember': + """Initialize a VPNGatewayMember object from a json dictionary.""" + args = {} + if 'private_ip' in _dict: + args['private_ip'] = IP.from_dict(_dict.get('private_ip')) + if 'public_ip' in _dict: + args['public_ip'] = IP.from_dict(_dict.get('public_ip')) + else: + raise ValueError('Required property \'public_ip\' not present in VPNGatewayMember JSON') + if 'role' in _dict: + args['role'] = _dict.get('role') + else: + raise ValueError('Required property \'role\' not present in VPNGatewayMember JSON') + if 'status' in _dict: + args['status'] = _dict.get('status') + else: + raise ValueError('Required property \'status\' not present in VPNGatewayMember JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a VPNGatewayMember object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'private_ip') and self.private_ip is not None: + _dict['private_ip'] = self.private_ip.to_dict() + if hasattr(self, 'public_ip') and self.public_ip is not None: + _dict['public_ip'] = self.public_ip.to_dict() + if hasattr(self, 'role') and self.role is not None: + _dict['role'] = self.role + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() - :param List[VPNGatewayConnectionReference] connections: Connections for - this VPN gateway. - :param datetime created_at: The date and time that this VPN gateway was - created. - :param str crn: The VPN gateway's CRN. - :param str href: The VPN gateway's canonical URL. - :param str id: The unique identifier for this VPN gateway. - :param List[VPNGatewayMember] members: Collection of VPN gateway members. - :param str name: The user-defined name for this VPN gateway. - :param ResourceGroupReference resource_group: The resource group for this - VPN gateway. - :param str resource_type: The resource type. - :param str status: The status of the VPN gateway. - :param SubnetReference subnet: - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['VPNGatewayRouteMode', 'VPNGatewayPolicyMode'])) - raise Exception(msg) + def __str__(self) -> str: + """Return a `str` version of this VPNGatewayMember object.""" + return json.dumps(self.to_dict(), indent=2) - class ResourceTypeEnum(str, Enum): + def __eq__(self, other: 'VPNGatewayMember') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'VPNGatewayMember') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class RoleEnum(str, Enum): """ - The resource type. + The high availability role assigned to the VPN gateway member. """ - VPN_GATEWAY = 'vpn_gateway' + ACTIVE = 'active' + STANDBY = 'standby' class StatusEnum(str, Enum): """ - The status of the VPN gateway. + The status of the VPN gateway member. """ AVAILABLE = 'available' DELETING = 'deleting' @@ -54401,94 +58742,41 @@ class StatusEnum(str, Enum): PENDING = 'pending' -class VPNGatewayCollection(): +class VPNGatewayPatch(): """ - VPNGatewayCollection. + VPNGatewayPatch. - :attr VPNGatewayCollectionFirst first: A link to the first page of resources. - :attr int limit: The maximum number of resources that can be returned by the - request. - :attr VPNGatewayCollectionNext next: (optional) A link to the next page of - resources. This property is present for all pages - except the last page. - :attr int total_count: The total number of resources across all pages. - :attr List[VPNGateway] vpn_gateways: Collection of VPN gateways. + :attr str name: (optional) The user-defined name for this VPN gateway. """ def __init__(self, - first: 'VPNGatewayCollectionFirst', - limit: int, - total_count: int, - vpn_gateways: List['VPNGateway'], *, - next: 'VPNGatewayCollectionNext' = None) -> None: + name: str = None) -> None: """ - Initialize a VPNGatewayCollection object. + Initialize a VPNGatewayPatch object. - :param VPNGatewayCollectionFirst first: A link to the first page of - resources. - :param int limit: The maximum number of resources that can be returned by - the request. - :param int total_count: The total number of resources across all pages. - :param List[VPNGateway] vpn_gateways: Collection of VPN gateways. - :param VPNGatewayCollectionNext next: (optional) A link to the next page of - resources. This property is present for all pages - except the last page. + :param str name: (optional) The user-defined name for this VPN gateway. """ - self.first = first - self.limit = limit - self.next = next - self.total_count = total_count - self.vpn_gateways = vpn_gateways + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'VPNGatewayCollection': - """Initialize a VPNGatewayCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPNGatewayPatch': + """Initialize a VPNGatewayPatch object from a json dictionary.""" args = {} - if 'first' in _dict: - args['first'] = VPNGatewayCollectionFirst.from_dict(_dict.get('first')) - else: - raise ValueError('Required property \'first\' not present in VPNGatewayCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') - else: - raise ValueError('Required property \'limit\' not present in VPNGatewayCollection JSON') - if 'next' in _dict: - args['next'] = VPNGatewayCollectionNext.from_dict(_dict.get('next')) - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') - else: - raise ValueError('Required property \'total_count\' not present in VPNGatewayCollection JSON') - if 'vpn_gateways' in _dict: - args['vpn_gateways'] = _dict.get('vpn_gateways') - else: - raise ValueError('Required property \'vpn_gateways\' not present in VPNGatewayCollection JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a VPNGatewayCollection object from a json dictionary.""" + """Initialize a VPNGatewayPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count - if hasattr(self, 'vpn_gateways') and self.vpn_gateways is not None: - vpn_gateways_list = [] - for x in self.vpn_gateways: - if isinstance(x, dict): - vpn_gateways_list.append(x) - else: - vpn_gateways_list.append(x.to_dict()) - _dict['vpn_gateways'] = vpn_gateways_list + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -54496,55 +58784,86 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this VPNGatewayCollection object.""" + """Return a `str` version of this VPNGatewayPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'VPNGatewayCollection') -> bool: + def __eq__(self, other: 'VPNGatewayPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'VPNGatewayCollection') -> bool: + def __ne__(self, other: 'VPNGatewayPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class VPNGatewayCollectionFirst(): +class VPNGatewayPrototype(): """ - A link to the first page of resources. + VPNGatewayPrototype. - :attr str href: The URL for a page of resources. + :attr str name: (optional) The user-defined name for this VPN gateway. + :attr ResourceGroupIdentity resource_group: (optional) The resource group to + use. If unspecified, the account's [default resource + group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + :attr SubnetIdentity subnet: Identifies a subnet by a unique property. """ def __init__(self, - href: str) -> None: + subnet: 'SubnetIdentity', + *, + name: str = None, + resource_group: 'ResourceGroupIdentity' = None) -> None: """ - Initialize a VPNGatewayCollectionFirst object. + Initialize a VPNGatewayPrototype object. - :param str href: The URL for a page of resources. + :param SubnetIdentity subnet: Identifies a subnet by a unique property. + :param str name: (optional) The user-defined name for this VPN gateway. + :param ResourceGroupIdentity resource_group: (optional) The resource group + to use. If unspecified, the account's [default resource + group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is + used. """ - self.href = href + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['VPNGatewayPrototypeVPNGatewayRouteModePrototype', 'VPNGatewayPrototypeVPNGatewayPolicyModePrototype'])) + raise Exception(msg) + +class VPNGatewayReferenceDeleted(): + """ + If present, this property indicates the referenced resource has been deleted and + provides some supplementary information. + + :attr str more_info: Link to documentation about deleted resources. + """ + + def __init__(self, + more_info: str) -> None: + """ + Initialize a VPNGatewayReferenceDeleted object. + + :param str more_info: Link to documentation about deleted resources. + """ + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'VPNGatewayCollectionFirst': - """Initialize a VPNGatewayCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPNGatewayReferenceDeleted': + """Initialize a VPNGatewayReferenceDeleted object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') + if 'more_info' in _dict: + args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'href\' not present in VPNGatewayCollectionFirst JSON') + raise ValueError('Required property \'more_info\' not present in VPNGatewayReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a VPNGatewayCollectionFirst object from a json dictionary.""" + """Initialize a VPNGatewayReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -54552,56 +58871,346 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this VPNGatewayCollectionFirst object.""" + """Return a `str` version of this VPNGatewayReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'VPNGatewayCollectionFirst') -> bool: + def __eq__(self, other: 'VPNGatewayReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'VPNGatewayCollectionFirst') -> bool: + def __ne__(self, other: 'VPNGatewayReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class VPNGatewayCollectionNext(): +class VPNServer(): """ - A link to the next page of resources. This property is present for all pages except - the last page. + VPNServer. - :attr str href: The URL for a page of resources. + :attr CertificateInstanceReference certificate: The certificate instance for + this VPN server. + :attr List[VPNServerAuthentication] client_authentication: The methods used to + authenticate VPN clients to this VPN server. VPN clients must authenticate + against all specified methods. + :attr bool client_auto_delete: Indicates whether disconnected VPN clients will + be automatically deleted after + `client_auto_delete_timeout` hours have passed. At present, this is always + `true`, but may be modifiable in the future. + :attr int client_auto_delete_timeout: If `client_auto_delete` is `true`, the + hours after which disconnected VPN clients will be automatically deleted. If the + value is `0`, disconnected VPN clients will be deleted immediately. This value + may be modifiable in the future. + :attr List[IP] client_dns_server_ips: The DNS server addresses that will be + provided to VPN clients that are connected to this VPN server. + :attr int client_idle_timeout: The seconds a VPN client can be idle before this + VPN server will disconnect it. If `0`, the server will not disconnect idle + clients. + :attr str client_ip_pool: The VPN client IPv4 address pool, expressed in CIDR + format. + :attr datetime created_at: The date and time that the VPN server was created. + :attr str crn: The CRN for this VPN server. + :attr bool enable_split_tunneling: Indicates whether the split tunneling is + enabled on this VPN server. + :attr str health_state: The health of this resource. + - `ok`: No abnormal behavior detected + - `degraded`: Experiencing compromised performance, capacity, or connectivity + - `faulted`: Completely unreachable, inoperative, or otherwise entirely + incapacitated + - `inapplicable`: The health state does not apply because of the current + lifecycle state. A resource with a lifecycle state of `failed` or `deleting` + will have a health state of `inapplicable`. A `pending` resource may also have + this state. + :attr str hostname: Fully qualified domain name assigned to this VPN server. + :attr str href: The URL for this VPN server. + :attr str id: The unique identifier for this VPN server. + :attr str lifecycle_state: The lifecycle state of the VPN server. + :attr str name: The unique user-defined name for this VPN server. + :attr int port: The port number used by this VPN server. + :attr List[ReservedIPReference] private_ips: The reserved IPs bound to this VPN + server. + :attr str protocol: The transport protocol used by this VPN server. + :attr ResourceGroupReference resource_group: The resource group for this VPN + server. + :attr str resource_type: The resource type. + :attr List[SecurityGroupReference] security_groups: The security groups + targeting this VPN server. + :attr List[SubnetReference] subnets: The subnets this VPN server is provisioned + in. + :attr VPCReference vpc: The VPC this VPN server resides in. """ def __init__(self, - href: str) -> None: + certificate: 'CertificateInstanceReference', + client_authentication: List['VPNServerAuthentication'], + client_auto_delete: bool, + client_auto_delete_timeout: int, + client_dns_server_ips: List['IP'], + client_idle_timeout: int, + client_ip_pool: str, + created_at: datetime, + crn: str, + enable_split_tunneling: bool, + health_state: str, + hostname: str, + href: str, + id: str, + lifecycle_state: str, + name: str, + port: int, + private_ips: List['ReservedIPReference'], + protocol: str, + resource_group: 'ResourceGroupReference', + resource_type: str, + security_groups: List['SecurityGroupReference'], + subnets: List['SubnetReference'], + vpc: 'VPCReference') -> None: """ - Initialize a VPNGatewayCollectionNext object. + Initialize a VPNServer object. - :param str href: The URL for a page of resources. - """ + :param CertificateInstanceReference certificate: The certificate instance + for this VPN server. + :param List[VPNServerAuthentication] client_authentication: The methods + used to authenticate VPN clients to this VPN server. VPN clients must + authenticate against all specified methods. + :param bool client_auto_delete: Indicates whether disconnected VPN clients + will be automatically deleted after + `client_auto_delete_timeout` hours have passed. At present, this is always + `true`, but may be modifiable in the future. + :param int client_auto_delete_timeout: If `client_auto_delete` is `true`, + the hours after which disconnected VPN clients will be automatically + deleted. If the value is `0`, disconnected VPN clients will be deleted + immediately. This value may be modifiable in the future. + :param List[IP] client_dns_server_ips: The DNS server addresses that will + be provided to VPN clients that are connected to this VPN server. + :param int client_idle_timeout: The seconds a VPN client can be idle before + this VPN server will disconnect it. If `0`, the server will not disconnect + idle clients. + :param str client_ip_pool: The VPN client IPv4 address pool, expressed in + CIDR format. + :param datetime created_at: The date and time that the VPN server was + created. + :param str crn: The CRN for this VPN server. + :param bool enable_split_tunneling: Indicates whether the split tunneling + is enabled on this VPN server. + :param str health_state: The health of this resource. + - `ok`: No abnormal behavior detected + - `degraded`: Experiencing compromised performance, capacity, or + connectivity + - `faulted`: Completely unreachable, inoperative, or otherwise entirely + incapacitated + - `inapplicable`: The health state does not apply because of the current + lifecycle state. A resource with a lifecycle state of `failed` or + `deleting` will have a health state of `inapplicable`. A `pending` resource + may also have this state. + :param str hostname: Fully qualified domain name assigned to this VPN + server. + :param str href: The URL for this VPN server. + :param str id: The unique identifier for this VPN server. + :param str lifecycle_state: The lifecycle state of the VPN server. + :param str name: The unique user-defined name for this VPN server. + :param int port: The port number used by this VPN server. + :param List[ReservedIPReference] private_ips: The reserved IPs bound to + this VPN server. + :param str protocol: The transport protocol used by this VPN server. + :param ResourceGroupReference resource_group: The resource group for this + VPN server. + :param str resource_type: The resource type. + :param List[SecurityGroupReference] security_groups: The security groups + targeting this VPN server. + :param List[SubnetReference] subnets: The subnets this VPN server is + provisioned in. + :param VPCReference vpc: The VPC this VPN server resides in. + """ + self.certificate = certificate + self.client_authentication = client_authentication + self.client_auto_delete = client_auto_delete + self.client_auto_delete_timeout = client_auto_delete_timeout + self.client_dns_server_ips = client_dns_server_ips + self.client_idle_timeout = client_idle_timeout + self.client_ip_pool = client_ip_pool + self.created_at = created_at + self.crn = crn + self.enable_split_tunneling = enable_split_tunneling + self.health_state = health_state + self.hostname = hostname self.href = href + self.id = id + self.lifecycle_state = lifecycle_state + self.name = name + self.port = port + self.private_ips = private_ips + self.protocol = protocol + self.resource_group = resource_group + self.resource_type = resource_type + self.security_groups = security_groups + self.subnets = subnets + self.vpc = vpc @classmethod - def from_dict(cls, _dict: Dict) -> 'VPNGatewayCollectionNext': - """Initialize a VPNGatewayCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPNServer': + """Initialize a VPNServer object from a json dictionary.""" args = {} + if 'certificate' in _dict: + args['certificate'] = CertificateInstanceReference.from_dict(_dict.get('certificate')) + else: + raise ValueError('Required property \'certificate\' not present in VPNServer JSON') + if 'client_authentication' in _dict: + args['client_authentication'] = _dict.get('client_authentication') + else: + raise ValueError('Required property \'client_authentication\' not present in VPNServer JSON') + if 'client_auto_delete' in _dict: + args['client_auto_delete'] = _dict.get('client_auto_delete') + else: + raise ValueError('Required property \'client_auto_delete\' not present in VPNServer JSON') + if 'client_auto_delete_timeout' in _dict: + args['client_auto_delete_timeout'] = _dict.get('client_auto_delete_timeout') + else: + raise ValueError('Required property \'client_auto_delete_timeout\' not present in VPNServer JSON') + if 'client_dns_server_ips' in _dict: + args['client_dns_server_ips'] = [IP.from_dict(x) for x in _dict.get('client_dns_server_ips')] + else: + raise ValueError('Required property \'client_dns_server_ips\' not present in VPNServer JSON') + if 'client_idle_timeout' in _dict: + args['client_idle_timeout'] = _dict.get('client_idle_timeout') + else: + raise ValueError('Required property \'client_idle_timeout\' not present in VPNServer JSON') + if 'client_ip_pool' in _dict: + args['client_ip_pool'] = _dict.get('client_ip_pool') + else: + raise ValueError('Required property \'client_ip_pool\' not present in VPNServer JSON') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) + else: + raise ValueError('Required property \'created_at\' not present in VPNServer JSON') + if 'crn' in _dict: + args['crn'] = _dict.get('crn') + else: + raise ValueError('Required property \'crn\' not present in VPNServer JSON') + if 'enable_split_tunneling' in _dict: + args['enable_split_tunneling'] = _dict.get('enable_split_tunneling') + else: + raise ValueError('Required property \'enable_split_tunneling\' not present in VPNServer JSON') + if 'health_state' in _dict: + args['health_state'] = _dict.get('health_state') + else: + raise ValueError('Required property \'health_state\' not present in VPNServer JSON') + if 'hostname' in _dict: + args['hostname'] = _dict.get('hostname') + else: + raise ValueError('Required property \'hostname\' not present in VPNServer JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in VPNGatewayCollectionNext JSON') + raise ValueError('Required property \'href\' not present in VPNServer JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in VPNServer JSON') + if 'lifecycle_state' in _dict: + args['lifecycle_state'] = _dict.get('lifecycle_state') + else: + raise ValueError('Required property \'lifecycle_state\' not present in VPNServer JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in VPNServer JSON') + if 'port' in _dict: + args['port'] = _dict.get('port') + else: + raise ValueError('Required property \'port\' not present in VPNServer JSON') + if 'private_ips' in _dict: + args['private_ips'] = [ReservedIPReference.from_dict(x) for x in _dict.get('private_ips')] + else: + raise ValueError('Required property \'private_ips\' not present in VPNServer JSON') + if 'protocol' in _dict: + args['protocol'] = _dict.get('protocol') + else: + raise ValueError('Required property \'protocol\' not present in VPNServer JSON') + if 'resource_group' in _dict: + args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) + else: + raise ValueError('Required property \'resource_group\' not present in VPNServer JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in VPNServer JSON') + if 'security_groups' in _dict: + args['security_groups'] = [SecurityGroupReference.from_dict(x) for x in _dict.get('security_groups')] + else: + raise ValueError('Required property \'security_groups\' not present in VPNServer JSON') + if 'subnets' in _dict: + args['subnets'] = [SubnetReference.from_dict(x) for x in _dict.get('subnets')] + else: + raise ValueError('Required property \'subnets\' not present in VPNServer JSON') + if 'vpc' in _dict: + args['vpc'] = VPCReference.from_dict(_dict.get('vpc')) + else: + raise ValueError('Required property \'vpc\' not present in VPNServer JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a VPNGatewayCollectionNext object from a json dictionary.""" + """Initialize a VPNServer object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} + if hasattr(self, 'certificate') and self.certificate is not None: + _dict['certificate'] = self.certificate.to_dict() + if hasattr(self, 'client_authentication') and self.client_authentication is not None: + client_authentication_list = [] + for x in self.client_authentication: + if isinstance(x, dict): + client_authentication_list.append(x) + else: + client_authentication_list.append(x.to_dict()) + _dict['client_authentication'] = client_authentication_list + if hasattr(self, 'client_auto_delete') and self.client_auto_delete is not None: + _dict['client_auto_delete'] = self.client_auto_delete + if hasattr(self, 'client_auto_delete_timeout') and self.client_auto_delete_timeout is not None: + _dict['client_auto_delete_timeout'] = self.client_auto_delete_timeout + if hasattr(self, 'client_dns_server_ips') and self.client_dns_server_ips is not None: + _dict['client_dns_server_ips'] = [x.to_dict() for x in self.client_dns_server_ips] + if hasattr(self, 'client_idle_timeout') and self.client_idle_timeout is not None: + _dict['client_idle_timeout'] = self.client_idle_timeout + if hasattr(self, 'client_ip_pool') and self.client_ip_pool is not None: + _dict['client_ip_pool'] = self.client_ip_pool + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'enable_split_tunneling') and self.enable_split_tunneling is not None: + _dict['enable_split_tunneling'] = self.enable_split_tunneling + if hasattr(self, 'health_state') and self.health_state is not None: + _dict['health_state'] = self.health_state + if hasattr(self, 'hostname') and self.hostname is not None: + _dict['hostname'] = self.hostname if hasattr(self, 'href') and self.href is not None: _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'lifecycle_state') and self.lifecycle_state is not None: + _dict['lifecycle_state'] = self.lifecycle_state + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'port') and self.port is not None: + _dict['port'] = self.port + if hasattr(self, 'private_ips') and self.private_ips is not None: + _dict['private_ips'] = [x.to_dict() for x in self.private_ips] + if hasattr(self, 'protocol') and self.protocol is not None: + _dict['protocol'] = self.protocol + if hasattr(self, 'resource_group') and self.resource_group is not None: + _dict['resource_group'] = self.resource_group.to_dict() + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + if hasattr(self, 'security_groups') and self.security_groups is not None: + _dict['security_groups'] = [x.to_dict() for x in self.security_groups] + if hasattr(self, 'subnets') and self.subnets is not None: + _dict['subnets'] = [x.to_dict() for x in self.subnets] + if hasattr(self, 'vpc') and self.vpc is not None: + _dict['vpc'] = self.vpc.to_dict() return _dict def _to_dict(self): @@ -54609,166 +59218,327 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this VPNGatewayCollectionNext object.""" + """Return a `str` version of this VPNServer object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'VPNGatewayCollectionNext') -> bool: + def __eq__(self, other: 'VPNServer') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'VPNGatewayCollectionNext') -> bool: + def __ne__(self, other: 'VPNServer') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class VPNGatewayConnection(): + class HealthStateEnum(str, Enum): + """ + The health of this resource. + - `ok`: No abnormal behavior detected + - `degraded`: Experiencing compromised performance, capacity, or connectivity + - `faulted`: Completely unreachable, inoperative, or otherwise entirely + incapacitated + - `inapplicable`: The health state does not apply because of the current lifecycle + state. A resource with a lifecycle state of `failed` or `deleting` will have a + health state of `inapplicable`. A `pending` resource may also have this state. + """ + DEGRADED = 'degraded' + FAULTED = 'faulted' + INAPPLICABLE = 'inapplicable' + OK = 'ok' + + + class LifecycleStateEnum(str, Enum): + """ + The lifecycle state of the VPN server. + """ + DELETING = 'deleting' + FAILED = 'failed' + PENDING = 'pending' + STABLE = 'stable' + SUSPENDED = 'suspended' + UPDATING = 'updating' + WAITING = 'waiting' + + + class ProtocolEnum(str, Enum): + """ + The transport protocol used by this VPN server. + """ + TCP = 'tcp' + UDP = 'udp' + + + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + VPN_SERVER = 'vpn_server' + + +class VPNServerAuthentication(): """ - VPNGatewayConnection. + An authentication method for this VPN server. - :attr bool admin_state_up: If set to false, the VPN gateway connection is shut - down. - :attr str authentication_mode: The authentication mode. Only `psk` is currently - supported. - :attr datetime created_at: The date and time that this VPN gateway connection - was created. - :attr VPNGatewayConnectionDPD dead_peer_detection: The Dead Peer Detection - settings. - :attr str href: The VPN connection's canonical URL. - :attr str id: The unique identifier for this VPN gateway connection. - :attr IKEPolicyReference ike_policy: (optional) The IKE policy. If absent, - [auto-negotiation is - used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). - :attr IPsecPolicyReference ipsec_policy: (optional) The IPsec policy. If absent, - [auto-negotiation is - used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). - :attr str mode: The mode of the VPN gateway. - :attr str name: The user-defined name for this VPN gateway connection. - :attr str peer_address: The IP address of the peer VPN gateway. - :attr str psk: The preshared key. - :attr str resource_type: The resource type. - :attr str status: The status of a VPN gateway connection. + :attr str method: The type of authentication. """ def __init__(self, - admin_state_up: bool, - authentication_mode: str, - created_at: datetime, - dead_peer_detection: 'VPNGatewayConnectionDPD', - href: str, - id: str, - mode: str, - name: str, - peer_address: str, - psk: str, - resource_type: str, - status: str, - *, - ike_policy: 'IKEPolicyReference' = None, - ipsec_policy: 'IPsecPolicyReference' = None) -> None: + method: str) -> None: """ - Initialize a VPNGatewayConnection object. + Initialize a VPNServerAuthentication object. - :param bool admin_state_up: If set to false, the VPN gateway connection is - shut down. - :param str authentication_mode: The authentication mode. Only `psk` is - currently supported. - :param datetime created_at: The date and time that this VPN gateway - connection was created. - :param VPNGatewayConnectionDPD dead_peer_detection: The Dead Peer Detection - settings. - :param str href: The VPN connection's canonical URL. - :param str id: The unique identifier for this VPN gateway connection. - :param str mode: The mode of the VPN gateway. - :param str name: The user-defined name for this VPN gateway connection. - :param str peer_address: The IP address of the peer VPN gateway. - :param str psk: The preshared key. - :param str resource_type: The resource type. - :param str status: The status of a VPN gateway connection. - :param IKEPolicyReference ike_policy: (optional) The IKE policy. If absent, - [auto-negotiation is - used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). - :param IPsecPolicyReference ipsec_policy: (optional) The IPsec policy. If - absent, [auto-negotiation is - used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + :param str method: The type of authentication. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['VPNGatewayConnectionStaticRouteMode', 'VPNGatewayConnectionPolicyMode'])) + ", ".join(['VPNServerAuthenticationByUsername', 'VPNServerAuthenticationByCertificate'])) raise Exception(msg) - class AuthenticationModeEnum(str, Enum): + class MethodEnum(str, Enum): """ - The authentication mode. Only `psk` is currently supported. + The type of authentication. """ - PSK = 'psk' + CERTIFICATE = 'certificate' + USERNAME = 'username' - class ModeEnum(str, Enum): +class VPNServerAuthenticationByUsernameIdProvider(): + """ + The type of identity provider to be used by VPN client. + + """ + + def __init__(self) -> None: """ - The mode of the VPN gateway. + Initialize a VPNServerAuthenticationByUsernameIdProvider object. + """ - POLICY = 'policy' - ROUTE = 'route' + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['VPNServerAuthenticationByUsernameIdProviderByIAM'])) + raise Exception(msg) +class VPNServerAuthenticationPrototype(): + """ + An authentication method for this VPN server. - class ResourceTypeEnum(str, Enum): + :attr str method: The type of authentication. + """ + + def __init__(self, + method: str) -> None: """ - The resource type. + Initialize a VPNServerAuthenticationPrototype object. + + :param str method: The type of authentication. """ - VPN_GATEWAY_CONNECTION = 'vpn_gateway_connection' + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype', 'VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype'])) + raise Exception(msg) + + @classmethod + def from_dict(cls, _dict: Dict) -> 'VPNServerAuthenticationPrototype': + """Initialize a VPNServerAuthenticationPrototype object from a json dictionary.""" + disc_class = cls._get_class_by_discriminator(_dict) + if disc_class != cls: + return disc_class.from_dict(_dict) + msg = ("Cannot convert dictionary into an instance of base class 'VPNServerAuthenticationPrototype'. " + + "The discriminator value should map to a valid subclass: {1}").format( + ", ".join(['VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype', 'VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype'])) + raise Exception(msg) + @classmethod + def _from_dict(cls, _dict: Dict): + """Initialize a VPNServerAuthenticationPrototype object from a json dictionary.""" + return cls.from_dict(_dict) - class StatusEnum(str, Enum): + @classmethod + def _get_class_by_discriminator(cls, _dict: Dict) -> object: + mapping = {} + mapping['certificate'] = 'VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype' + mapping['username'] = 'VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype' + disc_value = _dict.get('method') + if disc_value is None: + raise ValueError('Discriminator property \'method\' not found in VPNServerAuthenticationPrototype JSON') + class_name = mapping.get(disc_value, disc_value) + try: + disc_class = getattr(sys.modules[__name__], class_name) + except AttributeError: + disc_class = cls + if isinstance(disc_class, object): + return disc_class + raise TypeError('%s is not a discriminator class' % class_name) + + class MethodEnum(str, Enum): """ - The status of a VPN gateway connection. + The type of authentication. """ - DOWN = 'down' - UP = 'up' + CERTIFICATE = 'certificate' + USERNAME = 'username' -class VPNGatewayConnectionCollection(): +class VPNServerClient(): """ - Collection of VPN gateway connections in a VPN gateway. + VPNServerClient. - :attr List[VPNGatewayConnection] connections: Array of VPN gateway connections. + :attr IP client_ip: The IP address assigned to this VPN client from + `client_ip_pool`. + :attr str common_name: (optional) The common name of client certificate that the + VPN client provided when connecting to the server. + This property will be present only when the `certificate` client authentication + method is enabled on the VPN server. + :attr datetime created_at: The date and time that the VPN client was created. + :attr datetime disconnected_at: (optional) The date and time that the VPN client + was disconnected. + This property will be present only when the client `status` is `disconnected`. + :attr str href: The URL for this VPN client. + :attr str id: The unique identifier for this VPN client. + :attr IP remote_ip: The remote IP address of this VPN client. + :attr int remote_port: The remote port of this VPN client. + :attr str resource_type: The resource type. + :attr str status: The status of the VPN client: + - `connected`: the VPN client is `connected` to this VPN server. + - `disconnected`: the VPN client is `disconnected` from this VPN server. + The enumerated values for this property are expected to expand in the future. + When processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the VPN client on which the + unexpected property value was encountered. + :attr str username: (optional) The username that this VPN client provided when + connecting to the VPN server. + This property will be present only when the `username` client authentication + method is enabled on the VPN server. """ def __init__(self, - connections: List['VPNGatewayConnection']) -> None: + client_ip: 'IP', + created_at: datetime, + href: str, + id: str, + remote_ip: 'IP', + remote_port: int, + resource_type: str, + status: str, + *, + common_name: str = None, + disconnected_at: datetime = None, + username: str = None) -> None: """ - Initialize a VPNGatewayConnectionCollection object. + Initialize a VPNServerClient object. - :param List[VPNGatewayConnection] connections: Array of VPN gateway - connections. - """ - self.connections = connections + :param IP client_ip: The IP address assigned to this VPN client from + `client_ip_pool`. + :param datetime created_at: The date and time that the VPN client was + created. + :param str href: The URL for this VPN client. + :param str id: The unique identifier for this VPN client. + :param IP remote_ip: The remote IP address of this VPN client. + :param int remote_port: The remote port of this VPN client. + :param str resource_type: The resource type. + :param str status: The status of the VPN client: + - `connected`: the VPN client is `connected` to this VPN server. + - `disconnected`: the VPN client is `disconnected` from this VPN server. + The enumerated values for this property are expected to expand in the + future. When processing this property, check for and log unknown values. + Optionally halt processing and surface the error, or bypass the VPN client + on which the unexpected property value was encountered. + :param str common_name: (optional) The common name of client certificate + that the VPN client provided when connecting to the server. + This property will be present only when the `certificate` client + authentication method is enabled on the VPN server. + :param datetime disconnected_at: (optional) The date and time that the VPN + client was disconnected. + This property will be present only when the client `status` is + `disconnected`. + :param str username: (optional) The username that this VPN client provided + when connecting to the VPN server. + This property will be present only when the `username` client + authentication method is enabled on the VPN server. + """ + self.client_ip = client_ip + self.common_name = common_name + self.created_at = created_at + self.disconnected_at = disconnected_at + self.href = href + self.id = id + self.remote_ip = remote_ip + self.remote_port = remote_port + self.resource_type = resource_type + self.status = status + self.username = username @classmethod - def from_dict(cls, _dict: Dict) -> 'VPNGatewayConnectionCollection': - """Initialize a VPNGatewayConnectionCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPNServerClient': + """Initialize a VPNServerClient object from a json dictionary.""" args = {} - if 'connections' in _dict: - args['connections'] = _dict.get('connections') + if 'client_ip' in _dict: + args['client_ip'] = IP.from_dict(_dict.get('client_ip')) else: - raise ValueError('Required property \'connections\' not present in VPNGatewayConnectionCollection JSON') + raise ValueError('Required property \'client_ip\' not present in VPNServerClient JSON') + if 'common_name' in _dict: + args['common_name'] = _dict.get('common_name') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) + else: + raise ValueError('Required property \'created_at\' not present in VPNServerClient JSON') + if 'disconnected_at' in _dict: + args['disconnected_at'] = string_to_datetime(_dict.get('disconnected_at')) + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in VPNServerClient JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in VPNServerClient JSON') + if 'remote_ip' in _dict: + args['remote_ip'] = IP.from_dict(_dict.get('remote_ip')) + else: + raise ValueError('Required property \'remote_ip\' not present in VPNServerClient JSON') + if 'remote_port' in _dict: + args['remote_port'] = _dict.get('remote_port') + else: + raise ValueError('Required property \'remote_port\' not present in VPNServerClient JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in VPNServerClient JSON') + if 'status' in _dict: + args['status'] = _dict.get('status') + else: + raise ValueError('Required property \'status\' not present in VPNServerClient JSON') + if 'username' in _dict: + args['username'] = _dict.get('username') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a VPNGatewayConnectionCollection object from a json dictionary.""" + """Initialize a VPNServerClient object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'connections') and self.connections is not None: - connections_list = [] - for x in self.connections: - if isinstance(x, dict): - connections_list.append(x) - else: - connections_list.append(x.to_dict()) - _dict['connections'] = connections_list + if hasattr(self, 'client_ip') and self.client_ip is not None: + _dict['client_ip'] = self.client_ip.to_dict() + if hasattr(self, 'common_name') and self.common_name is not None: + _dict['common_name'] = self.common_name + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'disconnected_at') and self.disconnected_at is not None: + _dict['disconnected_at'] = datetime_to_string(self.disconnected_at) + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'remote_ip') and self.remote_ip is not None: + _dict['remote_ip'] = self.remote_ip.to_dict() + if hasattr(self, 'remote_port') and self.remote_port is not None: + _dict['remote_port'] = self.remote_port + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'username') and self.username is not None: + _dict['username'] = self.username return _dict def _to_dict(self): @@ -54776,77 +59546,123 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this VPNGatewayConnectionCollection object.""" + """Return a `str` version of this VPNServerClient object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'VPNGatewayConnectionCollection') -> bool: + def __eq__(self, other: 'VPNServerClient') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'VPNGatewayConnectionCollection') -> bool: + def __ne__(self, other: 'VPNServerClient') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class VPNGatewayConnectionDPD(): + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + VPN_SERVER_CLIENT = 'vpn_server_client' + + + class StatusEnum(str, Enum): + """ + The status of the VPN client: + - `connected`: the VPN client is `connected` to this VPN server. + - `disconnected`: the VPN client is `disconnected` from this VPN server. + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the VPN client on which the unexpected + property value was encountered. + """ + CONNECTED = 'connected' + DISCONNECTED = 'disconnected' + + +class VPNServerClientCollection(): """ - The Dead Peer Detection settings. + VPNServerClientCollection. - :attr str action: Dead Peer Detection actions. - :attr int interval: Dead Peer Detection interval in seconds. - :attr int timeout: Dead Peer Detection timeout in seconds. Must be at least the - interval. + :attr List[VPNServerClient] clients: Collection of VPN clients. + :attr VPNServerClientCollectionFirst first: A link to the first page of + resources. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr VPNServerClientCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages + except the last page. + :attr int total_count: The total number of resources across all pages. """ def __init__(self, - action: str, - interval: int, - timeout: int) -> None: + clients: List['VPNServerClient'], + first: 'VPNServerClientCollectionFirst', + limit: int, + total_count: int, + *, + next: 'VPNServerClientCollectionNext' = None) -> None: """ - Initialize a VPNGatewayConnectionDPD object. + Initialize a VPNServerClientCollection object. - :param str action: Dead Peer Detection actions. - :param int interval: Dead Peer Detection interval in seconds. - :param int timeout: Dead Peer Detection timeout in seconds. Must be at - least the interval. + :param List[VPNServerClient] clients: Collection of VPN clients. + :param VPNServerClientCollectionFirst first: A link to the first page of + resources. + :param int limit: The maximum number of resources that can be returned by + the request. + :param int total_count: The total number of resources across all pages. + :param VPNServerClientCollectionNext next: (optional) A link to the next + page of resources. This property is present for all pages + except the last page. """ - self.action = action - self.interval = interval - self.timeout = timeout + self.clients = clients + self.first = first + self.limit = limit + self.next = next + self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'VPNGatewayConnectionDPD': - """Initialize a VPNGatewayConnectionDPD object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPNServerClientCollection': + """Initialize a VPNServerClientCollection object from a json dictionary.""" args = {} - if 'action' in _dict: - args['action'] = _dict.get('action') + if 'clients' in _dict: + args['clients'] = [VPNServerClient.from_dict(x) for x in _dict.get('clients')] else: - raise ValueError('Required property \'action\' not present in VPNGatewayConnectionDPD JSON') - if 'interval' in _dict: - args['interval'] = _dict.get('interval') + raise ValueError('Required property \'clients\' not present in VPNServerClientCollection JSON') + if 'first' in _dict: + args['first'] = VPNServerClientCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'interval\' not present in VPNGatewayConnectionDPD JSON') - if 'timeout' in _dict: - args['timeout'] = _dict.get('timeout') + raise ValueError('Required property \'first\' not present in VPNServerClientCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') else: - raise ValueError('Required property \'timeout\' not present in VPNGatewayConnectionDPD JSON') + raise ValueError('Required property \'limit\' not present in VPNServerClientCollection JSON') + if 'next' in _dict: + args['next'] = VPNServerClientCollectionNext.from_dict(_dict.get('next')) + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') + else: + raise ValueError('Required property \'total_count\' not present in VPNServerClientCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a VPNGatewayConnectionDPD object from a json dictionary.""" + """Initialize a VPNServerClientCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'action') and self.action is not None: - _dict['action'] = self.action - if hasattr(self, 'interval') and self.interval is not None: - _dict['interval'] = self.interval - if hasattr(self, 'timeout') and self.timeout is not None: - _dict['timeout'] = self.timeout + if hasattr(self, 'clients') and self.clients is not None: + _dict['clients'] = [x.to_dict() for x in self.clients] + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count return _dict def _to_dict(self): @@ -54854,82 +59670,55 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this VPNGatewayConnectionDPD object.""" + """Return a `str` version of this VPNServerClientCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'VPNGatewayConnectionDPD') -> bool: + def __eq__(self, other: 'VPNServerClientCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'VPNGatewayConnectionDPD') -> bool: + def __ne__(self, other: 'VPNServerClientCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ActionEnum(str, Enum): - """ - Dead Peer Detection actions. - """ - CLEAR = 'clear' - HOLD = 'hold' - NONE = 'none' - RESTART = 'restart' - - -class VPNGatewayConnectionDPDPatch(): +class VPNServerClientCollectionFirst(): """ - The Dead Peer Detection settings. + A link to the first page of resources. - :attr str action: (optional) Dead Peer Detection actions. - :attr int interval: (optional) Dead Peer Detection interval in seconds. - :attr int timeout: (optional) Dead Peer Detection timeout in seconds. Must be at - least the interval. + :attr str href: The URL for a page of resources. """ def __init__(self, - *, - action: str = None, - interval: int = None, - timeout: int = None) -> None: + href: str) -> None: """ - Initialize a VPNGatewayConnectionDPDPatch object. + Initialize a VPNServerClientCollectionFirst object. - :param str action: (optional) Dead Peer Detection actions. - :param int interval: (optional) Dead Peer Detection interval in seconds. - :param int timeout: (optional) Dead Peer Detection timeout in seconds. Must - be at least the interval. + :param str href: The URL for a page of resources. """ - self.action = action - self.interval = interval - self.timeout = timeout + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'VPNGatewayConnectionDPDPatch': - """Initialize a VPNGatewayConnectionDPDPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPNServerClientCollectionFirst': + """Initialize a VPNServerClientCollectionFirst object from a json dictionary.""" args = {} - if 'action' in _dict: - args['action'] = _dict.get('action') - if 'interval' in _dict: - args['interval'] = _dict.get('interval') - if 'timeout' in _dict: - args['timeout'] = _dict.get('timeout') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in VPNServerClientCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a VPNGatewayConnectionDPDPatch object from a json dictionary.""" + """Initialize a VPNServerClientCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'action') and self.action is not None: - _dict['action'] = self.action - if hasattr(self, 'interval') and self.interval is not None: - _dict['interval'] = self.interval - if hasattr(self, 'timeout') and self.timeout is not None: - _dict['timeout'] = self.timeout + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -54937,82 +59726,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this VPNGatewayConnectionDPDPatch object.""" + """Return a `str` version of this VPNServerClientCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'VPNGatewayConnectionDPDPatch') -> bool: + def __eq__(self, other: 'VPNServerClientCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'VPNGatewayConnectionDPDPatch') -> bool: + def __ne__(self, other: 'VPNServerClientCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ActionEnum(str, Enum): - """ - Dead Peer Detection actions. - """ - CLEAR = 'clear' - HOLD = 'hold' - NONE = 'none' - RESTART = 'restart' - - -class VPNGatewayConnectionDPDPrototype(): +class VPNServerClientCollectionNext(): """ - The Dead Peer Detection settings. + A link to the next page of resources. This property is present for all pages except + the last page. - :attr str action: (optional) Dead Peer Detection actions. - :attr int interval: (optional) Dead Peer Detection interval in seconds. - :attr int timeout: (optional) Dead Peer Detection timeout in seconds. Must be at - least the interval. + :attr str href: The URL for a page of resources. """ def __init__(self, - *, - action: str = None, - interval: int = None, - timeout: int = None) -> None: + href: str) -> None: """ - Initialize a VPNGatewayConnectionDPDPrototype object. + Initialize a VPNServerClientCollectionNext object. - :param str action: (optional) Dead Peer Detection actions. - :param int interval: (optional) Dead Peer Detection interval in seconds. - :param int timeout: (optional) Dead Peer Detection timeout in seconds. Must - be at least the interval. + :param str href: The URL for a page of resources. """ - self.action = action - self.interval = interval - self.timeout = timeout + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'VPNGatewayConnectionDPDPrototype': - """Initialize a VPNGatewayConnectionDPDPrototype object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPNServerClientCollectionNext': + """Initialize a VPNServerClientCollectionNext object from a json dictionary.""" args = {} - if 'action' in _dict: - args['action'] = _dict.get('action') - if 'interval' in _dict: - args['interval'] = _dict.get('interval') - if 'timeout' in _dict: - args['timeout'] = _dict.get('timeout') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in VPNServerClientCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a VPNGatewayConnectionDPDPrototype object from a json dictionary.""" + """Initialize a VPNServerClientCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'action') and self.action is not None: - _dict['action'] = self.action - if hasattr(self, 'interval') and self.interval is not None: - _dict['interval'] = self.interval - if hasattr(self, 'timeout') and self.timeout is not None: - _dict['timeout'] = self.timeout + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -55020,128 +59783,157 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this VPNGatewayConnectionDPDPrototype object.""" + """Return a `str` version of this VPNServerClientCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'VPNGatewayConnectionDPDPrototype') -> bool: + def __eq__(self, other: 'VPNServerClientCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'VPNGatewayConnectionDPDPrototype') -> bool: + def __ne__(self, other: 'VPNServerClientCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ActionEnum(str, Enum): - """ - Dead Peer Detection actions. - """ - CLEAR = 'clear' - HOLD = 'hold' - NONE = 'none' - RESTART = 'restart' - - -class VPNGatewayConnectionIKEPolicyPatch(): - """ - The IKE policy to use. Specify `null` to remove any existing policy, [resulting in - auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). - - """ - - def __init__(self) -> None: - """ - Initialize a VPNGatewayConnectionIKEPolicyPatch object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['VPNGatewayConnectionIKEPolicyPatchIKEPolicyIdentityById', 'VPNGatewayConnectionIKEPolicyPatchIKEPolicyIdentityByHref'])) - raise Exception(msg) - -class VPNGatewayConnectionIKEPolicyPrototype(): +class VPNServerCollection(): """ - The IKE policy to use. If unspecified, [auto-negotiation will be - used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + VPNServerCollection. + :attr VPNServerCollectionFirst first: A link to the first page of resources. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr VPNServerCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages + except the last page. + :attr int total_count: The total number of resources across all pages. + :attr List[VPNServer] vpn_servers: Collection of VPN servers. """ - def __init__(self) -> None: + def __init__(self, + first: 'VPNServerCollectionFirst', + limit: int, + total_count: int, + vpn_servers: List['VPNServer'], + *, + next: 'VPNServerCollectionNext' = None) -> None: """ - Initialize a VPNGatewayConnectionIKEPolicyPrototype object. + Initialize a VPNServerCollection object. + :param VPNServerCollectionFirst first: A link to the first page of + resources. + :param int limit: The maximum number of resources that can be returned by + the request. + :param int total_count: The total number of resources across all pages. + :param List[VPNServer] vpn_servers: Collection of VPN servers. + :param VPNServerCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages + except the last page. """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['VPNGatewayConnectionIKEPolicyPrototypeIKEPolicyIdentityById', 'VPNGatewayConnectionIKEPolicyPrototypeIKEPolicyIdentityByHref'])) - raise Exception(msg) - -class VPNGatewayConnectionIPsecPolicyPatch(): - """ - The IPsec policy to use. Specify `null` to remove any existing policy, [resulting in - auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + self.first = first + self.limit = limit + self.next = next + self.total_count = total_count + self.vpn_servers = vpn_servers - """ + @classmethod + def from_dict(cls, _dict: Dict) -> 'VPNServerCollection': + """Initialize a VPNServerCollection object from a json dictionary.""" + args = {} + if 'first' in _dict: + args['first'] = VPNServerCollectionFirst.from_dict(_dict.get('first')) + else: + raise ValueError('Required property \'first\' not present in VPNServerCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') + else: + raise ValueError('Required property \'limit\' not present in VPNServerCollection JSON') + if 'next' in _dict: + args['next'] = VPNServerCollectionNext.from_dict(_dict.get('next')) + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') + else: + raise ValueError('Required property \'total_count\' not present in VPNServerCollection JSON') + if 'vpn_servers' in _dict: + args['vpn_servers'] = [VPNServer.from_dict(x) for x in _dict.get('vpn_servers')] + else: + raise ValueError('Required property \'vpn_servers\' not present in VPNServerCollection JSON') + return cls(**args) - def __init__(self) -> None: - """ - Initialize a VPNGatewayConnectionIPsecPolicyPatch object. + @classmethod + def _from_dict(cls, _dict): + """Initialize a VPNServerCollection object from a json dictionary.""" + return cls.from_dict(_dict) - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityById', 'VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref'])) - raise Exception(msg) + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + if hasattr(self, 'vpn_servers') and self.vpn_servers is not None: + _dict['vpn_servers'] = [x.to_dict() for x in self.vpn_servers] + return _dict -class VPNGatewayConnectionIPsecPolicyPrototype(): - """ - The IPsec policy to use. If unspecified, [auto-negotiation will be - used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() - """ + def __str__(self) -> str: + """Return a `str` version of this VPNServerCollection object.""" + return json.dumps(self.to_dict(), indent=2) - def __init__(self) -> None: - """ - Initialize a VPNGatewayConnectionIPsecPolicyPrototype object. + def __eq__(self, other: 'VPNServerCollection') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityById', 'VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref'])) - raise Exception(msg) + def __ne__(self, other: 'VPNServerCollection') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other -class VPNGatewayConnectionLocalCIDRs(): +class VPNServerCollectionFirst(): """ - VPNGatewayConnectionLocalCIDRs. + A link to the first page of resources. - :attr List[str] local_cidrs: (optional) The local CIDRs for this resource. + :attr str href: The URL for a page of resources. """ def __init__(self, - *, - local_cidrs: List[str] = None) -> None: + href: str) -> None: """ - Initialize a VPNGatewayConnectionLocalCIDRs object. + Initialize a VPNServerCollectionFirst object. - :param List[str] local_cidrs: (optional) The local CIDRs for this resource. + :param str href: The URL for a page of resources. """ - self.local_cidrs = local_cidrs + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'VPNGatewayConnectionLocalCIDRs': - """Initialize a VPNGatewayConnectionLocalCIDRs object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPNServerCollectionFirst': + """Initialize a VPNServerCollectionFirst object from a json dictionary.""" args = {} - if 'local_cidrs' in _dict: - args['local_cidrs'] = _dict.get('local_cidrs') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in VPNServerCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a VPNGatewayConnectionLocalCIDRs object from a json dictionary.""" + """Initialize a VPNServerCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'local_cidrs') and self.local_cidrs is not None: - _dict['local_cidrs'] = self.local_cidrs + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -55149,106 +59941,56 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this VPNGatewayConnectionLocalCIDRs object.""" + """Return a `str` version of this VPNServerCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'VPNGatewayConnectionLocalCIDRs') -> bool: + def __eq__(self, other: 'VPNServerCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'VPNGatewayConnectionLocalCIDRs') -> bool: + def __ne__(self, other: 'VPNServerCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class VPNGatewayConnectionPatch(): - """ - VPNGatewayConnectionPatch. - - :attr bool admin_state_up: (optional) If set to false, the VPN gateway - connection is shut down. - :attr VPNGatewayConnectionDPDPatch dead_peer_detection: (optional) The Dead Peer - Detection settings. - :attr VPNGatewayConnectionIKEPolicyPatch ike_policy: (optional) The IKE policy - to use. Specify `null` to remove any existing policy, [resulting in - auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). - :attr VPNGatewayConnectionIPsecPolicyPatch ipsec_policy: (optional) The IPsec - policy to use. Specify `null` to remove any existing policy, [resulting in - auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). - :attr str name: (optional) The user-defined name for this VPN gateway - connection. - :attr str peer_address: (optional) The IP address of the peer VPN gateway. - :attr str psk: (optional) The preshared key. - """ - - def __init__(self, - *, - admin_state_up: bool = None, - dead_peer_detection: 'VPNGatewayConnectionDPDPatch' = None, - ike_policy: 'VPNGatewayConnectionIKEPolicyPatch' = None, - ipsec_policy: 'VPNGatewayConnectionIPsecPolicyPatch' = None, - name: str = None, - peer_address: str = None, - psk: str = None) -> None: - """ - Initialize a VPNGatewayConnectionPatch object. - - :param bool admin_state_up: (optional) If set to false, the VPN gateway - connection is shut down. - :param VPNGatewayConnectionDPDPatch dead_peer_detection: (optional) The - Dead Peer Detection settings. - :param VPNGatewayConnectionIKEPolicyPatch ike_policy: (optional) The IKE - policy to use. Specify `null` to remove any existing policy, [resulting in - auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). - :param VPNGatewayConnectionIPsecPolicyPatch ipsec_policy: (optional) The - IPsec policy to use. Specify `null` to remove any existing policy, - [resulting in - auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). - :param str name: (optional) The user-defined name for this VPN gateway - connection. - :param str peer_address: (optional) The IP address of the peer VPN gateway. - :param str psk: (optional) The preshared key. - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch'])) - raise Exception(msg) - -class VPNGatewayConnectionPeerCIDRs(): +class VPNServerCollectionNext(): """ - VPNGatewayConnectionPeerCIDRs. + A link to the next page of resources. This property is present for all pages except + the last page. - :attr List[str] peer_cidrs: (optional) The peer CIDRs for this resource. + :attr str href: The URL for a page of resources. """ def __init__(self, - *, - peer_cidrs: List[str] = None) -> None: + href: str) -> None: """ - Initialize a VPNGatewayConnectionPeerCIDRs object. + Initialize a VPNServerCollectionNext object. - :param List[str] peer_cidrs: (optional) The peer CIDRs for this resource. + :param str href: The URL for a page of resources. """ - self.peer_cidrs = peer_cidrs + self.href = href - @classmethod - def from_dict(cls, _dict: Dict) -> 'VPNGatewayConnectionPeerCIDRs': - """Initialize a VPNGatewayConnectionPeerCIDRs object from a json dictionary.""" + @classmethod + def from_dict(cls, _dict: Dict) -> 'VPNServerCollectionNext': + """Initialize a VPNServerCollectionNext object from a json dictionary.""" args = {} - if 'peer_cidrs' in _dict: - args['peer_cidrs'] = _dict.get('peer_cidrs') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in VPNServerCollectionNext JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a VPNGatewayConnectionPeerCIDRs object from a json dictionary.""" + """Initialize a VPNServerCollectionNext object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'peer_cidrs') and self.peer_cidrs is not None: - _dict['peer_cidrs'] = self.peer_cidrs + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -55256,150 +59998,180 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this VPNGatewayConnectionPeerCIDRs object.""" + """Return a `str` version of this VPNServerCollectionNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'VPNGatewayConnectionPeerCIDRs') -> bool: + def __eq__(self, other: 'VPNServerCollectionNext') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'VPNGatewayConnectionPeerCIDRs') -> bool: + def __ne__(self, other: 'VPNServerCollectionNext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class VPNGatewayConnectionPrototype(): - """ - VPNGatewayConnectionPrototype. - - :attr bool admin_state_up: (optional) If set to false, the VPN gateway - connection is shut down. - :attr VPNGatewayConnectionDPDPrototype dead_peer_detection: (optional) The Dead - Peer Detection settings. - :attr VPNGatewayConnectionIKEPolicyPrototype ike_policy: (optional) The IKE - policy to use. If unspecified, [auto-negotiation will be - used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). - :attr VPNGatewayConnectionIPsecPolicyPrototype ipsec_policy: (optional) The - IPsec policy to use. If unspecified, [auto-negotiation will be - used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). - :attr str name: (optional) The user-defined name for this VPN gateway - connection. - :attr str peer_address: The IP address of the peer VPN gateway. - :attr str psk: The preshared key. - """ - - def __init__(self, - peer_address: str, - psk: str, - *, - admin_state_up: bool = None, - dead_peer_detection: 'VPNGatewayConnectionDPDPrototype' = None, - ike_policy: 'VPNGatewayConnectionIKEPolicyPrototype' = None, - ipsec_policy: 'VPNGatewayConnectionIPsecPolicyPrototype' = None, - name: str = None) -> None: - """ - Initialize a VPNGatewayConnectionPrototype object. - - :param str peer_address: The IP address of the peer VPN gateway. - :param str psk: The preshared key. - :param bool admin_state_up: (optional) If set to false, the VPN gateway - connection is shut down. - :param VPNGatewayConnectionDPDPrototype dead_peer_detection: (optional) The - Dead Peer Detection settings. - :param VPNGatewayConnectionIKEPolicyPrototype ike_policy: (optional) The - IKE policy to use. If unspecified, [auto-negotiation will be - used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). - :param VPNGatewayConnectionIPsecPolicyPrototype ipsec_policy: (optional) - The IPsec policy to use. If unspecified, [auto-negotiation will be - used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). - :param str name: (optional) The user-defined name for this VPN gateway - connection. - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype', 'VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype'])) - raise Exception(msg) - -class VPNGatewayConnectionReference(): +class VPNServerPatch(): """ - VPNGatewayConnectionReference. + VPNServerPatch. - :attr VPNGatewayConnectionReferenceDeleted deleted: (optional) If present, this - property indicates the referenced resource has been deleted and provides - some supplementary information. - :attr str href: The VPN connection's canonical URL. - :attr str id: The unique identifier for this VPN gateway connection. - :attr str name: The user-defined name for this VPN connection. - :attr str resource_type: The resource type. + :attr CertificateInstanceIdentity certificate: (optional) The certificate + instance for this VPN server. + :attr List[VPNServerAuthenticationPrototype] client_authentication: (optional) + The authentication methods to use to authenticate VPN client on this VPN server + (replacing any existing methods). + :attr List[IP] client_dns_server_ips: (optional) The DNS server addresses that + will be provided to VPN clients connected to this VPN server (replacing any + existing addresses). + :attr int client_idle_timeout: (optional) The seconds a VPN client can be idle + before this VPN server will disconnect it. If `0`, the server will not + disconnect idle clients. + :attr str client_ip_pool: (optional) The VPN client IPv4 address pool, expressed + in CIDR format. The request must not overlap with any existing address prefixes + in the VPC or any of the following reserved address ranges: + - `127.0.0.0/8` (IPv4 loopback addresses) + - `161.26.0.0/16` (IBM services) + - `166.8.0.0/14` (Cloud Service Endpoints) + - `169.254.0.0/16` (IPv4 link-local addresses) + - `224.0.0.0/4` (IPv4 multicast addresses) + The prefix length of the client IP address pool's CIDR must be between + `/9` (8,388,608 addresses) and `/22` (1024 addresses). A CIDR block that + contains twice the number of IP addresses that are required to enable the + maximum number of concurrent connections is recommended. + :attr bool enable_split_tunneling: (optional) Indicates whether the split + tunneling is enabled on this VPN server. + :attr str name: (optional) The user-defined name for this VPN server. Names must + be unique within the VPC this VPN server is serving. + :attr int port: (optional) The port number used by this VPN server. + :attr str protocol: (optional) The transport protocol used by this VPN server. + :attr List[SubnetIdentity] subnets: (optional) The subnets to provision this VPN + server in (replacing the existing subnets). """ def __init__(self, - href: str, - id: str, - name: str, - resource_type: str, *, - deleted: 'VPNGatewayConnectionReferenceDeleted' = None) -> None: - """ - Initialize a VPNGatewayConnectionReference object. - - :param str href: The VPN connection's canonical URL. - :param str id: The unique identifier for this VPN gateway connection. - :param str name: The user-defined name for this VPN connection. - :param str resource_type: The resource type. - :param VPNGatewayConnectionReferenceDeleted deleted: (optional) If present, - this property indicates the referenced resource has been deleted and - provides - some supplementary information. + certificate: 'CertificateInstanceIdentity' = None, + client_authentication: List['VPNServerAuthenticationPrototype'] = None, + client_dns_server_ips: List['IP'] = None, + client_idle_timeout: int = None, + client_ip_pool: str = None, + enable_split_tunneling: bool = None, + name: str = None, + port: int = None, + protocol: str = None, + subnets: List['SubnetIdentity'] = None) -> None: """ - self.deleted = deleted - self.href = href - self.id = id + Initialize a VPNServerPatch object. + + :param CertificateInstanceIdentity certificate: (optional) The certificate + instance for this VPN server. + :param List[VPNServerAuthenticationPrototype] client_authentication: + (optional) The authentication methods to use to authenticate VPN client on + this VPN server + (replacing any existing methods). + :param List[IP] client_dns_server_ips: (optional) The DNS server addresses + that will be provided to VPN clients connected to this VPN server + (replacing any existing addresses). + :param int client_idle_timeout: (optional) The seconds a VPN client can be + idle before this VPN server will disconnect it. If `0`, the server will + not disconnect idle clients. + :param str client_ip_pool: (optional) The VPN client IPv4 address pool, + expressed in CIDR format. The request must not overlap with any existing + address prefixes in the VPC or any of the following reserved address + ranges: + - `127.0.0.0/8` (IPv4 loopback addresses) + - `161.26.0.0/16` (IBM services) + - `166.8.0.0/14` (Cloud Service Endpoints) + - `169.254.0.0/16` (IPv4 link-local addresses) + - `224.0.0.0/4` (IPv4 multicast addresses) + The prefix length of the client IP address pool's CIDR must be between + `/9` (8,388,608 addresses) and `/22` (1024 addresses). A CIDR block that + contains twice the number of IP addresses that are required to enable the + maximum number of concurrent connections is recommended. + :param bool enable_split_tunneling: (optional) Indicates whether the split + tunneling is enabled on this VPN server. + :param str name: (optional) The user-defined name for this VPN server. + Names must be unique within the VPC this VPN server is serving. + :param int port: (optional) The port number used by this VPN server. + :param str protocol: (optional) The transport protocol used by this VPN + server. + :param List[SubnetIdentity] subnets: (optional) The subnets to provision + this VPN server in (replacing the existing subnets). + """ + self.certificate = certificate + self.client_authentication = client_authentication + self.client_dns_server_ips = client_dns_server_ips + self.client_idle_timeout = client_idle_timeout + self.client_ip_pool = client_ip_pool + self.enable_split_tunneling = enable_split_tunneling self.name = name - self.resource_type = resource_type + self.port = port + self.protocol = protocol + self.subnets = subnets @classmethod - def from_dict(cls, _dict: Dict) -> 'VPNGatewayConnectionReference': - """Initialize a VPNGatewayConnectionReference object from a json dictionary.""" - args = {} - if 'deleted' in _dict: - args['deleted'] = VPNGatewayConnectionReferenceDeleted.from_dict(_dict.get('deleted')) - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in VPNGatewayConnectionReference JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in VPNGatewayConnectionReference JSON') + def from_dict(cls, _dict: Dict) -> 'VPNServerPatch': + """Initialize a VPNServerPatch object from a json dictionary.""" + args = {} + if 'certificate' in _dict: + args['certificate'] = _dict.get('certificate') + if 'client_authentication' in _dict: + args['client_authentication'] = [VPNServerAuthenticationPrototype.from_dict(x) for x in _dict.get('client_authentication')] + if 'client_dns_server_ips' in _dict: + args['client_dns_server_ips'] = [IP.from_dict(x) for x in _dict.get('client_dns_server_ips')] + if 'client_idle_timeout' in _dict: + args['client_idle_timeout'] = _dict.get('client_idle_timeout') + if 'client_ip_pool' in _dict: + args['client_ip_pool'] = _dict.get('client_ip_pool') + if 'enable_split_tunneling' in _dict: + args['enable_split_tunneling'] = _dict.get('enable_split_tunneling') if 'name' in _dict: args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in VPNGatewayConnectionReference JSON') - if 'resource_type' in _dict: - args['resource_type'] = _dict.get('resource_type') - else: - raise ValueError('Required property \'resource_type\' not present in VPNGatewayConnectionReference JSON') + if 'port' in _dict: + args['port'] = _dict.get('port') + if 'protocol' in _dict: + args['protocol'] = _dict.get('protocol') + if 'subnets' in _dict: + args['subnets'] = _dict.get('subnets') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a VPNGatewayConnectionReference object from a json dictionary.""" + """Initialize a VPNServerPatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted.to_dict() - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id + if hasattr(self, 'certificate') and self.certificate is not None: + if isinstance(self.certificate, dict): + _dict['certificate'] = self.certificate + else: + _dict['certificate'] = self.certificate.to_dict() + if hasattr(self, 'client_authentication') and self.client_authentication is not None: + _dict['client_authentication'] = [x.to_dict() for x in self.client_authentication] + if hasattr(self, 'client_dns_server_ips') and self.client_dns_server_ips is not None: + _dict['client_dns_server_ips'] = [x.to_dict() for x in self.client_dns_server_ips] + if hasattr(self, 'client_idle_timeout') and self.client_idle_timeout is not None: + _dict['client_idle_timeout'] = self.client_idle_timeout + if hasattr(self, 'client_ip_pool') and self.client_ip_pool is not None: + _dict['client_ip_pool'] = self.client_ip_pool + if hasattr(self, 'enable_split_tunneling') and self.enable_split_tunneling is not None: + _dict['enable_split_tunneling'] = self.enable_split_tunneling if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'resource_type') and self.resource_type is not None: - _dict['resource_type'] = self.resource_type + if hasattr(self, 'port') and self.port is not None: + _dict['port'] = self.port + if hasattr(self, 'protocol') and self.protocol is not None: + _dict['protocol'] = self.protocol + if hasattr(self, 'subnets') and self.subnets is not None: + subnets_list = [] + for x in self.subnets: + if isinstance(x, dict): + subnets_list.append(x) + else: + subnets_list.append(x.to_dict()) + _dict['subnets'] = subnets_list return _dict def _to_dict(self): @@ -55407,27 +60179,28 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this VPNGatewayConnectionReference object.""" + """Return a `str` version of this VPNServerPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'VPNGatewayConnectionReference') -> bool: + def __eq__(self, other: 'VPNServerPatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'VPNGatewayConnectionReference') -> bool: + def __ne__(self, other: 'VPNServerPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ResourceTypeEnum(str, Enum): + class ProtocolEnum(str, Enum): """ - The resource type. + The transport protocol used by this VPN server. """ - VPN_GATEWAY_CONNECTION = 'vpn_gateway_connection' + TCP = 'tcp' + UDP = 'udp' -class VPNGatewayConnectionReferenceDeleted(): +class VPNServerReferenceDeleted(): """ If present, this property indicates the referenced resource has been deleted and provides some supplementary information. @@ -55438,25 +60211,25 @@ class VPNGatewayConnectionReferenceDeleted(): def __init__(self, more_info: str) -> None: """ - Initialize a VPNGatewayConnectionReferenceDeleted object. + Initialize a VPNServerReferenceDeleted object. :param str more_info: Link to documentation about deleted resources. """ self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'VPNGatewayConnectionReferenceDeleted': - """Initialize a VPNGatewayConnectionReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPNServerReferenceDeleted': + """Initialize a VPNServerReferenceDeleted object from a json dictionary.""" args = {} if 'more_info' in _dict: args['more_info'] = _dict.get('more_info') else: - raise ValueError('Required property \'more_info\' not present in VPNGatewayConnectionReferenceDeleted JSON') + raise ValueError('Required property \'more_info\' not present in VPNServerReferenceDeleted JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a VPNGatewayConnectionReferenceDeleted object from a json dictionary.""" + """Initialize a VPNServerReferenceDeleted object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -55471,67 +60244,146 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this VPNGatewayConnectionReferenceDeleted object.""" + """Return a `str` version of this VPNServerReferenceDeleted object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'VPNGatewayConnectionReferenceDeleted') -> bool: + def __eq__(self, other: 'VPNServerReferenceDeleted') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'VPNGatewayConnectionReferenceDeleted') -> bool: + def __ne__(self, other: 'VPNServerReferenceDeleted') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class VPNGatewayConnectionStaticRouteModeTunnel(): +class VPNServerRoute(): """ - VPNGatewayConnectionStaticRouteModeTunnel. + VPNServerRoute. - :attr IP public_ip: The IP address of the VPN gateway member in which the tunnel - resides. - :attr str status: The status of the VPN Tunnel. + :attr str action: The action to perform with a packet matching the VPN route: + - `translate`: translate the source IP address to one of the private IP + addresses of the VPN server. + - `deliver`: deliver the packet into the VPC. + - `drop`: drop the packet + The enumerated values for this property are expected to expand in the future. + When processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the VPN route on which the + unexpected property value was encountered. + :attr datetime created_at: The date and time that the VPN route was created. + :attr str destination: The destination for this VPN route in the VPN server. If + an incoming packet does not match any destination, it will be dropped. + :attr str href: The URL for this VPN route. + :attr str id: The unique identifier for this VPN route. + :attr str lifecycle_state: The lifecycle state of the VPN route. + :attr str name: The user-defined name for this VPN route. + :attr str resource_type: The resource type. """ def __init__(self, - public_ip: 'IP', - status: str) -> None: + action: str, + created_at: datetime, + destination: str, + href: str, + id: str, + lifecycle_state: str, + name: str, + resource_type: str) -> None: """ - Initialize a VPNGatewayConnectionStaticRouteModeTunnel object. + Initialize a VPNServerRoute object. - :param IP public_ip: The IP address of the VPN gateway member in which the - tunnel resides. - :param str status: The status of the VPN Tunnel. + :param str action: The action to perform with a packet matching the VPN + route: + - `translate`: translate the source IP address to one of the private IP + addresses of the VPN server. + - `deliver`: deliver the packet into the VPC. + - `drop`: drop the packet + The enumerated values for this property are expected to expand in the + future. When processing this property, check for and log unknown values. + Optionally halt processing and surface the error, or bypass the VPN route + on which the unexpected property value was encountered. + :param datetime created_at: The date and time that the VPN route was + created. + :param str destination: The destination for this VPN route in the VPN + server. If an incoming packet does not match any destination, it will be + dropped. + :param str href: The URL for this VPN route. + :param str id: The unique identifier for this VPN route. + :param str lifecycle_state: The lifecycle state of the VPN route. + :param str name: The user-defined name for this VPN route. + :param str resource_type: The resource type. """ - self.public_ip = public_ip - self.status = status + self.action = action + self.created_at = created_at + self.destination = destination + self.href = href + self.id = id + self.lifecycle_state = lifecycle_state + self.name = name + self.resource_type = resource_type @classmethod - def from_dict(cls, _dict: Dict) -> 'VPNGatewayConnectionStaticRouteModeTunnel': - """Initialize a VPNGatewayConnectionStaticRouteModeTunnel object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPNServerRoute': + """Initialize a VPNServerRoute object from a json dictionary.""" args = {} - if 'public_ip' in _dict: - args['public_ip'] = IP.from_dict(_dict.get('public_ip')) + if 'action' in _dict: + args['action'] = _dict.get('action') else: - raise ValueError('Required property \'public_ip\' not present in VPNGatewayConnectionStaticRouteModeTunnel JSON') - if 'status' in _dict: - args['status'] = _dict.get('status') + raise ValueError('Required property \'action\' not present in VPNServerRoute JSON') + if 'created_at' in _dict: + args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError('Required property \'status\' not present in VPNGatewayConnectionStaticRouteModeTunnel JSON') + raise ValueError('Required property \'created_at\' not present in VPNServerRoute JSON') + if 'destination' in _dict: + args['destination'] = _dict.get('destination') + else: + raise ValueError('Required property \'destination\' not present in VPNServerRoute JSON') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in VPNServerRoute JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in VPNServerRoute JSON') + if 'lifecycle_state' in _dict: + args['lifecycle_state'] = _dict.get('lifecycle_state') + else: + raise ValueError('Required property \'lifecycle_state\' not present in VPNServerRoute JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in VPNServerRoute JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in VPNServerRoute JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a VPNGatewayConnectionStaticRouteModeTunnel object from a json dictionary.""" + """Initialize a VPNServerRoute object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'public_ip') and self.public_ip is not None: - _dict['public_ip'] = self.public_ip.to_dict() - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status + if hasattr(self, 'action') and self.action is not None: + _dict['action'] = self.action + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'destination') and self.destination is not None: + _dict['destination'] = self.destination + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'lifecycle_state') and self.lifecycle_state is not None: + _dict['lifecycle_state'] = self.lifecycle_state + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type return _dict def _to_dict(self): @@ -55539,99 +60391,139 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this VPNGatewayConnectionStaticRouteModeTunnel object.""" + """Return a `str` version of this VPNServerRoute object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'VPNGatewayConnectionStaticRouteModeTunnel') -> bool: + def __eq__(self, other: 'VPNServerRoute') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'VPNGatewayConnectionStaticRouteModeTunnel') -> bool: + def __ne__(self, other: 'VPNServerRoute') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class StatusEnum(str, Enum): + class ActionEnum(str, Enum): """ - The status of the VPN Tunnel. + The action to perform with a packet matching the VPN route: + - `translate`: translate the source IP address to one of the private IP addresses + of the VPN server. + - `deliver`: deliver the packet into the VPC. + - `drop`: drop the packet + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the VPN route on which the unexpected + property value was encountered. """ - DOWN = 'down' - UP = 'up' + DELIVER = 'deliver' + DROP = 'drop' + TRANSLATE = 'translate' -class VPNGatewayMember(): + class LifecycleStateEnum(str, Enum): + """ + The lifecycle state of the VPN route. + """ + DELETING = 'deleting' + FAILED = 'failed' + PENDING = 'pending' + STABLE = 'stable' + SUSPENDED = 'suspended' + UPDATING = 'updating' + WAITING = 'waiting' + + + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + VPN_SERVER_ROUTE = 'vpn_server_route' + + +class VPNServerRouteCollection(): """ - VPNGatewayMember. + VPNServerRouteCollection. - :attr IP private_ip: (optional) The private IP address assigned to the VPN - gateway member. - This property will be present only when the VPN gateway status is `available`. - :attr IP public_ip: The public IP address assigned to the VPN gateway member. - :attr str role: The high availability role assigned to the VPN gateway member. - :attr str status: The status of the VPN gateway member. + :attr VPNServerRouteCollectionFirst first: A link to the first page of + resources. + :attr int limit: The maximum number of resources that can be returned by the + request. + :attr VPNServerRouteCollectionNext next: (optional) A link to the next page of + resources. This property is present for all pages + except the last page. + :attr List[VPNServerRoute] routes: Collection of VPN routes. + :attr int total_count: The total number of resources across all pages. """ def __init__(self, - public_ip: 'IP', - role: str, - status: str, + first: 'VPNServerRouteCollectionFirst', + limit: int, + routes: List['VPNServerRoute'], + total_count: int, *, - private_ip: 'IP' = None) -> None: + next: 'VPNServerRouteCollectionNext' = None) -> None: """ - Initialize a VPNGatewayMember object. + Initialize a VPNServerRouteCollection object. - :param IP public_ip: The public IP address assigned to the VPN gateway - member. - :param str role: The high availability role assigned to the VPN gateway - member. - :param str status: The status of the VPN gateway member. - :param IP private_ip: (optional) The private IP address assigned to the VPN - gateway member. - This property will be present only when the VPN gateway status is - `available`. + :param VPNServerRouteCollectionFirst first: A link to the first page of + resources. + :param int limit: The maximum number of resources that can be returned by + the request. + :param List[VPNServerRoute] routes: Collection of VPN routes. + :param int total_count: The total number of resources across all pages. + :param VPNServerRouteCollectionNext next: (optional) A link to the next + page of resources. This property is present for all pages + except the last page. """ - self.private_ip = private_ip - self.public_ip = public_ip - self.role = role - self.status = status + self.first = first + self.limit = limit + self.next = next + self.routes = routes + self.total_count = total_count @classmethod - def from_dict(cls, _dict: Dict) -> 'VPNGatewayMember': - """Initialize a VPNGatewayMember object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPNServerRouteCollection': + """Initialize a VPNServerRouteCollection object from a json dictionary.""" args = {} - if 'private_ip' in _dict: - args['private_ip'] = IP.from_dict(_dict.get('private_ip')) - if 'public_ip' in _dict: - args['public_ip'] = IP.from_dict(_dict.get('public_ip')) + if 'first' in _dict: + args['first'] = VPNServerRouteCollectionFirst.from_dict(_dict.get('first')) else: - raise ValueError('Required property \'public_ip\' not present in VPNGatewayMember JSON') - if 'role' in _dict: - args['role'] = _dict.get('role') + raise ValueError('Required property \'first\' not present in VPNServerRouteCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') else: - raise ValueError('Required property \'role\' not present in VPNGatewayMember JSON') - if 'status' in _dict: - args['status'] = _dict.get('status') + raise ValueError('Required property \'limit\' not present in VPNServerRouteCollection JSON') + if 'next' in _dict: + args['next'] = VPNServerRouteCollectionNext.from_dict(_dict.get('next')) + if 'routes' in _dict: + args['routes'] = [VPNServerRoute.from_dict(x) for x in _dict.get('routes')] else: - raise ValueError('Required property \'status\' not present in VPNGatewayMember JSON') + raise ValueError('Required property \'routes\' not present in VPNServerRouteCollection JSON') + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') + else: + raise ValueError('Required property \'total_count\' not present in VPNServerRouteCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a VPNGatewayMember object from a json dictionary.""" + """Initialize a VPNServerRouteCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'private_ip') and self.private_ip is not None: - _dict['private_ip'] = self.private_ip.to_dict() - if hasattr(self, 'public_ip') and self.public_ip is not None: - _dict['public_ip'] = self.public_ip.to_dict() - if hasattr(self, 'role') and self.role is not None: - _dict['role'] = self.role - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'routes') and self.routes is not None: + _dict['routes'] = [x.to_dict() for x in self.routes] + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count return _dict def _to_dict(self): @@ -55639,72 +60531,55 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this VPNGatewayMember object.""" + """Return a `str` version of this VPNServerRouteCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'VPNGatewayMember') -> bool: + def __eq__(self, other: 'VPNServerRouteCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'VPNGatewayMember') -> bool: + def __ne__(self, other: 'VPNServerRouteCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class RoleEnum(str, Enum): - """ - The high availability role assigned to the VPN gateway member. - """ - ACTIVE = 'active' - STANDBY = 'standby' - - - class StatusEnum(str, Enum): - """ - The status of the VPN gateway member. - """ - AVAILABLE = 'available' - DELETING = 'deleting' - FAILED = 'failed' - PENDING = 'pending' - - -class VPNGatewayPatch(): +class VPNServerRouteCollectionFirst(): """ - VPNGatewayPatch. + A link to the first page of resources. - :attr str name: (optional) The user-defined name for this VPN gateway. + :attr str href: The URL for a page of resources. """ def __init__(self, - *, - name: str = None) -> None: + href: str) -> None: """ - Initialize a VPNGatewayPatch object. + Initialize a VPNServerRouteCollectionFirst object. - :param str name: (optional) The user-defined name for this VPN gateway. + :param str href: The URL for a page of resources. """ - self.name = name + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'VPNGatewayPatch': - """Initialize a VPNGatewayPatch object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPNServerRouteCollectionFirst': + """Initialize a VPNServerRouteCollectionFirst object from a json dictionary.""" args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in VPNServerRouteCollectionFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a VPNGatewayPatch object from a json dictionary.""" + """Initialize a VPNServerRouteCollectionFirst object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -55712,86 +60587,113 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this VPNGatewayPatch object.""" + """Return a `str` version of this VPNServerRouteCollectionFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'VPNGatewayPatch') -> bool: + def __eq__(self, other: 'VPNServerRouteCollectionFirst') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'VPNGatewayPatch') -> bool: + def __ne__(self, other: 'VPNServerRouteCollectionFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class VPNGatewayPrototype(): +class VPNServerRouteCollectionNext(): """ - VPNGatewayPrototype. + A link to the next page of resources. This property is present for all pages except + the last page. - :attr str name: (optional) The user-defined name for this VPN gateway. - :attr ResourceGroupIdentity resource_group: (optional) The resource group to - use. If unspecified, the account's [default resource - group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - :attr SubnetIdentity subnet: Identifies a subnet by a unique property. + :attr str href: The URL for a page of resources. """ def __init__(self, - subnet: 'SubnetIdentity', - *, - name: str = None, - resource_group: 'ResourceGroupIdentity' = None) -> None: + href: str) -> None: """ - Initialize a VPNGatewayPrototype object. + Initialize a VPNServerRouteCollectionNext object. - :param SubnetIdentity subnet: Identifies a subnet by a unique property. - :param str name: (optional) The user-defined name for this VPN gateway. - :param ResourceGroupIdentity resource_group: (optional) The resource group - to use. If unspecified, the account's [default resource - group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is - used. + :param str href: The URL for a page of resources. """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['VPNGatewayPrototypeVPNGatewayRouteModePrototype', 'VPNGatewayPrototypeVPNGatewayPolicyModePrototype'])) - raise Exception(msg) + self.href = href -class VPNGatewayReferenceDeleted(): + @classmethod + def from_dict(cls, _dict: Dict) -> 'VPNServerRouteCollectionNext': + """Initialize a VPNServerRouteCollectionNext object from a json dictionary.""" + args = {} + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in VPNServerRouteCollectionNext JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a VPNServerRouteCollectionNext object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this VPNServerRouteCollectionNext object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'VPNServerRouteCollectionNext') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'VPNServerRouteCollectionNext') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class VPNServerRoutePatch(): """ - If present, this property indicates the referenced resource has been deleted and - provides some supplementary information. + VPNServerRoutePatch. - :attr str more_info: Link to documentation about deleted resources. + :attr str name: (optional) The user-defined name for this VPN route. Names must + be unique within the VPN server the VPN route resides in. """ def __init__(self, - more_info: str) -> None: + *, + name: str = None) -> None: """ - Initialize a VPNGatewayReferenceDeleted object. + Initialize a VPNServerRoutePatch object. - :param str more_info: Link to documentation about deleted resources. + :param str name: (optional) The user-defined name for this VPN route. Names + must be unique within the VPN server the VPN route resides in. """ - self.more_info = more_info + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'VPNGatewayReferenceDeleted': - """Initialize a VPNGatewayReferenceDeleted object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'VPNServerRoutePatch': + """Initialize a VPNServerRoutePatch object from a json dictionary.""" args = {} - if 'more_info' in _dict: - args['more_info'] = _dict.get('more_info') - else: - raise ValueError('Required property \'more_info\' not present in VPNGatewayReferenceDeleted JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a VPNGatewayReferenceDeleted object from a json dictionary.""" + """Initialize a VPNServerRoutePatch object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'more_info') and self.more_info is not None: - _dict['more_info'] = self.more_info + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -55799,16 +60701,16 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this VPNGatewayReferenceDeleted object.""" + """Return a `str` version of this VPNServerRoutePatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'VPNGatewayReferenceDeleted') -> bool: + def __eq__(self, other: 'VPNServerRoutePatch') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'VPNGatewayReferenceDeleted') -> bool: + def __ne__(self, other: 'VPNServerRoutePatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other @@ -57935,7 +62837,7 @@ def __init__(self, this volume. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['VolumePrototypeVolumeByCapacity'])) + ", ".join(['VolumePrototypeVolumeByCapacity', 'VolumePrototypeVolumeBySourceSnapshot'])) raise Exception(msg) class VolumePrototypeInstanceByImageContext(): @@ -63512,7 +68414,7 @@ class EncryptionKeyIdentityByCRN(EncryptionKeyIdentity): :attr str crn: The CRN of the [Key Protect Root Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) - or [Hyper Protect Crypto Service Root + or [Hyper Protect Crypto Services Root Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this resource. """ @@ -63524,7 +68426,7 @@ def __init__(self, :param str crn: The CRN of the [Key Protect Root Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) - or [Hyper Protect Crypto Service Root + or [Hyper Protect Crypto Services Root Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this resource. """ @@ -65221,7 +70123,7 @@ class ImagePrototypeImageByFile(ImagePrototype): Protect](https://cloud.ibm.com/docs/key-protect?topic=key-protect-wrap-keys) or the [Hyper Protect Crypto - Service](https://cloud.ibm.com/docs/services/hs-crypto?topic=hs-crypto-wrap-keys). + Services](https://cloud.ibm.com/docs/services/hs-crypto?topic=hs-crypto-wrap-keys). If unspecified, the imported image is treated as unencrypted. :attr EncryptionKeyIdentity encryption_key: (optional) The root key that was used to wrap the data key (which is ultimately represented as @@ -65265,7 +70167,7 @@ def __init__(self, Protect](https://cloud.ibm.com/docs/key-protect?topic=key-protect-wrap-keys) or the [Hyper Protect Crypto - Service](https://cloud.ibm.com/docs/services/hs-crypto?topic=hs-crypto-wrap-keys). + Services](https://cloud.ibm.com/docs/services/hs-crypto?topic=hs-crypto-wrap-keys). If unspecified, the imported image is treated as unencrypted. :param EncryptionKeyIdentity encryption_key: (optional) The root key that was used to wrap the data key (which is ultimately represented as @@ -70031,10 +74933,12 @@ class InstancePrototypeInstanceByImage(InstancePrototype): megabits per second) allocated exclusively to instance storage volumes. An increase in this value will result in a corresponding decrease to `total_network_bandwidth`. - :attr str user_data: (optional) User data to be made available when setting up - the virtual server instance. + :attr str user_data: (optional) [User + data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when + setting up the virtual server instance. :attr List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: - (optional) The volume attachments for this virtual server instance. + (optional) The additional volume attachments to create for the virtual server + instance. :attr VPCIdentity vpc: (optional) The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the subnets of the instance's network interfaces. @@ -70116,10 +75020,12 @@ def __init__(self, megabits per second) allocated exclusively to instance storage volumes. An increase in this value will result in a corresponding decrease to `total_network_bandwidth`. - :param str user_data: (optional) User data to be made available when - setting up the virtual server instance. + :param str user_data: (optional) [User + data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available + when setting up the virtual server instance. :param List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: - (optional) The volume attachments for this virtual server instance. + (optional) The additional volume attachments to create for the virtual + server instance. :param VPCIdentity vpc: (optional) The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the subnets of the instance's network interfaces. @@ -70321,288 +75227,294 @@ class InstancePrototypeInstanceBySourceSnapshot(InstancePrototype): megabits per second) allocated exclusively to instance storage volumes. An increase in this value will result in a corresponding decrease to `total_network_bandwidth`. - :attr str user_data: (optional) User data to be made available when setting up - the virtual server instance. + :attr str user_data: (optional) [User + data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when + setting up the virtual server instance. + :attr List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: + (optional) The additional volume attachments to create for the virtual server + instance. + :attr VPCIdentity vpc: (optional) The VPC the virtual server instance is to be a + part of. If specified, it must match the VPC referenced by the subnets of the + instance's network interfaces. + :attr VolumeAttachmentPrototypeInstanceBySourceSnapshotContext + boot_volume_attachment: The boot volume attachment for the virtual server + instance. + :attr NetworkInterfacePrototype primary_network_interface: Primary network + interface. + :attr ZoneIdentity zone: The zone this virtual server instance will reside in. + """ + + def __init__(self, + boot_volume_attachment: 'VolumeAttachmentPrototypeInstanceBySourceSnapshotContext', + primary_network_interface: 'NetworkInterfacePrototype', + zone: 'ZoneIdentity', + *, + availability_policy: 'InstanceAvailabilityPrototype' = None, + default_trusted_profile: 'InstanceDefaultTrustedProfilePrototype' = None, + keys: List['KeyIdentity'] = None, + metadata_service: 'InstanceMetadataServicePrototype' = None, + name: str = None, + network_interfaces: List['NetworkInterfacePrototype'] = None, + placement_target: 'InstancePlacementTargetPrototype' = None, + profile: 'InstanceProfileIdentity' = None, + resource_group: 'ResourceGroupIdentity' = None, + total_volume_bandwidth: int = None, + user_data: str = None, + volume_attachments: List['VolumeAttachmentPrototypeInstanceContext'] = None, + vpc: 'VPCIdentity' = None) -> None: + """ + Initialize a InstancePrototypeInstanceBySourceSnapshot object. + + :param VolumeAttachmentPrototypeInstanceBySourceSnapshotContext + boot_volume_attachment: The boot volume attachment for the virtual server + instance. + :param NetworkInterfacePrototype primary_network_interface: Primary network + interface. + :param ZoneIdentity zone: The zone this virtual server instance will reside + in. + :param InstanceAvailabilityPrototype availability_policy: (optional) The + availability policy to use for this virtual server instance. + :param InstanceDefaultTrustedProfilePrototype default_trusted_profile: + (optional) The default trusted profile configuration to use for this + virtual server instance This property's value is used when provisioning + the virtual server instance, but not subsequently managed. Accordingly, it + is reflected as an [instance + initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) + property. + :param List[KeyIdentity] keys: (optional) The public SSH keys for the + administrative user of the virtual server instance. Keys will be made + available to the virtual server instance as cloud-init vendor data. For + cloud-init enabled images, these keys will also be added as SSH authorized + keys for the administrative user. + For Windows images, at least one key must be specified, and one will be + chosen to encrypt [the administrator + password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). + Keys are optional for other images, but if no keys are specified, the + instance will be inaccessible unless the specified image provides another + means of access. + This property's value is used when provisioning the virtual server + instance, but not subsequently managed. Accordingly, it is reflected as an + [instance + initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) + property. + :param InstanceMetadataServicePrototype metadata_service: (optional) + :param str name: (optional) The unique user-defined name for this virtual + server instance (and default system hostname). If unspecified, the name + will be a hyphenated list of randomly-selected words. + :param List[NetworkInterfacePrototype] network_interfaces: (optional) The + additional network interfaces to create for the virtual server instance. + :param InstancePlacementTargetPrototype placement_target: (optional) The + placement restrictions to use for the virtual server instance. + :param InstanceProfileIdentity profile: (optional) The profile to use for + this virtual server instance. If unspecified, `bx2-2x8` will be used, but + this default value is expected to change in the future. + :param ResourceGroupIdentity resource_group: (optional) + :param int total_volume_bandwidth: (optional) The amount of bandwidth (in + megabits per second) allocated exclusively to instance storage volumes. An + increase in this value will result in a corresponding decrease to + `total_network_bandwidth`. + :param str user_data: (optional) [User + data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available + when setting up the virtual server instance. + :param List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: + (optional) The additional volume attachments to create for the virtual + server instance. + :param VPCIdentity vpc: (optional) The VPC the virtual server instance is + to be a part of. If specified, it must match the VPC referenced by the + subnets of the instance's network interfaces. + """ + # pylint: disable=super-init-not-called + self.availability_policy = availability_policy + self.default_trusted_profile = default_trusted_profile + self.keys = keys + self.metadata_service = metadata_service + self.name = name + self.network_interfaces = network_interfaces + self.placement_target = placement_target + self.profile = profile + self.resource_group = resource_group + self.total_volume_bandwidth = total_volume_bandwidth + self.user_data = user_data + self.volume_attachments = volume_attachments + self.vpc = vpc + self.boot_volume_attachment = boot_volume_attachment + self.primary_network_interface = primary_network_interface + self.zone = zone + + @classmethod + def from_dict(cls, _dict: Dict) -> 'InstancePrototypeInstanceBySourceSnapshot': + """Initialize a InstancePrototypeInstanceBySourceSnapshot object from a json dictionary.""" + args = {} + if 'availability_policy' in _dict: + args['availability_policy'] = InstanceAvailabilityPrototype.from_dict(_dict.get('availability_policy')) + if 'default_trusted_profile' in _dict: + args['default_trusted_profile'] = InstanceDefaultTrustedProfilePrototype.from_dict(_dict.get('default_trusted_profile')) + if 'keys' in _dict: + args['keys'] = _dict.get('keys') + if 'metadata_service' in _dict: + args['metadata_service'] = InstanceMetadataServicePrototype.from_dict(_dict.get('metadata_service')) + if 'name' in _dict: + args['name'] = _dict.get('name') + if 'network_interfaces' in _dict: + args['network_interfaces'] = [NetworkInterfacePrototype.from_dict(x) for x in _dict.get('network_interfaces')] + if 'placement_target' in _dict: + args['placement_target'] = _dict.get('placement_target') + if 'profile' in _dict: + args['profile'] = _dict.get('profile') + if 'resource_group' in _dict: + args['resource_group'] = _dict.get('resource_group') + if 'total_volume_bandwidth' in _dict: + args['total_volume_bandwidth'] = _dict.get('total_volume_bandwidth') + if 'user_data' in _dict: + args['user_data'] = _dict.get('user_data') + if 'volume_attachments' in _dict: + args['volume_attachments'] = [VolumeAttachmentPrototypeInstanceContext.from_dict(x) for x in _dict.get('volume_attachments')] + if 'vpc' in _dict: + args['vpc'] = _dict.get('vpc') + if 'boot_volume_attachment' in _dict: + args['boot_volume_attachment'] = VolumeAttachmentPrototypeInstanceBySourceSnapshotContext.from_dict(_dict.get('boot_volume_attachment')) + else: + raise ValueError('Required property \'boot_volume_attachment\' not present in InstancePrototypeInstanceBySourceSnapshot JSON') + if 'primary_network_interface' in _dict: + args['primary_network_interface'] = NetworkInterfacePrototype.from_dict(_dict.get('primary_network_interface')) + else: + raise ValueError('Required property \'primary_network_interface\' not present in InstancePrototypeInstanceBySourceSnapshot JSON') + if 'zone' in _dict: + args['zone'] = _dict.get('zone') + else: + raise ValueError('Required property \'zone\' not present in InstancePrototypeInstanceBySourceSnapshot JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a InstancePrototypeInstanceBySourceSnapshot object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'availability_policy') and self.availability_policy is not None: + _dict['availability_policy'] = self.availability_policy.to_dict() + if hasattr(self, 'default_trusted_profile') and self.default_trusted_profile is not None: + _dict['default_trusted_profile'] = self.default_trusted_profile.to_dict() + if hasattr(self, 'keys') and self.keys is not None: + keys_list = [] + for x in self.keys: + if isinstance(x, dict): + keys_list.append(x) + else: + keys_list.append(x.to_dict()) + _dict['keys'] = keys_list + if hasattr(self, 'metadata_service') and self.metadata_service is not None: + _dict['metadata_service'] = self.metadata_service.to_dict() + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'network_interfaces') and self.network_interfaces is not None: + _dict['network_interfaces'] = [x.to_dict() for x in self.network_interfaces] + if hasattr(self, 'placement_target') and self.placement_target is not None: + if isinstance(self.placement_target, dict): + _dict['placement_target'] = self.placement_target + else: + _dict['placement_target'] = self.placement_target.to_dict() + if hasattr(self, 'profile') and self.profile is not None: + if isinstance(self.profile, dict): + _dict['profile'] = self.profile + else: + _dict['profile'] = self.profile.to_dict() + if hasattr(self, 'resource_group') and self.resource_group is not None: + if isinstance(self.resource_group, dict): + _dict['resource_group'] = self.resource_group + else: + _dict['resource_group'] = self.resource_group.to_dict() + if hasattr(self, 'total_volume_bandwidth') and self.total_volume_bandwidth is not None: + _dict['total_volume_bandwidth'] = self.total_volume_bandwidth + if hasattr(self, 'user_data') and self.user_data is not None: + _dict['user_data'] = self.user_data + if hasattr(self, 'volume_attachments') and self.volume_attachments is not None: + _dict['volume_attachments'] = [x.to_dict() for x in self.volume_attachments] + if hasattr(self, 'vpc') and self.vpc is not None: + if isinstance(self.vpc, dict): + _dict['vpc'] = self.vpc + else: + _dict['vpc'] = self.vpc.to_dict() + if hasattr(self, 'boot_volume_attachment') and self.boot_volume_attachment is not None: + _dict['boot_volume_attachment'] = self.boot_volume_attachment.to_dict() + if hasattr(self, 'primary_network_interface') and self.primary_network_interface is not None: + _dict['primary_network_interface'] = self.primary_network_interface.to_dict() + if hasattr(self, 'zone') and self.zone is not None: + if isinstance(self.zone, dict): + _dict['zone'] = self.zone + else: + _dict['zone'] = self.zone.to_dict() + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this InstancePrototypeInstanceBySourceSnapshot object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'InstancePrototypeInstanceBySourceSnapshot') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'InstancePrototypeInstanceBySourceSnapshot') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class InstancePrototypeInstanceBySourceTemplate(InstancePrototype): + """ + InstancePrototypeInstanceBySourceTemplate. + + :attr InstanceAvailabilityPrototype availability_policy: (optional) The + availability policy to use for this virtual server instance. + :attr InstanceDefaultTrustedProfilePrototype default_trusted_profile: (optional) + The default trusted profile configuration to use for this virtual server + instance This property's value is used when provisioning the virtual server + instance, but not subsequently managed. Accordingly, it is reflected as an + [instance + initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) + property. + :attr List[KeyIdentity] keys: (optional) The public SSH keys for the + administrative user of the virtual server instance. Keys will be made available + to the virtual server instance as cloud-init vendor data. For cloud-init enabled + images, these keys will also be added as SSH authorized keys for the + administrative user. + For Windows images, at least one key must be specified, and one will be chosen + to encrypt [the administrator + password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys + are optional for other images, but if no keys are specified, the instance will + be inaccessible unless the specified image provides another means of access. + This property's value is used when provisioning the virtual server instance, but + not subsequently managed. Accordingly, it is reflected as an [instance + initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) + property. + :attr InstanceMetadataServicePrototype metadata_service: (optional) + :attr str name: (optional) The unique user-defined name for this virtual server + instance (and default system hostname). If unspecified, the name will be a + hyphenated list of randomly-selected words. + :attr List[NetworkInterfacePrototype] network_interfaces: (optional) The + additional network interfaces to create for the virtual server instance. + :attr InstancePlacementTargetPrototype placement_target: (optional) The + placement restrictions to use for the virtual server instance. + :attr InstanceProfileIdentity profile: (optional) The profile to use for this + virtual server instance. If unspecified, `bx2-2x8` will be used, but this + default value is expected to change in the future. + :attr ResourceGroupIdentity resource_group: (optional) + :attr int total_volume_bandwidth: (optional) The amount of bandwidth (in + megabits per second) allocated exclusively to instance storage volumes. An + increase in this value will result in a corresponding decrease to + `total_network_bandwidth`. + :attr str user_data: (optional) [User + data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when + setting up the virtual server instance. :attr List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: - (optional) The volume attachments for this virtual server instance. - :attr VPCIdentity vpc: (optional) The VPC the virtual server instance is to be a - part of. If specified, it must match the VPC referenced by the subnets of the - instance's network interfaces. - :attr VolumeAttachmentPrototypeInstanceBySourceSnapshotContext - boot_volume_attachment: The boot volume attachment for the virtual server + (optional) The additional volume attachments to create for the virtual server instance. - :attr NetworkInterfacePrototype primary_network_interface: Primary network - interface. - :attr ZoneIdentity zone: The zone this virtual server instance will reside in. - """ - - def __init__(self, - boot_volume_attachment: 'VolumeAttachmentPrototypeInstanceBySourceSnapshotContext', - primary_network_interface: 'NetworkInterfacePrototype', - zone: 'ZoneIdentity', - *, - availability_policy: 'InstanceAvailabilityPrototype' = None, - default_trusted_profile: 'InstanceDefaultTrustedProfilePrototype' = None, - keys: List['KeyIdentity'] = None, - metadata_service: 'InstanceMetadataServicePrototype' = None, - name: str = None, - network_interfaces: List['NetworkInterfacePrototype'] = None, - placement_target: 'InstancePlacementTargetPrototype' = None, - profile: 'InstanceProfileIdentity' = None, - resource_group: 'ResourceGroupIdentity' = None, - total_volume_bandwidth: int = None, - user_data: str = None, - volume_attachments: List['VolumeAttachmentPrototypeInstanceContext'] = None, - vpc: 'VPCIdentity' = None) -> None: - """ - Initialize a InstancePrototypeInstanceBySourceSnapshot object. - - :param VolumeAttachmentPrototypeInstanceBySourceSnapshotContext - boot_volume_attachment: The boot volume attachment for the virtual server - instance. - :param NetworkInterfacePrototype primary_network_interface: Primary network - interface. - :param ZoneIdentity zone: The zone this virtual server instance will reside - in. - :param InstanceAvailabilityPrototype availability_policy: (optional) The - availability policy to use for this virtual server instance. - :param InstanceDefaultTrustedProfilePrototype default_trusted_profile: - (optional) The default trusted profile configuration to use for this - virtual server instance This property's value is used when provisioning - the virtual server instance, but not subsequently managed. Accordingly, it - is reflected as an [instance - initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) - property. - :param List[KeyIdentity] keys: (optional) The public SSH keys for the - administrative user of the virtual server instance. Keys will be made - available to the virtual server instance as cloud-init vendor data. For - cloud-init enabled images, these keys will also be added as SSH authorized - keys for the administrative user. - For Windows images, at least one key must be specified, and one will be - chosen to encrypt [the administrator - password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). - Keys are optional for other images, but if no keys are specified, the - instance will be inaccessible unless the specified image provides another - means of access. - This property's value is used when provisioning the virtual server - instance, but not subsequently managed. Accordingly, it is reflected as an - [instance - initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) - property. - :param InstanceMetadataServicePrototype metadata_service: (optional) - :param str name: (optional) The unique user-defined name for this virtual - server instance (and default system hostname). If unspecified, the name - will be a hyphenated list of randomly-selected words. - :param List[NetworkInterfacePrototype] network_interfaces: (optional) The - additional network interfaces to create for the virtual server instance. - :param InstancePlacementTargetPrototype placement_target: (optional) The - placement restrictions to use for the virtual server instance. - :param InstanceProfileIdentity profile: (optional) The profile to use for - this virtual server instance. If unspecified, `bx2-2x8` will be used, but - this default value is expected to change in the future. - :param ResourceGroupIdentity resource_group: (optional) - :param int total_volume_bandwidth: (optional) The amount of bandwidth (in - megabits per second) allocated exclusively to instance storage volumes. An - increase in this value will result in a corresponding decrease to - `total_network_bandwidth`. - :param str user_data: (optional) User data to be made available when - setting up the virtual server instance. - :param List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: - (optional) The volume attachments for this virtual server instance. - :param VPCIdentity vpc: (optional) The VPC the virtual server instance is - to be a part of. If specified, it must match the VPC referenced by the - subnets of the instance's network interfaces. - """ - # pylint: disable=super-init-not-called - self.availability_policy = availability_policy - self.default_trusted_profile = default_trusted_profile - self.keys = keys - self.metadata_service = metadata_service - self.name = name - self.network_interfaces = network_interfaces - self.placement_target = placement_target - self.profile = profile - self.resource_group = resource_group - self.total_volume_bandwidth = total_volume_bandwidth - self.user_data = user_data - self.volume_attachments = volume_attachments - self.vpc = vpc - self.boot_volume_attachment = boot_volume_attachment - self.primary_network_interface = primary_network_interface - self.zone = zone - - @classmethod - def from_dict(cls, _dict: Dict) -> 'InstancePrototypeInstanceBySourceSnapshot': - """Initialize a InstancePrototypeInstanceBySourceSnapshot object from a json dictionary.""" - args = {} - if 'availability_policy' in _dict: - args['availability_policy'] = InstanceAvailabilityPrototype.from_dict(_dict.get('availability_policy')) - if 'default_trusted_profile' in _dict: - args['default_trusted_profile'] = InstanceDefaultTrustedProfilePrototype.from_dict(_dict.get('default_trusted_profile')) - if 'keys' in _dict: - args['keys'] = _dict.get('keys') - if 'metadata_service' in _dict: - args['metadata_service'] = InstanceMetadataServicePrototype.from_dict(_dict.get('metadata_service')) - if 'name' in _dict: - args['name'] = _dict.get('name') - if 'network_interfaces' in _dict: - args['network_interfaces'] = [NetworkInterfacePrototype.from_dict(x) for x in _dict.get('network_interfaces')] - if 'placement_target' in _dict: - args['placement_target'] = _dict.get('placement_target') - if 'profile' in _dict: - args['profile'] = _dict.get('profile') - if 'resource_group' in _dict: - args['resource_group'] = _dict.get('resource_group') - if 'total_volume_bandwidth' in _dict: - args['total_volume_bandwidth'] = _dict.get('total_volume_bandwidth') - if 'user_data' in _dict: - args['user_data'] = _dict.get('user_data') - if 'volume_attachments' in _dict: - args['volume_attachments'] = [VolumeAttachmentPrototypeInstanceContext.from_dict(x) for x in _dict.get('volume_attachments')] - if 'vpc' in _dict: - args['vpc'] = _dict.get('vpc') - if 'boot_volume_attachment' in _dict: - args['boot_volume_attachment'] = VolumeAttachmentPrototypeInstanceBySourceSnapshotContext.from_dict(_dict.get('boot_volume_attachment')) - else: - raise ValueError('Required property \'boot_volume_attachment\' not present in InstancePrototypeInstanceBySourceSnapshot JSON') - if 'primary_network_interface' in _dict: - args['primary_network_interface'] = NetworkInterfacePrototype.from_dict(_dict.get('primary_network_interface')) - else: - raise ValueError('Required property \'primary_network_interface\' not present in InstancePrototypeInstanceBySourceSnapshot JSON') - if 'zone' in _dict: - args['zone'] = _dict.get('zone') - else: - raise ValueError('Required property \'zone\' not present in InstancePrototypeInstanceBySourceSnapshot JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a InstancePrototypeInstanceBySourceSnapshot object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'availability_policy') and self.availability_policy is not None: - _dict['availability_policy'] = self.availability_policy.to_dict() - if hasattr(self, 'default_trusted_profile') and self.default_trusted_profile is not None: - _dict['default_trusted_profile'] = self.default_trusted_profile.to_dict() - if hasattr(self, 'keys') and self.keys is not None: - keys_list = [] - for x in self.keys: - if isinstance(x, dict): - keys_list.append(x) - else: - keys_list.append(x.to_dict()) - _dict['keys'] = keys_list - if hasattr(self, 'metadata_service') and self.metadata_service is not None: - _dict['metadata_service'] = self.metadata_service.to_dict() - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'network_interfaces') and self.network_interfaces is not None: - _dict['network_interfaces'] = [x.to_dict() for x in self.network_interfaces] - if hasattr(self, 'placement_target') and self.placement_target is not None: - if isinstance(self.placement_target, dict): - _dict['placement_target'] = self.placement_target - else: - _dict['placement_target'] = self.placement_target.to_dict() - if hasattr(self, 'profile') and self.profile is not None: - if isinstance(self.profile, dict): - _dict['profile'] = self.profile - else: - _dict['profile'] = self.profile.to_dict() - if hasattr(self, 'resource_group') and self.resource_group is not None: - if isinstance(self.resource_group, dict): - _dict['resource_group'] = self.resource_group - else: - _dict['resource_group'] = self.resource_group.to_dict() - if hasattr(self, 'total_volume_bandwidth') and self.total_volume_bandwidth is not None: - _dict['total_volume_bandwidth'] = self.total_volume_bandwidth - if hasattr(self, 'user_data') and self.user_data is not None: - _dict['user_data'] = self.user_data - if hasattr(self, 'volume_attachments') and self.volume_attachments is not None: - _dict['volume_attachments'] = [x.to_dict() for x in self.volume_attachments] - if hasattr(self, 'vpc') and self.vpc is not None: - if isinstance(self.vpc, dict): - _dict['vpc'] = self.vpc - else: - _dict['vpc'] = self.vpc.to_dict() - if hasattr(self, 'boot_volume_attachment') and self.boot_volume_attachment is not None: - _dict['boot_volume_attachment'] = self.boot_volume_attachment.to_dict() - if hasattr(self, 'primary_network_interface') and self.primary_network_interface is not None: - _dict['primary_network_interface'] = self.primary_network_interface.to_dict() - if hasattr(self, 'zone') and self.zone is not None: - if isinstance(self.zone, dict): - _dict['zone'] = self.zone - else: - _dict['zone'] = self.zone.to_dict() - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this InstancePrototypeInstanceBySourceSnapshot object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'InstancePrototypeInstanceBySourceSnapshot') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'InstancePrototypeInstanceBySourceSnapshot') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - -class InstancePrototypeInstanceBySourceTemplate(InstancePrototype): - """ - InstancePrototypeInstanceBySourceTemplate. - - :attr InstanceAvailabilityPrototype availability_policy: (optional) The - availability policy to use for this virtual server instance. - :attr InstanceDefaultTrustedProfilePrototype default_trusted_profile: (optional) - The default trusted profile configuration to use for this virtual server - instance This property's value is used when provisioning the virtual server - instance, but not subsequently managed. Accordingly, it is reflected as an - [instance - initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) - property. - :attr List[KeyIdentity] keys: (optional) The public SSH keys for the - administrative user of the virtual server instance. Keys will be made available - to the virtual server instance as cloud-init vendor data. For cloud-init enabled - images, these keys will also be added as SSH authorized keys for the - administrative user. - For Windows images, at least one key must be specified, and one will be chosen - to encrypt [the administrator - password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). Keys - are optional for other images, but if no keys are specified, the instance will - be inaccessible unless the specified image provides another means of access. - This property's value is used when provisioning the virtual server instance, but - not subsequently managed. Accordingly, it is reflected as an [instance - initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) - property. - :attr InstanceMetadataServicePrototype metadata_service: (optional) - :attr str name: (optional) The unique user-defined name for this virtual server - instance (and default system hostname). If unspecified, the name will be a - hyphenated list of randomly-selected words. - :attr List[NetworkInterfacePrototype] network_interfaces: (optional) The - additional network interfaces to create for the virtual server instance. - :attr InstancePlacementTargetPrototype placement_target: (optional) The - placement restrictions to use for the virtual server instance. - :attr InstanceProfileIdentity profile: (optional) The profile to use for this - virtual server instance. If unspecified, `bx2-2x8` will be used, but this - default value is expected to change in the future. - :attr ResourceGroupIdentity resource_group: (optional) - :attr int total_volume_bandwidth: (optional) The amount of bandwidth (in - megabits per second) allocated exclusively to instance storage volumes. An - increase in this value will result in a corresponding decrease to - `total_network_bandwidth`. - :attr str user_data: (optional) User data to be made available when setting up - the virtual server instance. - :attr List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: - (optional) The volume attachments for this virtual server instance. :attr VPCIdentity vpc: (optional) The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the subnets of the instance's network interfaces. @@ -70684,10 +75596,12 @@ def __init__(self, megabits per second) allocated exclusively to instance storage volumes. An increase in this value will result in a corresponding decrease to `total_network_bandwidth`. - :param str user_data: (optional) User data to be made available when - setting up the virtual server instance. + :param str user_data: (optional) [User + data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available + when setting up the virtual server instance. :param List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: - (optional) The volume attachments for this virtual server instance. + (optional) The additional volume attachments to create for the virtual + server instance. :param VPCIdentity vpc: (optional) The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the subnets of the instance's network interfaces. @@ -71070,10 +75984,12 @@ class InstanceTemplatePrototypeInstanceByImage(InstanceTemplatePrototype): megabits per second) allocated exclusively to instance storage volumes. An increase in this value will result in a corresponding decrease to `total_network_bandwidth`. - :attr str user_data: (optional) User data to be made available when setting up - the virtual server instance. + :attr str user_data: (optional) [User + data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when + setting up the virtual server instance. :attr List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: - (optional) The volume attachments for this virtual server instance. + (optional) The additional volume attachments to create for the virtual server + instance. :attr VPCIdentity vpc: (optional) The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the subnets of the instance's network interfaces. @@ -71155,10 +76071,12 @@ def __init__(self, megabits per second) allocated exclusively to instance storage volumes. An increase in this value will result in a corresponding decrease to `total_network_bandwidth`. - :param str user_data: (optional) User data to be made available when - setting up the virtual server instance. + :param str user_data: (optional) [User + data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available + when setting up the virtual server instance. :param List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: - (optional) The volume attachments for this virtual server instance. + (optional) The additional volume attachments to create for the virtual + server instance. :param VPCIdentity vpc: (optional) The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the subnets of the instance's network interfaces. @@ -71360,10 +76278,12 @@ class InstanceTemplatePrototypeInstanceBySourceTemplate(InstanceTemplatePrototyp megabits per second) allocated exclusively to instance storage volumes. An increase in this value will result in a corresponding decrease to `total_network_bandwidth`. - :attr str user_data: (optional) User data to be made available when setting up - the virtual server instance. + :attr str user_data: (optional) [User + data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when + setting up the virtual server instance. :attr List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: - (optional) The volume attachments for this virtual server instance. + (optional) The additional volume attachments to create for the virtual server + instance. :attr VPCIdentity vpc: (optional) The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the subnets of the instance's network interfaces. @@ -71445,10 +76365,12 @@ def __init__(self, megabits per second) allocated exclusively to instance storage volumes. An increase in this value will result in a corresponding decrease to `total_network_bandwidth`. - :param str user_data: (optional) User data to be made available when - setting up the virtual server instance. + :param str user_data: (optional) [User + data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available + when setting up the virtual server instance. :param List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: - (optional) The volume attachments for this virtual server instance. + (optional) The additional volume attachments to create for the virtual + server instance. :param VPCIdentity vpc: (optional) The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the subnets of the instance's network interfaces. @@ -71664,10 +76586,12 @@ class InstanceTemplateInstanceByImage(InstanceTemplate): megabits per second) allocated exclusively to instance storage volumes. An increase in this value will result in a corresponding decrease to `total_network_bandwidth`. - :attr str user_data: (optional) User data to be made available when setting up - the virtual server instance. + :attr str user_data: (optional) [User + data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when + setting up the virtual server instance. :attr List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: - (optional) The volume attachments for this virtual server instance. + (optional) The additional volume attachments to create for the virtual server + instance. :attr VPCIdentity vpc: (optional) The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the subnets of the instance's network interfaces. @@ -71757,10 +76681,12 @@ def __init__(self, megabits per second) allocated exclusively to instance storage volumes. An increase in this value will result in a corresponding decrease to `total_network_bandwidth`. - :param str user_data: (optional) User data to be made available when - setting up the virtual server instance. + :param str user_data: (optional) [User + data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available + when setting up the virtual server instance. :param List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: - (optional) The volume attachments for this virtual server instance. + (optional) The additional volume attachments to create for the virtual + server instance. :param VPCIdentity vpc: (optional) The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the subnets of the instance's network interfaces. @@ -71995,10 +76921,12 @@ class InstanceTemplateInstanceBySourceSnapshot(InstanceTemplate): megabits per second) allocated exclusively to instance storage volumes. An increase in this value will result in a corresponding decrease to `total_network_bandwidth`. - :attr str user_data: (optional) User data to be made available when setting up - the virtual server instance. + :attr str user_data: (optional) [User + data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when + setting up the virtual server instance. :attr List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: - (optional) The volume attachments for this virtual server instance. + (optional) The additional volume attachments to create for the virtual server + instance. :attr VPCIdentity vpc: (optional) The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the subnets of the instance's network interfaces. @@ -72087,10 +77015,12 @@ def __init__(self, megabits per second) allocated exclusively to instance storage volumes. An increase in this value will result in a corresponding decrease to `total_network_bandwidth`. - :param str user_data: (optional) User data to be made available when - setting up the virtual server instance. + :param str user_data: (optional) [User + data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available + when setting up the virtual server instance. :param List[VolumeAttachmentPrototypeInstanceContext] volume_attachments: - (optional) The volume attachments for this virtual server instance. + (optional) The additional volume attachments to create for the virtual + server instance. :param VPCIdentity vpc: (optional) The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the subnets of the instance's network interfaces. @@ -78224,16 +83154,424 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ReservedIPTargetVPNGatewayReference object.""" + """Return a `str` version of this ReservedIPTargetVPNGatewayReference object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'ReservedIPTargetVPNGatewayReference') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'ReservedIPTargetVPNGatewayReference') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + VPN_GATEWAY = 'vpn_gateway' + + +class ReservedIPTargetVPNServerReference(ReservedIPTarget): + """ + ReservedIPTargetVPNServerReference. + + :attr str crn: The CRN for this VPN server. + :attr VPNServerReferenceDeleted deleted: (optional) If present, this property + indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str href: The URL for this VPN server. + :attr str id: The unique identifier for this VPN server. + :attr str name: The unique user-defined name for this VPN server. + :attr str resource_type: The resource type. + """ + + def __init__(self, + crn: str, + href: str, + id: str, + name: str, + resource_type: str, + *, + deleted: 'VPNServerReferenceDeleted' = None) -> None: + """ + Initialize a ReservedIPTargetVPNServerReference object. + + :param str crn: The CRN for this VPN server. + :param str href: The URL for this VPN server. + :param str id: The unique identifier for this VPN server. + :param str name: The unique user-defined name for this VPN server. + :param str resource_type: The resource type. + :param VPNServerReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides + some supplementary information. + """ + # pylint: disable=super-init-not-called + self.crn = crn + self.deleted = deleted + self.href = href + self.id = id + self.name = name + self.resource_type = resource_type + + @classmethod + def from_dict(cls, _dict: Dict) -> 'ReservedIPTargetVPNServerReference': + """Initialize a ReservedIPTargetVPNServerReference object from a json dictionary.""" + args = {} + if 'crn' in _dict: + args['crn'] = _dict.get('crn') + else: + raise ValueError('Required property \'crn\' not present in ReservedIPTargetVPNServerReference JSON') + if 'deleted' in _dict: + args['deleted'] = VPNServerReferenceDeleted.from_dict(_dict.get('deleted')) + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in ReservedIPTargetVPNServerReference JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in ReservedIPTargetVPNServerReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in ReservedIPTargetVPNServerReference JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in ReservedIPTargetVPNServerReference JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a ReservedIPTargetVPNServerReference object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this ReservedIPTargetVPNServerReference object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'ReservedIPTargetVPNServerReference') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'ReservedIPTargetVPNServerReference') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + VPN_SERVER = 'vpn_server' + + +class ResourceGroupIdentityById(ResourceGroupIdentity): + """ + ResourceGroupIdentityById. + + :attr str id: The unique identifier for this resource group. + """ + + def __init__(self, + id: str) -> None: + """ + Initialize a ResourceGroupIdentityById object. + + :param str id: The unique identifier for this resource group. + """ + # pylint: disable=super-init-not-called + self.id = id + + @classmethod + def from_dict(cls, _dict: Dict) -> 'ResourceGroupIdentityById': + """Initialize a ResourceGroupIdentityById object from a json dictionary.""" + args = {} + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in ResourceGroupIdentityById JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a ResourceGroupIdentityById object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this ResourceGroupIdentityById object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'ResourceGroupIdentityById') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'ResourceGroupIdentityById') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class RouteCreatorVPNGatewayReference(RouteCreator): + """ + RouteCreatorVPNGatewayReference. + + :attr str crn: The VPN gateway's CRN. + :attr VPNGatewayReferenceDeleted deleted: (optional) If present, this property + indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str href: The VPN gateway's canonical URL. + :attr str id: The unique identifier for this VPN gateway. + :attr str name: The user-defined name for this VPN gateway. + :attr str resource_type: The resource type. + """ + + def __init__(self, + crn: str, + href: str, + id: str, + name: str, + resource_type: str, + *, + deleted: 'VPNGatewayReferenceDeleted' = None) -> None: + """ + Initialize a RouteCreatorVPNGatewayReference object. + + :param str crn: The VPN gateway's CRN. + :param str href: The VPN gateway's canonical URL. + :param str id: The unique identifier for this VPN gateway. + :param str name: The user-defined name for this VPN gateway. + :param str resource_type: The resource type. + :param VPNGatewayReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides + some supplementary information. + """ + # pylint: disable=super-init-not-called + self.crn = crn + self.deleted = deleted + self.href = href + self.id = id + self.name = name + self.resource_type = resource_type + + @classmethod + def from_dict(cls, _dict: Dict) -> 'RouteCreatorVPNGatewayReference': + """Initialize a RouteCreatorVPNGatewayReference object from a json dictionary.""" + args = {} + if 'crn' in _dict: + args['crn'] = _dict.get('crn') + else: + raise ValueError('Required property \'crn\' not present in RouteCreatorVPNGatewayReference JSON') + if 'deleted' in _dict: + args['deleted'] = VPNGatewayReferenceDeleted.from_dict(_dict.get('deleted')) + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in RouteCreatorVPNGatewayReference JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in RouteCreatorVPNGatewayReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in RouteCreatorVPNGatewayReference JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in RouteCreatorVPNGatewayReference JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a RouteCreatorVPNGatewayReference object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this RouteCreatorVPNGatewayReference object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'RouteCreatorVPNGatewayReference') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'RouteCreatorVPNGatewayReference') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + VPN_GATEWAY = 'vpn_gateway' + + +class RouteCreatorVPNServerReference(RouteCreator): + """ + RouteCreatorVPNServerReference. + + :attr str crn: The CRN for this VPN server. + :attr VPNServerReferenceDeleted deleted: (optional) If present, this property + indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str href: The URL for this VPN server. + :attr str id: The unique identifier for this VPN server. + :attr str name: The unique user-defined name for this VPN server. + :attr str resource_type: The resource type. + """ + + def __init__(self, + crn: str, + href: str, + id: str, + name: str, + resource_type: str, + *, + deleted: 'VPNServerReferenceDeleted' = None) -> None: + """ + Initialize a RouteCreatorVPNServerReference object. + + :param str crn: The CRN for this VPN server. + :param str href: The URL for this VPN server. + :param str id: The unique identifier for this VPN server. + :param str name: The unique user-defined name for this VPN server. + :param str resource_type: The resource type. + :param VPNServerReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides + some supplementary information. + """ + # pylint: disable=super-init-not-called + self.crn = crn + self.deleted = deleted + self.href = href + self.id = id + self.name = name + self.resource_type = resource_type + + @classmethod + def from_dict(cls, _dict: Dict) -> 'RouteCreatorVPNServerReference': + """Initialize a RouteCreatorVPNServerReference object from a json dictionary.""" + args = {} + if 'crn' in _dict: + args['crn'] = _dict.get('crn') + else: + raise ValueError('Required property \'crn\' not present in RouteCreatorVPNServerReference JSON') + if 'deleted' in _dict: + args['deleted'] = VPNServerReferenceDeleted.from_dict(_dict.get('deleted')) + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in RouteCreatorVPNServerReference JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in RouteCreatorVPNServerReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in RouteCreatorVPNServerReference JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in RouteCreatorVPNServerReference JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a RouteCreatorVPNServerReference object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this RouteCreatorVPNServerReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ReservedIPTargetVPNGatewayReference') -> bool: + def __eq__(self, other: 'RouteCreatorVPNServerReference') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'ReservedIPTargetVPNGatewayReference') -> bool: + def __ne__(self, other: 'RouteCreatorVPNServerReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other @@ -78241,65 +83579,8 @@ class ResourceTypeEnum(str, Enum): """ The resource type. """ - VPN_GATEWAY = 'vpn_gateway' - + VPN_SERVER = 'vpn_server' -class ResourceGroupIdentityById(ResourceGroupIdentity): - """ - ResourceGroupIdentityById. - - :attr str id: The unique identifier for this resource group. - """ - - def __init__(self, - id: str) -> None: - """ - Initialize a ResourceGroupIdentityById object. - - :param str id: The unique identifier for this resource group. - """ - # pylint: disable=super-init-not-called - self.id = id - - @classmethod - def from_dict(cls, _dict: Dict) -> 'ResourceGroupIdentityById': - """Initialize a ResourceGroupIdentityById object from a json dictionary.""" - args = {} - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in ResourceGroupIdentityById JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a ResourceGroupIdentityById object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this ResourceGroupIdentityById object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'ResourceGroupIdentityById') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'ResourceGroupIdentityById') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other class RouteNextHopIP(RouteNextHop): """ @@ -78367,88 +83648,6 @@ def __ne__(self, other: 'RouteNextHopIP') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class RouteNextHopPrototypeRouteNextHopIP(RouteNextHopPrototype): - """ - The IP address of the next hop to which to route packets. - - :attr str address: The IP address. - This property may add support for IPv6 addresses in the future. When processing - a value in this property, verify that the address is in an expected format. If - it is not, log an error. Optionally halt processing and surface the error, or - bypass the resource on which the unexpected IP address format was encountered. - """ - - def __init__(self, - address: str) -> None: - """ - Initialize a RouteNextHopPrototypeRouteNextHopIP object. - - :param str address: The IP address. - This property may add support for IPv6 addresses in the future. When - processing a value in this property, verify that the address is in an - expected format. If it is not, log an error. Optionally halt processing and - surface the error, or bypass the resource on which the unexpected IP - address format was encountered. - """ - # pylint: disable=super-init-not-called - self.address = address - - @classmethod - def from_dict(cls, _dict: Dict) -> 'RouteNextHopPrototypeRouteNextHopIP': - """Initialize a RouteNextHopPrototypeRouteNextHopIP object from a json dictionary.""" - args = {} - if 'address' in _dict: - args['address'] = _dict.get('address') - else: - raise ValueError('Required property \'address\' not present in RouteNextHopPrototypeRouteNextHopIP JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a RouteNextHopPrototypeRouteNextHopIP object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'address') and self.address is not None: - _dict['address'] = self.address - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this RouteNextHopPrototypeRouteNextHopIP object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'RouteNextHopPrototypeRouteNextHopIP') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'RouteNextHopPrototypeRouteNextHopIP') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - -class RouteNextHopPrototypeVPNGatewayConnectionIdentity(RouteNextHopPrototype): - """ - Identifies a VPN gateway connection by a unique property. - - """ - - def __init__(self) -> None: - """ - Initialize a RouteNextHopPrototypeVPNGatewayConnectionIdentity object. - - """ - # pylint: disable=super-init-not-called - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById', 'RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref'])) - raise Exception(msg) - class RouteNextHopVPNGatewayConnectionReference(RouteNextHop): """ RouteNextHopVPNGatewayConnectionReference. @@ -78557,6 +83756,88 @@ class ResourceTypeEnum(str, Enum): VPN_GATEWAY_CONNECTION = 'vpn_gateway_connection' +class RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP(RoutePrototypeNextHop): + """ + The IP address of the next hop to which to route packets. + + :attr str address: The IP address. + This property may add support for IPv6 addresses in the future. When processing + a value in this property, verify that the address is in an expected format. If + it is not, log an error. Optionally halt processing and surface the error, or + bypass the resource on which the unexpected IP address format was encountered. + """ + + def __init__(self, + address: str) -> None: + """ + Initialize a RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP object. + + :param str address: The IP address. + This property may add support for IPv6 addresses in the future. When + processing a value in this property, verify that the address is in an + expected format. If it is not, log an error. Optionally halt processing and + surface the error, or bypass the resource on which the unexpected IP + address format was encountered. + """ + # pylint: disable=super-init-not-called + self.address = address + + @classmethod + def from_dict(cls, _dict: Dict) -> 'RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP': + """Initialize a RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP object from a json dictionary.""" + args = {} + if 'address' in _dict: + args['address'] = _dict.get('address') + else: + raise ValueError('Required property \'address\' not present in RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'address') and self.address is not None: + _dict['address'] = self.address + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + +class RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity(RoutePrototypeNextHop): + """ + Identifies a VPN gateway connection by a unique property. + + """ + + def __init__(self) -> None: + """ + Initialize a RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity object. + + """ + # pylint: disable=super-init-not-called + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById', 'RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref'])) + raise Exception(msg) + class RoutingTableIdentityByHref(RoutingTableIdentity): """ RoutingTableIdentityByHref. @@ -80635,6 +85916,123 @@ class ResourceTypeEnum(str, Enum): NETWORK_INTERFACE = 'network_interface' +class SecurityGroupTargetReferenceVPNServerReference(SecurityGroupTargetReference): + """ + SecurityGroupTargetReferenceVPNServerReference. + + :attr str crn: The CRN for this VPN server. + :attr VPNServerReferenceDeleted deleted: (optional) If present, this property + indicates the referenced resource has been deleted and provides + some supplementary information. + :attr str href: The URL for this VPN server. + :attr str id: The unique identifier for this VPN server. + :attr str name: The unique user-defined name for this VPN server. + :attr str resource_type: The resource type. + """ + + def __init__(self, + crn: str, + href: str, + id: str, + name: str, + resource_type: str, + *, + deleted: 'VPNServerReferenceDeleted' = None) -> None: + """ + Initialize a SecurityGroupTargetReferenceVPNServerReference object. + + :param str crn: The CRN for this VPN server. + :param str href: The URL for this VPN server. + :param str id: The unique identifier for this VPN server. + :param str name: The unique user-defined name for this VPN server. + :param str resource_type: The resource type. + :param VPNServerReferenceDeleted deleted: (optional) If present, this + property indicates the referenced resource has been deleted and provides + some supplementary information. + """ + # pylint: disable=super-init-not-called + self.crn = crn + self.deleted = deleted + self.href = href + self.id = id + self.name = name + self.resource_type = resource_type + + @classmethod + def from_dict(cls, _dict: Dict) -> 'SecurityGroupTargetReferenceVPNServerReference': + """Initialize a SecurityGroupTargetReferenceVPNServerReference object from a json dictionary.""" + args = {} + if 'crn' in _dict: + args['crn'] = _dict.get('crn') + else: + raise ValueError('Required property \'crn\' not present in SecurityGroupTargetReferenceVPNServerReference JSON') + if 'deleted' in _dict: + args['deleted'] = VPNServerReferenceDeleted.from_dict(_dict.get('deleted')) + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in SecurityGroupTargetReferenceVPNServerReference JSON') + if 'id' in _dict: + args['id'] = _dict.get('id') + else: + raise ValueError('Required property \'id\' not present in SecurityGroupTargetReferenceVPNServerReference JSON') + if 'name' in _dict: + args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in SecurityGroupTargetReferenceVPNServerReference JSON') + if 'resource_type' in _dict: + args['resource_type'] = _dict.get('resource_type') + else: + raise ValueError('Required property \'resource_type\' not present in SecurityGroupTargetReferenceVPNServerReference JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a SecurityGroupTargetReferenceVPNServerReference object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'deleted') and self.deleted is not None: + _dict['deleted'] = self.deleted.to_dict() + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'resource_type') and self.resource_type is not None: + _dict['resource_type'] = self.resource_type + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this SecurityGroupTargetReferenceVPNServerReference object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'SecurityGroupTargetReferenceVPNServerReference') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'SecurityGroupTargetReferenceVPNServerReference') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class ResourceTypeEnum(str, Enum): + """ + The resource type. + """ + VPN_SERVER = 'vpn_server' + + class SnapshotIdentityByCRN(SnapshotIdentity): """ SnapshotIdentityByCRN. @@ -83836,6 +89234,426 @@ class ModeEnum(str, Enum): ROUTE = 'route' +class VPNServerAuthenticationByCertificate(VPNServerAuthentication): + """ + VPNServerAuthenticationByCertificate. + + :attr str method: The type of authentication. + :attr CertificateInstanceReference client_ca: The certificate instance used for + the VPN client certificate authority (CA). + :attr str crl: (optional) The certificate revocation list contents, encoded in + PEM format. + """ + + def __init__(self, + method: str, + client_ca: 'CertificateInstanceReference', + *, + crl: str = None) -> None: + """ + Initialize a VPNServerAuthenticationByCertificate object. + + :param str method: The type of authentication. + :param CertificateInstanceReference client_ca: The certificate instance + used for the VPN client certificate authority (CA). + :param str crl: (optional) The certificate revocation list contents, + encoded in PEM format. + """ + # pylint: disable=super-init-not-called + self.method = method + self.client_ca = client_ca + self.crl = crl + + @classmethod + def from_dict(cls, _dict: Dict) -> 'VPNServerAuthenticationByCertificate': + """Initialize a VPNServerAuthenticationByCertificate object from a json dictionary.""" + args = {} + if 'method' in _dict: + args['method'] = _dict.get('method') + else: + raise ValueError('Required property \'method\' not present in VPNServerAuthenticationByCertificate JSON') + if 'client_ca' in _dict: + args['client_ca'] = CertificateInstanceReference.from_dict(_dict.get('client_ca')) + else: + raise ValueError('Required property \'client_ca\' not present in VPNServerAuthenticationByCertificate JSON') + if 'crl' in _dict: + args['crl'] = _dict.get('crl') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a VPNServerAuthenticationByCertificate object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'method') and self.method is not None: + _dict['method'] = self.method + if hasattr(self, 'client_ca') and self.client_ca is not None: + _dict['client_ca'] = self.client_ca.to_dict() + if hasattr(self, 'crl') and self.crl is not None: + _dict['crl'] = self.crl + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this VPNServerAuthenticationByCertificate object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'VPNServerAuthenticationByCertificate') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'VPNServerAuthenticationByCertificate') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class MethodEnum(str, Enum): + """ + The type of authentication. + """ + CERTIFICATE = 'certificate' + USERNAME = 'username' + + +class VPNServerAuthenticationByUsername(VPNServerAuthentication): + """ + VPNServerAuthenticationByUsername. + + :attr str method: The type of authentication. + :attr VPNServerAuthenticationByUsernameIdProvider identity_provider: The type of + identity provider to be used by VPN client. + """ + + def __init__(self, + method: str, + identity_provider: 'VPNServerAuthenticationByUsernameIdProvider') -> None: + """ + Initialize a VPNServerAuthenticationByUsername object. + + :param str method: The type of authentication. + :param VPNServerAuthenticationByUsernameIdProvider identity_provider: The + type of identity provider to be used by VPN client. + """ + # pylint: disable=super-init-not-called + self.method = method + self.identity_provider = identity_provider + + @classmethod + def from_dict(cls, _dict: Dict) -> 'VPNServerAuthenticationByUsername': + """Initialize a VPNServerAuthenticationByUsername object from a json dictionary.""" + args = {} + if 'method' in _dict: + args['method'] = _dict.get('method') + else: + raise ValueError('Required property \'method\' not present in VPNServerAuthenticationByUsername JSON') + if 'identity_provider' in _dict: + args['identity_provider'] = _dict.get('identity_provider') + else: + raise ValueError('Required property \'identity_provider\' not present in VPNServerAuthenticationByUsername JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a VPNServerAuthenticationByUsername object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'method') and self.method is not None: + _dict['method'] = self.method + if hasattr(self, 'identity_provider') and self.identity_provider is not None: + if isinstance(self.identity_provider, dict): + _dict['identity_provider'] = self.identity_provider + else: + _dict['identity_provider'] = self.identity_provider.to_dict() + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this VPNServerAuthenticationByUsername object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'VPNServerAuthenticationByUsername') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'VPNServerAuthenticationByUsername') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class MethodEnum(str, Enum): + """ + The type of authentication. + """ + CERTIFICATE = 'certificate' + USERNAME = 'username' + + +class VPNServerAuthenticationByUsernameIdProviderByIAM(VPNServerAuthenticationByUsernameIdProvider): + """ + VPNServerAuthenticationByUsernameIdProviderByIAM. + + :attr str provider_type: The type of identity provider to be used by the VPN + client. + - `iam`: IBM identity and access management + The enumerated values for this property are expected to expand in the future. + When processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the route on which the unexpected + property value was encountered. + """ + + def __init__(self, + provider_type: str) -> None: + """ + Initialize a VPNServerAuthenticationByUsernameIdProviderByIAM object. + + :param str provider_type: The type of identity provider to be used by the + VPN client. + - `iam`: IBM identity and access management + The enumerated values for this property are expected to expand in the + future. When processing this property, check for and log unknown values. + Optionally halt processing and surface the error, or bypass the route on + which the unexpected property value was encountered. + """ + # pylint: disable=super-init-not-called + self.provider_type = provider_type + + @classmethod + def from_dict(cls, _dict: Dict) -> 'VPNServerAuthenticationByUsernameIdProviderByIAM': + """Initialize a VPNServerAuthenticationByUsernameIdProviderByIAM object from a json dictionary.""" + args = {} + if 'provider_type' in _dict: + args['provider_type'] = _dict.get('provider_type') + else: + raise ValueError('Required property \'provider_type\' not present in VPNServerAuthenticationByUsernameIdProviderByIAM JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a VPNServerAuthenticationByUsernameIdProviderByIAM object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'provider_type') and self.provider_type is not None: + _dict['provider_type'] = self.provider_type + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this VPNServerAuthenticationByUsernameIdProviderByIAM object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'VPNServerAuthenticationByUsernameIdProviderByIAM') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'VPNServerAuthenticationByUsernameIdProviderByIAM') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class ProviderTypeEnum(str, Enum): + """ + The type of identity provider to be used by the VPN client. + - `iam`: IBM identity and access management + The enumerated values for this property are expected to expand in the future. When + processing this property, check for and log unknown values. Optionally halt + processing and surface the error, or bypass the route on which the unexpected + property value was encountered. + """ + IAM = 'iam' + + +class VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype(VPNServerAuthenticationPrototype): + """ + VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype. + + :attr str method: The type of authentication. + :attr CertificateInstanceIdentity client_ca: The certificate instance to use for + the VPN client certificate authority (CA). + :attr str crl: (optional) The certificate revocation list contents, encoded in + PEM format. + """ + + def __init__(self, + method: str, + client_ca: 'CertificateInstanceIdentity', + *, + crl: str = None) -> None: + """ + Initialize a VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype object. + + :param str method: The type of authentication. + :param CertificateInstanceIdentity client_ca: The certificate instance to + use for the VPN client certificate authority (CA). + :param str crl: (optional) The certificate revocation list contents, + encoded in PEM format. + """ + # pylint: disable=super-init-not-called + self.method = method + self.client_ca = client_ca + self.crl = crl + + @classmethod + def from_dict(cls, _dict: Dict) -> 'VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype': + """Initialize a VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype object from a json dictionary.""" + args = {} + if 'method' in _dict: + args['method'] = _dict.get('method') + else: + raise ValueError('Required property \'method\' not present in VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype JSON') + if 'client_ca' in _dict: + args['client_ca'] = _dict.get('client_ca') + else: + raise ValueError('Required property \'client_ca\' not present in VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype JSON') + if 'crl' in _dict: + args['crl'] = _dict.get('crl') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'method') and self.method is not None: + _dict['method'] = self.method + if hasattr(self, 'client_ca') and self.client_ca is not None: + if isinstance(self.client_ca, dict): + _dict['client_ca'] = self.client_ca + else: + _dict['client_ca'] = self.client_ca.to_dict() + if hasattr(self, 'crl') and self.crl is not None: + _dict['crl'] = self.crl + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class MethodEnum(str, Enum): + """ + The type of authentication. + """ + CERTIFICATE = 'certificate' + USERNAME = 'username' + + +class VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype(VPNServerAuthenticationPrototype): + """ + VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype. + + :attr str method: The type of authentication. + :attr VPNServerAuthenticationByUsernameIdProvider identity_provider: The type of + identity provider to be used by VPN client. + """ + + def __init__(self, + method: str, + identity_provider: 'VPNServerAuthenticationByUsernameIdProvider') -> None: + """ + Initialize a VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype object. + + :param str method: The type of authentication. + :param VPNServerAuthenticationByUsernameIdProvider identity_provider: The + type of identity provider to be used by VPN client. + """ + # pylint: disable=super-init-not-called + self.method = method + self.identity_provider = identity_provider + + @classmethod + def from_dict(cls, _dict: Dict) -> 'VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype': + """Initialize a VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype object from a json dictionary.""" + args = {} + if 'method' in _dict: + args['method'] = _dict.get('method') + else: + raise ValueError('Required property \'method\' not present in VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype JSON') + if 'identity_provider' in _dict: + args['identity_provider'] = _dict.get('identity_provider') + else: + raise ValueError('Required property \'identity_provider\' not present in VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'method') and self.method is not None: + _dict['method'] = self.method + if hasattr(self, 'identity_provider') and self.identity_provider is not None: + if isinstance(self.identity_provider, dict): + _dict['identity_provider'] = self.identity_provider + else: + _dict['identity_provider'] = self.identity_provider.to_dict() + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class MethodEnum(str, Enum): + """ + The type of authentication. + """ + CERTIFICATE = 'certificate' + USERNAME = 'username' + + class VolumeAttachmentPrototypeVolumeVolumeIdentity(VolumeAttachmentPrototypeVolume): """ Identifies a volume by a unique property. @@ -84357,6 +90175,167 @@ def __ne__(self, other: 'VolumePrototypeVolumeByCapacity') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other +class VolumePrototypeVolumeBySourceSnapshot(VolumePrototype): + """ + VolumePrototypeVolumeBySourceSnapshot. + + :attr int iops: (optional) The maximum I/O operations per second (IOPS) to use + for the volume. Applicable only to volumes using a profile `family` of `custom`. + :attr str name: (optional) The unique user-defined name for this volume. + :attr VolumeProfileIdentity profile: The profile to use for this volume. + :attr ResourceGroupIdentity resource_group: (optional) + :attr List[str] user_tags: (optional) The [user + tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this + volume. + :attr ZoneIdentity zone: The zone this volume will reside in. + :attr int capacity: (optional) The capacity to use for the volume (in + gigabytes). Must be at least the snapshot's + `minimum_capacity`. The maximum value may increase in the future. + If unspecified, the capacity will be the source snapshot's `minimum_capacity`. + :attr EncryptionKeyIdentity encryption_key: (optional) The root key to use to + wrap the data encryption key for the volume. + If unspecified, the snapshot's `encryption_key` will be used. + :attr SnapshotIdentity source_snapshot: The snapshot from which to clone the + volume. + """ + + def __init__(self, + profile: 'VolumeProfileIdentity', + zone: 'ZoneIdentity', + source_snapshot: 'SnapshotIdentity', + *, + iops: int = None, + name: str = None, + resource_group: 'ResourceGroupIdentity' = None, + user_tags: List[str] = None, + capacity: int = None, + encryption_key: 'EncryptionKeyIdentity' = None) -> None: + """ + Initialize a VolumePrototypeVolumeBySourceSnapshot object. + + :param VolumeProfileIdentity profile: The profile to use for this volume. + :param ZoneIdentity zone: The zone this volume will reside in. + :param SnapshotIdentity source_snapshot: The snapshot from which to clone + the volume. + :param int iops: (optional) The maximum I/O operations per second (IOPS) to + use for the volume. Applicable only to volumes using a profile `family` of + `custom`. + :param str name: (optional) The unique user-defined name for this volume. + :param ResourceGroupIdentity resource_group: (optional) + :param List[str] user_tags: (optional) The [user + tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with + this volume. + :param int capacity: (optional) The capacity to use for the volume (in + gigabytes). Must be at least the snapshot's + `minimum_capacity`. The maximum value may increase in the future. + If unspecified, the capacity will be the source snapshot's + `minimum_capacity`. + :param EncryptionKeyIdentity encryption_key: (optional) The root key to use + to wrap the data encryption key for the volume. + If unspecified, the snapshot's `encryption_key` will be used. + """ + # pylint: disable=super-init-not-called + self.iops = iops + self.name = name + self.profile = profile + self.resource_group = resource_group + self.user_tags = user_tags + self.zone = zone + self.capacity = capacity + self.encryption_key = encryption_key + self.source_snapshot = source_snapshot + + @classmethod + def from_dict(cls, _dict: Dict) -> 'VolumePrototypeVolumeBySourceSnapshot': + """Initialize a VolumePrototypeVolumeBySourceSnapshot object from a json dictionary.""" + args = {} + if 'iops' in _dict: + args['iops'] = _dict.get('iops') + if 'name' in _dict: + args['name'] = _dict.get('name') + if 'profile' in _dict: + args['profile'] = _dict.get('profile') + else: + raise ValueError('Required property \'profile\' not present in VolumePrototypeVolumeBySourceSnapshot JSON') + if 'resource_group' in _dict: + args['resource_group'] = _dict.get('resource_group') + if 'user_tags' in _dict: + args['user_tags'] = _dict.get('user_tags') + if 'zone' in _dict: + args['zone'] = _dict.get('zone') + else: + raise ValueError('Required property \'zone\' not present in VolumePrototypeVolumeBySourceSnapshot JSON') + if 'capacity' in _dict: + args['capacity'] = _dict.get('capacity') + if 'encryption_key' in _dict: + args['encryption_key'] = _dict.get('encryption_key') + if 'source_snapshot' in _dict: + args['source_snapshot'] = _dict.get('source_snapshot') + else: + raise ValueError('Required property \'source_snapshot\' not present in VolumePrototypeVolumeBySourceSnapshot JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a VolumePrototypeVolumeBySourceSnapshot object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'iops') and self.iops is not None: + _dict['iops'] = self.iops + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'profile') and self.profile is not None: + if isinstance(self.profile, dict): + _dict['profile'] = self.profile + else: + _dict['profile'] = self.profile.to_dict() + if hasattr(self, 'resource_group') and self.resource_group is not None: + if isinstance(self.resource_group, dict): + _dict['resource_group'] = self.resource_group + else: + _dict['resource_group'] = self.resource_group.to_dict() + if hasattr(self, 'user_tags') and self.user_tags is not None: + _dict['user_tags'] = self.user_tags + if hasattr(self, 'zone') and self.zone is not None: + if isinstance(self.zone, dict): + _dict['zone'] = self.zone + else: + _dict['zone'] = self.zone.to_dict() + if hasattr(self, 'capacity') and self.capacity is not None: + _dict['capacity'] = self.capacity + if hasattr(self, 'encryption_key') and self.encryption_key is not None: + if isinstance(self.encryption_key, dict): + _dict['encryption_key'] = self.encryption_key + else: + _dict['encryption_key'] = self.encryption_key.to_dict() + if hasattr(self, 'source_snapshot') and self.source_snapshot is not None: + if isinstance(self.source_snapshot, dict): + _dict['source_snapshot'] = self.source_snapshot + else: + _dict['source_snapshot'] = self.source_snapshot.to_dict() + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this VolumePrototypeVolumeBySourceSnapshot object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'VolumePrototypeVolumeBySourceSnapshot') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'VolumePrototypeVolumeBySourceSnapshot') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + class ZoneIdentityByHref(ZoneIdentity): """ ZoneIdentityByHref. @@ -87851,9 +93830,9 @@ def __ne__(self, other: 'ReservedIPTargetPrototypeEndpointGatewayIdentityEndpoin """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(RouteNextHopPrototypeVPNGatewayConnectionIdentity): +class RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity): """ - RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref. + RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref. :attr str href: The VPN connection's canonical URL. """ @@ -87861,7 +93840,7 @@ class RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdent def __init__(self, href: str) -> None: """ - Initialize a RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref object. + Initialize a RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref object. :param str href: The VPN connection's canonical URL. """ @@ -87869,18 +93848,18 @@ def __init__(self, self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref': - """Initialize a RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref': + """Initialize a RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref object from a json dictionary.""" args = {} if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError('Required property \'href\' not present in RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref JSON') + raise ValueError('Required property \'href\' not present in RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref object from a json dictionary.""" + """Initialize a RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -87895,22 +93874,22 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref object.""" + """Return a `str` version of this RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref') -> bool: + def __eq__(self, other: 'RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref') -> bool: + def __ne__(self, other: 'RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById(RouteNextHopPrototypeVPNGatewayConnectionIdentity): +class RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity): """ - RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById. + RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById. :attr str id: The unique identifier for this VPN gateway connection. """ @@ -87918,7 +93897,7 @@ class RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdent def __init__(self, id: str) -> None: """ - Initialize a RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById object. + Initialize a RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById object. :param str id: The unique identifier for this VPN gateway connection. """ @@ -87926,18 +93905,18 @@ def __init__(self, self.id = id @classmethod - def from_dict(cls, _dict: Dict) -> 'RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById': - """Initialize a RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById': + """Initialize a RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById object from a json dictionary.""" args = {} if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError('Required property \'id\' not present in RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById JSON') + raise ValueError('Required property \'id\' not present in RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById object from a json dictionary.""" + """Initialize a RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -87952,16 +93931,16 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById object.""" + """Return a `str` version of this RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById') -> bool: + def __eq__(self, other: 'RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById') -> bool: + def __ne__(self, other: 'RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other diff --git a/test/integration/test_gen2.py b/test/integration/test_gen2.py index 007a36a..77bfb1b 100644 --- a/test/integration/test_gen2.py +++ b/test/integration/test_gen2.py @@ -546,7 +546,7 @@ def test_get_bare_metal_server_network_interface_ip(self, createGen2Service): ips = get_bare_metal_server_network_interface_ip( createGen2Service, store['created_bare_metal_server_id'], store['bms_nic_id'], store['created_subnet_reserved_ip']) assertGetPatchResponse(ips) - + def test_delete_bare_metal_server_nic_fip(self, createGen2Service): fips = remove_bare_metal_server_network_interface_floating_ip( createGen2Service, store['created_bare_metal_server_id'], store['bms_nic_id'], store['created_fip_id']) @@ -760,6 +760,7 @@ def test_delete_sg_target(self, createGen2Service): sg_network_interface = delete_security_group_target_binding( createGen2Service, store['created_sg_id'], store['created_sg_network_interface_id']) assert sg_network_interface.status_code == 204 + def test_create_sg_rule(self, createGen2Service): sg_rule = create_security_group_rule( createGen2Service, store['created_sg_id']) @@ -1005,15 +1006,81 @@ def test_remove_vpn_gateway_connection_peer_cidr(self, createGen2Service): assert peer_cidr.status_code == 204 +class TestVPNServer(): + def test_list_vpn_servers(self, createGen2Service): + vpnServers = list_vpn_servers(createGen2Service) + assertListResponse(vpnServers, 'vpn_servers') + + def test_create_vpn_server(self, createGen2Service): + vpnServer = create_vpn_server(createGen2Service, store['created_subnet']) + assertCreateResponse(vpnServer) + store['created_vpn_server'] = vpnServer.get_result()['id'] + + + def test_get_vpn_server(self, createGen2Service): + vpnServer = get_vpn_server(createGen2Service, store['created_vpn_server']) + store['created_vpn_server_etag'] = vpnServer.get_headers()['ETag'] + assertGetPatchResponse(vpnServer) + + def test_update_vpn_server(self, createGen2Service): + vpnServer = update_vpn_server(createGen2Service, store['created_vpn_server'], store['created_vpn_server_etag']) + assertGetPatchResponse(vpnServer) + + def test_get_vpn_server_client_configuration(self, createGen2Service): + vpnServerConfiguration = get_vpn_server_client_configuration(createGen2Service, store['created_vpn_server']) + assertGetResponse(vpnServerConfiguration) + + def test_list_vpn_server_clients(self, createGen2Service): + clients = list_vpn_server_clients(createGen2Service, store['created_vpn_server']) + print(clients) + store['vpnserverclientId']=clients.get_result()['clients'][0]['id'] + assertListResponse(clients, 'clients') + + def test_get_vpn_server_client(self, createGen2Service): + client = get_vpn_server_client(createGen2Service, store['created_vpn_server'], store['vpnserverclientId']) + assertGetPatchResponse(client) + + def test_disconnect_vpn_client(self, createGen2Service): + response = disconnect_vpn_client(createGen2Service, store['created_vpn_server'], store['vpnserverclientId']) + assertDeleteRequestAcceptedResponse(response) + + def test_list_vpn_server_routes(self, createGen2Service): + routes = list_vpn_server_routes(createGen2Service, store['created_vpn_server']) + assertListResponse(routes, 'routes') + + def test_create_vpn_server_route(self, createGen2Service): + route = create_vpn_server_route(createGen2Service, store['created_vpn_server']) + store['created_vpn_server_route'] = route.get_result()['id'] + assertCreateResponse(route) + + def test_get_vpn_server_route(self, createGen2Service): + route = get_vpn_server_route(createGen2Service, store['created_vpn_server'], store['created_vpn_server_route']) + assertGetPatchResponse(route) + + def test_update_vpn_server_route(self, createGen2Service): + route = update_vpn_server_route(createGen2Service, store['created_vpn_server'], store['created_vpn_server_route']) + assertGetPatchResponse(route) + + def test_delete_vpn_server_route(self, createGen2Service): + response = delete_vpn_server_route(createGen2Service, store['created_vpn_server'], store['created_vpn_server_route']) + assertDeleteRequestAcceptedResponse(response) + + def test_delete_vpn_server_client(self, createGen2Service): + response = delete_vpn_server_client(createGen2Service, store['created_vpn_server'], store['vpnserverclientId']) + assertDeleteRequestAcceptedResponse(response) + + def test_delete_vpn_server(self,createGen2Service): + response = delete_vpn_server(createGen2Service, store['created_vpn_server'], store['created_vpn_server_etag'] ) + assertDeleteRequestAcceptedResponse(response) + class TestLoadBalancer(): def test_list_load_balancer_profiles(self, createGen2Service): profiles = list_load_balancer_profiles(createGen2Service) assertListResponse(profiles, 'profiles') def test_get_load_balancer_profile(self, createGen2Service): - pytest.skip("no env") profile = get_load_balancer_profile(createGen2Service) - assertGetPatchResponse(profile) + assertGetNameResponse(profile) def test_list_load_balancer(self, createGen2Service): load_balancers = list_load_balancers(createGen2Service) @@ -1391,6 +1458,88 @@ def test_delete_dedicated_host(self, createGen2Service): createGen2Service, store['created_dh']) assertDeleteResponse(igm) +class TestBackupAsaService(): + def test_list_backup_policies(self, createGen2Service): + bckPolicies = list_backup_policies( + createGen2Service + ) + assertListResponse(bckPolicies, 'backup_policies') + + def test_create_backup_policy(self, createGen2Service): + name = 'my-backup-policy' + bckPolicies = create_backup_policy(createGen2Service, name) + assertCreateResponse(bckPolicies) + store['created_backup_policy'] = bckPolicies.get_result()['id'] + store['created_backup_policy_etag'] = bckPolicies.get_headers()['ETag'] + + def test_list_backup_policy_plans(self, createGen2Service): + bckPolicyPlans = list_backup_policy_plans( + createGen2Service, + store['created_backup_policy'], + 'my-backup-policy' + ) + assertListResponse(bckPolicyPlans, 'plans') + def test_create_backup_policy_plan(self, createGen2Service): + name='my-backup-policy-plan' + bckPolicyPlan = create_backup_policy_plan( + createGen2Service, + store['created_backup_policy'], + name + ) + assertCreateResponse(bckPolicyPlan) + store['created_backup_policy_plan'] = bckPolicyPlan.get_result()['id'] + + def test_get_backup_policy_plan(self, createGen2Service): + bckPolicyPlan = get_backup_policy_plan( + createGen2Service, + store['created_backup_policy'], + store['created_backup_policy_plan'] + ) + store['created_backup_policy_plan_etag'] = bckPolicyPlan.get_headers()['ETag'] + assertGetPatchResponse(bckPolicyPlan) + + def test_update_backup_policy_plan(self, createGen2Service): + bckPolicyPlan = update_backup_policy_plan( + createGen2Service, + store['created_backup_policy'], + store['created_backup_policy_plan'], + store['created_backup_policy_plan_etag'], + 'my-backup-policy-plan-updated' + ) + assertGetPatchResponse(bckPolicyPlan) + + def test_get_backup_policy(self, createGen2Service): + bckPolicy = get_backup_policy( + createGen2Service, + store['created_backup_policy'] + ) + assertGetPatchResponse(bckPolicy) + + def test_update_backup_policy(self, createGen2Service): + bckPolicy = update_backup_policy( + createGen2Service, + store['created_backup_policy'], + store['created_backup_policy_etag'], + 'my-backup-policy-updated' + ) + assertGetPatchResponse(bckPolicy) + + def test_delete_backup_policy_plan(self, createGen2Service): + bckPolicyPlan = delete_backup_policy_plan( + createGen2Service, + store['created_backup_policy'], + store['created_backup_policy_plan'], + store['created_backup_policy_plan_etag'] + ) + assertDeleteRequestAcceptedResponse(bckPolicyPlan) + + def test_delete_backup_policy(self, createGen2Service): + bckPolicy = delete_backup_policy( + createGen2Service, + store['created_backup_policy'], + store['created_backup_policy_etag'] + ) + assertDeleteRequestAcceptedResponse(bckPolicy) class TestPlacementGroup(): def test_create_placement_group(self, createGen2Service): name = 'my-placement-group' @@ -1840,6 +1989,129 @@ def create_bare_metal_server_stop(service, id, stopping_type): return create_bare_metal_server_stop_response # -------------------------------------------------------- +# Backup Policies +# -------------------------------------------------------- +def list_backup_policies(service): + response = service.list_backup_policies() + return response + +def create_backup_policy(service, name): + # Construct a dict representation of a BackupPolicyPlanDeletionTriggerPrototype model + backup_policy_plan_deletion_trigger_prototype_model = { + 'delete_after': 20, + 'delete_over_count': 20, + } + + # Construct a dict representation of a BackupPolicyPlanPrototype model + backup_policy_plan_prototype_model = { + 'active': True, + 'attach_user_tags': ['my-daily-backup-plan'], + 'copy_user_tags': True, + 'cron_spec': '*/5 1,2,3 * * *', + 'deletion_trigger': backup_policy_plan_deletion_trigger_prototype_model, + 'name': 'my-policy-plan', + } + + response = service.create_backup_policy( + match_user_tags=['my-daily-backup-policy'], + match_resource_types=['volume'], + name=name, + plans=[backup_policy_plan_prototype_model], + ) + return response + +def list_backup_policy_plans(service, backup_policy_id, name): + response = service.list_backup_policy_plans( + backup_policy_id=backup_policy_id, + name=name + ) + return response + +def create_backup_policy_plan(service, backup_policy_id, name): + # Construct a dict representation of a BackupPolicyPlanDeletionTriggerPrototype model + backup_policy_plan_deletion_trigger_prototype_model = { + 'delete_after': 20, + 'delete_over_count': 20, + } + + response = service.create_backup_policy_plan( + backup_policy_id=backup_policy_id, + cron_spec='*/5 1,2,3 * * *', + active=True, + attach_user_tags=['my-daily-backup-plan'], + copy_user_tags=True, + deletion_trigger=backup_policy_plan_deletion_trigger_prototype_model, + name=name + ) + return response + +def get_backup_policy_plan(service, backup_policy_id, backup_policy_plan_id): + response = service.get_backup_policy_plan( + backup_policy_id=backup_policy_id, + id=backup_policy_plan_id + ) + return response + +def update_backup_policy_plan(service, backup_policy_id, backup_policy_plan_id, etag, name): + # Construct a dict representation of a BackupPolicyPlanDeletionTriggerPatch model + backup_policy_plan_deletion_trigger_patch_model = { + 'delete_after': 20, + 'delete_over_count': 38, + } + + # Construct a dict representation of a BackupPolicyPlanPatch model + backup_policy_plan_patch_model = { + 'active': True, + 'attach_user_tags': ['my-daily-backup-plan'], + 'copy_user_tags': True, + 'cron_spec': '*/5 1,2,3 * * *', + 'deletion_trigger': backup_policy_plan_deletion_trigger_patch_model, + 'name': name, + } + + response = service.update_backup_policy_plan( + backup_policy_id=backup_policy_id, + id=backup_policy_plan_id, + backup_policy_plan_patch=backup_policy_plan_patch_model, + if_match=etag + ) + return response + +def get_backup_policy(service, backup_policy_id): + response = service.get_backup_policy( + id=backup_policy_id + ) + return response + +def update_backup_policy(service, backup_policy_id, etag, name): + # Construct a dict representation of a BackupPolicyPatch model + backup_policy_patch_model = { + 'match_user_tags': ['my-daily-backup-policy'], + 'name': name, + } + + response = service.update_backup_policy( + id=backup_policy_id, + backup_policy_patch=backup_policy_patch_model, + if_match=etag + ) + return response + +def delete_backup_policy_plan(service, backup_policy_id, backup_policy_plan_id, etag): + response = service.delete_backup_policy_plan( + backup_policy_id=backup_policy_id, + id=backup_policy_plan_id, + if_match=etag + ) + return response + +def delete_backup_policy(service, backup_policy_id, etag): + response = service.delete_backup_policy( + id=backup_policy_id, + if_match=etag + ) + return response +# -------------------------------------------------------- # list_images() # -------------------------------------------------------- @@ -2317,6 +2589,139 @@ def update_instance_volume_attachment(service, instance_id, id): ) return response +def list_vpn_servers(service): + vpn_server_collection = service.list_vpn_servers( + sort='name' + ) + return vpn_server_collection + +def create_vpn_server(service, subnetId): + name = generate_name('vpnserver') + certificate_instance_identity_model = { + 'crn': 'crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5', + } + + vpn_server_authentication_by_username_id_provider_model = { + 'provider_type': 'iam', + } + + vpn_server_authentication_prototype_model = { + 'method': 'certificate', + 'identity_provider': vpn_server_authentication_by_username_id_provider_model, + } + + subnet_identity_model = { + 'id': subnetId, + } + + vpn_server = service.create_vpn_server( + certificate=certificate_instance_identity_model, + client_authentication=[vpn_server_authentication_prototype_model], + client_ip_pool='172.16.0.0/16', + subnets=[subnet_identity_model], + name=name + ) + return vpn_server + +def get_vpn_server(service, vpnServerId): + vpn_server = service.get_vpn_server( + id=vpnServerId + ) + return vpn_server + +def update_vpn_server(service, vpnServerId, etag): + vpn_server_patch_model = {} + vpn_server_patch_model['name']=generate_name('vpnserver-updated') + + vpn_server = service.update_vpn_server( + id=vpnServerId, + vpn_server_patch=vpn_server_patch_model, + if_match=etag + ) + return vpn_server + +def get_vpn_server_client_configuration(service, vpnServerId): + vpn_server_client_configuration = service.get_vpn_server_client_configuration( + id=vpnServerId + ) + return vpn_server_client_configuration + +def list_vpn_server_clients(service, vpnServerId): + vpn_server_client_collection = service.list_vpn_server_clients( + vpn_server_id=vpnServerId, + sort='created_at' + ) + return vpn_server_client_collection + +def get_vpn_server_client(service, vpnServerId, vpnServerClientId): + vpn_server_client = service.get_vpn_server_client( + vpn_server_id=vpnServerId, + id=vpnServerClientId + ) + return vpn_server_client + +def disconnect_vpn_client(service, vpnServerId, vpnServerClientId): + response = service.disconnect_vpn_client( + vpn_server_id=vpnServerId, + id=vpnServerClientId + ) + return response + +def list_vpn_server_routes(service, vpnServerId): + vpn_server_route_collection = service.list_vpn_server_routes( + vpn_server_id=vpnServerId, + sort='name' + ) + return vpn_server_route_collection + +def create_vpn_server_route(service, vpnServerId): + name = generate_name('vpnserver-route') + vpn_server_route = service.create_vpn_server_route( + vpn_server_id=vpnServerId, + destination='172.16.0.0/16', + name=name + ) + return vpn_server_route + + +def get_vpn_server_route(service, vpnServerId, vpnServerRouteId): + vpn_server_route = service.get_vpn_server_route( + vpn_server_id=vpnServerId, + id=vpnServerRouteId + ) + return vpn_server_route + +def update_vpn_server_route(service, vpnServerId, vpnServerRouteId): + vpn_server_route_patch_model = {} + vpn_server_route_patch_model['name'] = 'my-vpnserver-route-updated' + vpn_server_route = service.update_vpn_server_route( + vpn_server_id=vpnServerId, + id=vpnServerRouteId, + vpn_server_route_patch=vpn_server_route_patch_model + ) + return vpn_server_route +def delete_vpn_server_route(service, vpnServerId, vpnServerRouteId): + response = service.delete_vpn_server_route( + vpn_server_id=vpnServerId, + id=vpnServerRouteId + ) + return response + +def delete_vpn_server_client(service, vpnServerId, vpnServerClientId): + response = service.delete_vpn_server_client( + vpn_server_id=vpnServerId, + id=vpnServerClientId + ) + return response + +def delete_vpn_server(service, id, etag): + response = service.delete_vpn_server( + id=id, + if_match=etag + ) + return response + + # -------------------------------------------------------- # test_list_load_balancer_profiles_() # -------------------------------------------------------- @@ -3355,8 +3760,6 @@ def update_security_group(service, id): ) return response - - # -------------------------------------------------------- # list_security_group_targets() # -------------------------------------------------------- @@ -3397,7 +3800,6 @@ def create_security_group_target_binding(service, security_group_id, id): security_group_id, id) return response - # -------------------------------------------------------- # list_security_group_rules() # -------------------------------------------------------- @@ -3618,7 +4020,7 @@ def set_subnet_public_gateway(service, id, pgw): return response # -------------------------------------------------------- -# vpc_service() +# service() # -------------------------------------------------------- @@ -5171,21 +5573,34 @@ def delete_placement_group(service, pgid): # Utils # -------------------------------------------------------- + def generate_name(r_type): names = ("cloudy", "jumble", "lavender", "mayfly", "green", "yellow", "fox", "unrest", "red", "windy", "foggy", "hatchet", "mushily", "beach", "slacker") return "psdk-" + names[random.randint(0, len(names) - 1)] + "-" + r_type + def assertListResponse(output, rType): response = output.get_result() assert output.status_code == 200 assert response[rType] is not None +# + +def assertGetNameResponse(output): + response = output.get_result() + assert output.status_code == 200 + # assert response['name'] is not None + assert response['name'] is not None + def assertGetPatchResponse(output): response = output.get_result() assert output.status_code == 200 # assert response['name'] is not None assert response['id'] is not None +def assertGetResponse(output): + response = output.get_result() + assert output.status_code == 200 def assertCreateResponse(output): response = output.get_result() @@ -5197,3 +5612,7 @@ def assertCreateResponse(output): def assertDeleteResponse(output): response = output.get_result() assert output.status_code == 204 + +def assertDeleteRequestAcceptedResponse(output): + response = output.get_result() + assert output.status_code == 202 diff --git a/test/unit/test_vpc_v1.py b/test/unit/test_vpc_v1.py index dc33a60..cbcbd87 100644 --- a/test/unit/test_vpc_v1.py +++ b/test/unit/test_vpc_v1.py @@ -684,7 +684,7 @@ def test_get_vpc_default_routing_table_all_params(self): """ # Set up mock url = preprocess_url('/vpcs/testString/default_routing_table') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "milled-easy-equine-machines", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}' + mock_response = '{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "milled-easy-equine-machines", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}' responses.add(responses.GET, url, body=mock_response, @@ -720,7 +720,7 @@ def test_get_vpc_default_routing_table_value_error(self): """ # Set up mock url = preprocess_url('/vpcs/testString/default_routing_table') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "milled-easy-equine-machines", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}' + mock_response = '{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "milled-easy-equine-machines", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}' responses.add(responses.GET, url, body=mock_response, @@ -1319,7 +1319,7 @@ def test_list_vpc_routes_all_params(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routes') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}' + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -1367,7 +1367,7 @@ def test_list_vpc_routes_required_params(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routes') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}' + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -1403,7 +1403,7 @@ def test_list_vpc_routes_value_error(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routes') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}' + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -1444,7 +1444,7 @@ def test_create_vpc_route_all_params(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routes') - mock_response = '{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + mock_response = '{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' responses.add(responses.POST, url, body=mock_response, @@ -1455,17 +1455,17 @@ def test_create_vpc_route_all_params(self): zone_identity_model = {} zone_identity_model['name'] = 'us-south-1' - # Construct a dict representation of a RouteNextHopPrototypeRouteNextHopIP model - route_next_hop_prototype_model = {} - route_next_hop_prototype_model['address'] = '192.168.3.4' + # Construct a dict representation of a RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + route_prototype_next_hop_model = {} + route_prototype_next_hop_model['address'] = '192.168.3.4' # Set up parameter values vpc_id = 'testString' destination = '192.168.3.0/24' zone = zone_identity_model action = 'deliver' - name = 'my-route-2' - next_hop = route_next_hop_prototype_model + name = 'my-route-1' + next_hop = route_prototype_next_hop_model # Invoke method response = _service.create_vpc_route( @@ -1486,8 +1486,8 @@ def test_create_vpc_route_all_params(self): assert req_body['destination'] == '192.168.3.0/24' assert req_body['zone'] == zone_identity_model assert req_body['action'] == 'deliver' - assert req_body['name'] == 'my-route-2' - assert req_body['next_hop'] == route_next_hop_prototype_model + assert req_body['name'] == 'my-route-1' + assert req_body['next_hop'] == route_prototype_next_hop_model def test_create_vpc_route_all_params_with_retries(self): # Enable retries and run test_create_vpc_route_all_params. @@ -1505,7 +1505,7 @@ def test_create_vpc_route_value_error(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routes') - mock_response = '{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + mock_response = '{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' responses.add(responses.POST, url, body=mock_response, @@ -1516,17 +1516,17 @@ def test_create_vpc_route_value_error(self): zone_identity_model = {} zone_identity_model['name'] = 'us-south-1' - # Construct a dict representation of a RouteNextHopPrototypeRouteNextHopIP model - route_next_hop_prototype_model = {} - route_next_hop_prototype_model['address'] = '192.168.3.4' + # Construct a dict representation of a RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + route_prototype_next_hop_model = {} + route_prototype_next_hop_model['address'] = '192.168.3.4' # Set up parameter values vpc_id = 'testString' destination = '192.168.3.0/24' zone = zone_identity_model action = 'deliver' - name = 'my-route-2' - next_hop = route_next_hop_prototype_model + name = 'my-route-1' + next_hop = route_prototype_next_hop_model # Pass in all but one required param and check for a ValueError req_param_dict = { @@ -1636,7 +1636,7 @@ def test_get_vpc_route_all_params(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routes/testString') - mock_response = '{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + mock_response = '{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' responses.add(responses.GET, url, body=mock_response, @@ -1674,7 +1674,7 @@ def test_get_vpc_route_value_error(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routes/testString') - mock_response = '{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + mock_response = '{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' responses.add(responses.GET, url, body=mock_response, @@ -1717,7 +1717,7 @@ def test_update_vpc_route_all_params(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routes/testString') - mock_response = '{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + mock_response = '{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' responses.add(responses.PATCH, url, body=mock_response, @@ -1764,7 +1764,7 @@ def test_update_vpc_route_value_error(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routes/testString') - mock_response = '{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + mock_response = '{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' responses.add(responses.PATCH, url, body=mock_response, @@ -1813,7 +1813,7 @@ def test_list_vpc_routing_tables_all_params(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routing_tables') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "routing_tables": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}' + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "routing_tables": [{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -1861,7 +1861,7 @@ def test_list_vpc_routing_tables_required_params(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routing_tables') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "routing_tables": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}' + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "routing_tables": [{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -1897,7 +1897,7 @@ def test_list_vpc_routing_tables_value_error(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routing_tables') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "routing_tables": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}' + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "routing_tables": [{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -1938,16 +1938,20 @@ def test_create_vpc_routing_table_all_params(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routing_tables') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}' + mock_response = '{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) - # Construct a dict representation of a RouteNextHopPrototypeRouteNextHopIP model - route_next_hop_prototype_model = {} - route_next_hop_prototype_model['address'] = '192.168.3.4' + # Construct a dict representation of a ResourceFilter model + resource_filter_model = {} + resource_filter_model['resource_type'] = 'vpn_server' + + # Construct a dict representation of a RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + route_prototype_next_hop_model = {} + route_prototype_next_hop_model['address'] = '192.168.3.4' # Construct a dict representation of a ZoneIdentityByName model zone_identity_model = {} @@ -1957,12 +1961,13 @@ def test_create_vpc_routing_table_all_params(self): route_prototype_model = {} route_prototype_model['action'] = 'deliver' route_prototype_model['destination'] = '192.168.3.0/24' - route_prototype_model['name'] = 'my-route-2' - route_prototype_model['next_hop'] = route_next_hop_prototype_model + route_prototype_model['name'] = 'my-route-1' + route_prototype_model['next_hop'] = route_prototype_next_hop_model route_prototype_model['zone'] = zone_identity_model # Set up parameter values vpc_id = 'testString' + accept_routes_from = [resource_filter_model] name = 'my-routing-table-2' route_direct_link_ingress = False route_transit_gateway_ingress = False @@ -1972,6 +1977,7 @@ def test_create_vpc_routing_table_all_params(self): # Invoke method response = _service.create_vpc_routing_table( vpc_id, + accept_routes_from=accept_routes_from, name=name, route_direct_link_ingress=route_direct_link_ingress, route_transit_gateway_ingress=route_transit_gateway_ingress, @@ -1985,6 +1991,7 @@ def test_create_vpc_routing_table_all_params(self): assert response.status_code == 201 # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['accept_routes_from'] == [resource_filter_model] assert req_body['name'] == 'my-routing-table-2' assert req_body['route_direct_link_ingress'] == False assert req_body['route_transit_gateway_ingress'] == False @@ -2007,16 +2014,20 @@ def test_create_vpc_routing_table_value_error(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routing_tables') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}' + mock_response = '{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) - # Construct a dict representation of a RouteNextHopPrototypeRouteNextHopIP model - route_next_hop_prototype_model = {} - route_next_hop_prototype_model['address'] = '192.168.3.4' + # Construct a dict representation of a ResourceFilter model + resource_filter_model = {} + resource_filter_model['resource_type'] = 'vpn_server' + + # Construct a dict representation of a RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + route_prototype_next_hop_model = {} + route_prototype_next_hop_model['address'] = '192.168.3.4' # Construct a dict representation of a ZoneIdentityByName model zone_identity_model = {} @@ -2026,12 +2037,13 @@ def test_create_vpc_routing_table_value_error(self): route_prototype_model = {} route_prototype_model['action'] = 'deliver' route_prototype_model['destination'] = '192.168.3.0/24' - route_prototype_model['name'] = 'my-route-2' - route_prototype_model['next_hop'] = route_next_hop_prototype_model + route_prototype_model['name'] = 'my-route-1' + route_prototype_model['next_hop'] = route_prototype_next_hop_model route_prototype_model['zone'] = zone_identity_model # Set up parameter values vpc_id = 'testString' + accept_routes_from = [resource_filter_model] name = 'my-routing-table-2' route_direct_link_ingress = False route_transit_gateway_ingress = False @@ -2076,11 +2088,13 @@ def test_delete_vpc_routing_table_all_params(self): # Set up parameter values vpc_id = 'testString' id = 'testString' + if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"' # Invoke method response = _service.delete_vpc_routing_table( vpc_id, id, + if_match=if_match, headers={} ) @@ -2097,6 +2111,41 @@ def test_delete_vpc_routing_table_all_params_with_retries(self): _service.disable_retries() self.test_delete_vpc_routing_table_all_params() + @responses.activate + def test_delete_vpc_routing_table_required_params(self): + """ + test_delete_vpc_routing_table_required_params() + """ + # Set up mock + url = preprocess_url('/vpcs/testString/routing_tables/testString') + responses.add(responses.DELETE, + url, + status=204) + + # Set up parameter values + vpc_id = 'testString' + id = 'testString' + + # Invoke method + response = _service.delete_vpc_routing_table( + vpc_id, + id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 204 + + def test_delete_vpc_routing_table_required_params_with_retries(self): + # Enable retries and run test_delete_vpc_routing_table_required_params. + _service.enable_retries() + self.test_delete_vpc_routing_table_required_params() + + # Disable retries and run test_delete_vpc_routing_table_required_params. + _service.disable_retries() + self.test_delete_vpc_routing_table_required_params() + @responses.activate def test_delete_vpc_routing_table_value_error(self): """ @@ -2144,7 +2193,7 @@ def test_get_vpc_routing_table_all_params(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routing_tables/testString') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}' + mock_response = '{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}' responses.add(responses.GET, url, body=mock_response, @@ -2182,7 +2231,7 @@ def test_get_vpc_routing_table_value_error(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routing_tables/testString') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}' + mock_response = '{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}' responses.add(responses.GET, url, body=mock_response, @@ -2225,15 +2274,20 @@ def test_update_vpc_routing_table_all_params(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routing_tables/testString') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}' + mock_response = '{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}' responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) + # Construct a dict representation of a ResourceFilter model + resource_filter_model = {} + resource_filter_model['resource_type'] = 'vpn_server' + # Construct a dict representation of a RoutingTablePatch model routing_table_patch_model = {} + routing_table_patch_model['accept_routes_from'] = [resource_filter_model] routing_table_patch_model['name'] = 'my-routing-table-2' routing_table_patch_model['route_direct_link_ingress'] = True routing_table_patch_model['route_transit_gateway_ingress'] = True @@ -2243,12 +2297,14 @@ def test_update_vpc_routing_table_all_params(self): vpc_id = 'testString' id = 'testString' routing_table_patch = routing_table_patch_model + if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"' # Invoke method response = _service.update_vpc_routing_table( vpc_id, id, routing_table_patch, + if_match=if_match, headers={} ) @@ -2268,6 +2324,61 @@ def test_update_vpc_routing_table_all_params_with_retries(self): _service.disable_retries() self.test_update_vpc_routing_table_all_params() + @responses.activate + def test_update_vpc_routing_table_required_params(self): + """ + test_update_vpc_routing_table_required_params() + """ + # Set up mock + url = preprocess_url('/vpcs/testString/routing_tables/testString') + mock_response = '{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}' + responses.add(responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Construct a dict representation of a ResourceFilter model + resource_filter_model = {} + resource_filter_model['resource_type'] = 'vpn_server' + + # Construct a dict representation of a RoutingTablePatch model + routing_table_patch_model = {} + routing_table_patch_model['accept_routes_from'] = [resource_filter_model] + routing_table_patch_model['name'] = 'my-routing-table-2' + routing_table_patch_model['route_direct_link_ingress'] = True + routing_table_patch_model['route_transit_gateway_ingress'] = True + routing_table_patch_model['route_vpc_zone_ingress'] = True + + # Set up parameter values + vpc_id = 'testString' + id = 'testString' + routing_table_patch = routing_table_patch_model + + # Invoke method + response = _service.update_vpc_routing_table( + vpc_id, + id, + routing_table_patch, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body == routing_table_patch + + def test_update_vpc_routing_table_required_params_with_retries(self): + # Enable retries and run test_update_vpc_routing_table_required_params. + _service.enable_retries() + self.test_update_vpc_routing_table_required_params() + + # Disable retries and run test_update_vpc_routing_table_required_params. + _service.disable_retries() + self.test_update_vpc_routing_table_required_params() + @responses.activate def test_update_vpc_routing_table_value_error(self): """ @@ -2275,15 +2386,20 @@ def test_update_vpc_routing_table_value_error(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routing_tables/testString') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}' + mock_response = '{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}' responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) + # Construct a dict representation of a ResourceFilter model + resource_filter_model = {} + resource_filter_model['resource_type'] = 'vpn_server' + # Construct a dict representation of a RoutingTablePatch model routing_table_patch_model = {} + routing_table_patch_model['accept_routes_from'] = [resource_filter_model] routing_table_patch_model['name'] = 'my-routing-table-2' routing_table_patch_model['route_direct_link_ingress'] = True routing_table_patch_model['route_transit_gateway_ingress'] = True @@ -2327,7 +2443,7 @@ def test_list_vpc_routing_table_routes_all_params(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routing_tables/testString/routes') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}' + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -2374,7 +2490,7 @@ def test_list_vpc_routing_table_routes_required_params(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routing_tables/testString/routes') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}' + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -2412,7 +2528,7 @@ def test_list_vpc_routing_table_routes_value_error(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routing_tables/testString/routes') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}' + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -2455,7 +2571,7 @@ def test_create_vpc_routing_table_route_all_params(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routing_tables/testString/routes') - mock_response = '{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + mock_response = '{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' responses.add(responses.POST, url, body=mock_response, @@ -2466,9 +2582,9 @@ def test_create_vpc_routing_table_route_all_params(self): zone_identity_model = {} zone_identity_model['name'] = 'us-south-1' - # Construct a dict representation of a RouteNextHopPrototypeRouteNextHopIP model - route_next_hop_prototype_model = {} - route_next_hop_prototype_model['address'] = '192.168.3.4' + # Construct a dict representation of a RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + route_prototype_next_hop_model = {} + route_prototype_next_hop_model['address'] = '192.168.3.4' # Set up parameter values vpc_id = 'testString' @@ -2476,8 +2592,8 @@ def test_create_vpc_routing_table_route_all_params(self): destination = '192.168.3.0/24' zone = zone_identity_model action = 'deliver' - name = 'my-route-2' - next_hop = route_next_hop_prototype_model + name = 'my-route-1' + next_hop = route_prototype_next_hop_model # Invoke method response = _service.create_vpc_routing_table_route( @@ -2499,8 +2615,8 @@ def test_create_vpc_routing_table_route_all_params(self): assert req_body['destination'] == '192.168.3.0/24' assert req_body['zone'] == zone_identity_model assert req_body['action'] == 'deliver' - assert req_body['name'] == 'my-route-2' - assert req_body['next_hop'] == route_next_hop_prototype_model + assert req_body['name'] == 'my-route-1' + assert req_body['next_hop'] == route_prototype_next_hop_model def test_create_vpc_routing_table_route_all_params_with_retries(self): # Enable retries and run test_create_vpc_routing_table_route_all_params. @@ -2518,7 +2634,7 @@ def test_create_vpc_routing_table_route_value_error(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routing_tables/testString/routes') - mock_response = '{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + mock_response = '{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' responses.add(responses.POST, url, body=mock_response, @@ -2529,9 +2645,9 @@ def test_create_vpc_routing_table_route_value_error(self): zone_identity_model = {} zone_identity_model['name'] = 'us-south-1' - # Construct a dict representation of a RouteNextHopPrototypeRouteNextHopIP model - route_next_hop_prototype_model = {} - route_next_hop_prototype_model['address'] = '192.168.3.4' + # Construct a dict representation of a RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + route_prototype_next_hop_model = {} + route_prototype_next_hop_model['address'] = '192.168.3.4' # Set up parameter values vpc_id = 'testString' @@ -2539,8 +2655,8 @@ def test_create_vpc_routing_table_route_value_error(self): destination = '192.168.3.0/24' zone = zone_identity_model action = 'deliver' - name = 'my-route-2' - next_hop = route_next_hop_prototype_model + name = 'my-route-1' + next_hop = route_prototype_next_hop_model # Pass in all but one required param and check for a ValueError req_param_dict = { @@ -2655,7 +2771,7 @@ def test_get_vpc_routing_table_route_all_params(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routing_tables/testString/routes/testString') - mock_response = '{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + mock_response = '{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' responses.add(responses.GET, url, body=mock_response, @@ -2695,7 +2811,7 @@ def test_get_vpc_routing_table_route_value_error(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routing_tables/testString/routes/testString') - mock_response = '{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + mock_response = '{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' responses.add(responses.GET, url, body=mock_response, @@ -2740,7 +2856,7 @@ def test_update_vpc_routing_table_route_all_params(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routing_tables/testString/routes/testString') - mock_response = '{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + mock_response = '{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' responses.add(responses.PATCH, url, body=mock_response, @@ -2789,7 +2905,7 @@ def test_update_vpc_routing_table_route_value_error(self): """ # Set up mock url = preprocess_url('/vpcs/testString/routing_tables/testString/routes/testString') - mock_response = '{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + mock_response = '{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' responses.add(responses.PATCH, url, body=mock_response, @@ -3845,7 +3961,7 @@ def test_get_subnet_routing_table_all_params(self): """ # Set up mock url = preprocess_url('/subnets/testString/routing_table') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}' + mock_response = '{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}' responses.add(responses.GET, url, body=mock_response, @@ -3881,7 +3997,7 @@ def test_get_subnet_routing_table_value_error(self): """ # Set up mock url = preprocess_url('/subnets/testString/routing_table') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}' + mock_response = '{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}' responses.add(responses.GET, url, body=mock_response, @@ -3922,7 +4038,7 @@ def test_replace_subnet_routing_table_all_params(self): """ # Set up mock url = preprocess_url('/subnets/testString/routing_table') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}' + mock_response = '{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}' responses.add(responses.PUT, url, body=mock_response, @@ -3967,7 +4083,7 @@ def test_replace_subnet_routing_table_value_error(self): """ # Set up mock url = preprocess_url('/subnets/testString/routing_table') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}' + mock_response = '{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": true, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": false, "route_transit_gateway_ingress": false, "route_vpc_zone_ingress": true, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}' responses.add(responses.PUT, url, body=mock_response, @@ -13338,7 +13454,7 @@ def test_update_dedicated_host_value_error_with_retries(self): ############################################################################## ############################################################################## -# Start of Service: PlacementGroups +# Start of Service: BackupPolicies ############################################################################## # region @@ -13386,19 +13502,19 @@ def test_new_instance_required_param_none(self): service = VpcV1.new_instance( version=None, ) -class TestListPlacementGroups(): +class TestListBackupPolicies(): """ - Test Class for list_placement_groups + Test Class for list_backup_policies """ @responses.activate - def test_list_placement_groups_all_params(self): + def test_list_backup_policies_all_params(self): """ - list_placement_groups() + list_backup_policies() """ # Set up mock - url = preprocess_url('/placement_groups') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "placement_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}], "total_count": 132}' + url = preprocess_url('/backup_policies') + mock_response = '{"backup_policies": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_resource_types": ["volume"], "match_user_tags": ["match_user_tags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy"}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -13408,11 +13524,17 @@ def test_list_placement_groups_all_params(self): # Set up parameter values start = 'testString' limit = 1 + resource_group_id = 'testString' + name = 'testString' + tag = 'testString' # Invoke method - response = _service.list_placement_groups( + response = _service.list_backup_policies( start=start, limit=limit, + resource_group_id=resource_group_id, + name=name, + tag=tag, headers={} ) @@ -13424,24 +13546,27 @@ def test_list_placement_groups_all_params(self): query_string = urllib.parse.unquote_plus(query_string) assert 'start={}'.format(start) in query_string assert 'limit={}'.format(limit) in query_string + assert 'resource_group.id={}'.format(resource_group_id) in query_string + assert 'name={}'.format(name) in query_string + assert 'tag={}'.format(tag) in query_string - def test_list_placement_groups_all_params_with_retries(self): - # Enable retries and run test_list_placement_groups_all_params. + def test_list_backup_policies_all_params_with_retries(self): + # Enable retries and run test_list_backup_policies_all_params. _service.enable_retries() - self.test_list_placement_groups_all_params() + self.test_list_backup_policies_all_params() - # Disable retries and run test_list_placement_groups_all_params. + # Disable retries and run test_list_backup_policies_all_params. _service.disable_retries() - self.test_list_placement_groups_all_params() + self.test_list_backup_policies_all_params() @responses.activate - def test_list_placement_groups_required_params(self): + def test_list_backup_policies_required_params(self): """ - test_list_placement_groups_required_params() + test_list_backup_policies_required_params() """ # Set up mock - url = preprocess_url('/placement_groups') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "placement_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}], "total_count": 132}' + url = preprocess_url('/backup_policies') + mock_response = '{"backup_policies": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_resource_types": ["volume"], "match_user_tags": ["match_user_tags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy"}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -13449,30 +13574,30 @@ def test_list_placement_groups_required_params(self): status=200) # Invoke method - response = _service.list_placement_groups() + response = _service.list_backup_policies() # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 - def test_list_placement_groups_required_params_with_retries(self): - # Enable retries and run test_list_placement_groups_required_params. + def test_list_backup_policies_required_params_with_retries(self): + # Enable retries and run test_list_backup_policies_required_params. _service.enable_retries() - self.test_list_placement_groups_required_params() + self.test_list_backup_policies_required_params() - # Disable retries and run test_list_placement_groups_required_params. + # Disable retries and run test_list_backup_policies_required_params. _service.disable_retries() - self.test_list_placement_groups_required_params() + self.test_list_backup_policies_required_params() @responses.activate - def test_list_placement_groups_value_error(self): + def test_list_backup_policies_value_error(self): """ - test_list_placement_groups_value_error() + test_list_backup_policies_value_error() """ # Set up mock - url = preprocess_url('/placement_groups') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "placement_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}], "total_count": 132}' + url = preprocess_url('/backup_policies') + mock_response = '{"backup_policies": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_resource_types": ["volume"], "match_user_tags": ["match_user_tags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy"}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -13485,50 +13610,68 @@ def test_list_placement_groups_value_error(self): for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_placement_groups(**req_copy) + _service.list_backup_policies(**req_copy) - def test_list_placement_groups_value_error_with_retries(self): - # Enable retries and run test_list_placement_groups_value_error. + def test_list_backup_policies_value_error_with_retries(self): + # Enable retries and run test_list_backup_policies_value_error. _service.enable_retries() - self.test_list_placement_groups_value_error() + self.test_list_backup_policies_value_error() - # Disable retries and run test_list_placement_groups_value_error. + # Disable retries and run test_list_backup_policies_value_error. _service.disable_retries() - self.test_list_placement_groups_value_error() + self.test_list_backup_policies_value_error() -class TestCreatePlacementGroup(): +class TestCreateBackupPolicy(): """ - Test Class for create_placement_group + Test Class for create_backup_policy """ @responses.activate - def test_create_placement_group_all_params(self): + def test_create_backup_policy_all_params(self): """ - create_placement_group() + create_backup_policy() """ # Set up mock - url = preprocess_url('/placement_groups') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}' + url = preprocess_url('/backup_policies') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_resource_types": ["volume"], "match_user_tags": ["match_user_tags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy"}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) + # Construct a dict representation of a BackupPolicyPlanDeletionTriggerPrototype model + backup_policy_plan_deletion_trigger_prototype_model = {} + backup_policy_plan_deletion_trigger_prototype_model['delete_after'] = 20 + backup_policy_plan_deletion_trigger_prototype_model['delete_over_count'] = 20 + + # Construct a dict representation of a BackupPolicyPlanPrototype model + backup_policy_plan_prototype_model = {} + backup_policy_plan_prototype_model['active'] = True + backup_policy_plan_prototype_model['attach_user_tags'] = ['my-daily-backup-plan'] + backup_policy_plan_prototype_model['copy_user_tags'] = True + backup_policy_plan_prototype_model['cron_spec'] = '*/5 1,2,3 * * *' + backup_policy_plan_prototype_model['deletion_trigger'] = backup_policy_plan_deletion_trigger_prototype_model + backup_policy_plan_prototype_model['name'] = 'my-policy-plan' + # Construct a dict representation of a ResourceGroupIdentityById model resource_group_identity_model = {} resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' # Set up parameter values - strategy = 'host_spread' - name = 'my-placement-group' + match_user_tags = ['my-daily-backup-policy'] + match_resource_types = ['volume'] + name = 'my-backup-policy' + plans = [backup_policy_plan_prototype_model] resource_group = resource_group_identity_model # Invoke method - response = _service.create_placement_group( - strategy, + response = _service.create_backup_policy( + match_user_tags=match_user_tags, + match_resource_types=match_resource_types, name=name, + plans=plans, resource_group=resource_group, headers={} ) @@ -13538,145 +13681,139 @@ def test_create_placement_group_all_params(self): assert response.status_code == 201 # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body['strategy'] == 'host_spread' - assert req_body['name'] == 'my-placement-group' + assert req_body['match_user_tags'] == ['my-daily-backup-policy'] + assert req_body['match_resource_types'] == ['volume'] + assert req_body['name'] == 'my-backup-policy' + assert req_body['plans'] == [backup_policy_plan_prototype_model] assert req_body['resource_group'] == resource_group_identity_model - def test_create_placement_group_all_params_with_retries(self): - # Enable retries and run test_create_placement_group_all_params. + def test_create_backup_policy_all_params_with_retries(self): + # Enable retries and run test_create_backup_policy_all_params. _service.enable_retries() - self.test_create_placement_group_all_params() + self.test_create_backup_policy_all_params() - # Disable retries and run test_create_placement_group_all_params. + # Disable retries and run test_create_backup_policy_all_params. _service.disable_retries() - self.test_create_placement_group_all_params() + self.test_create_backup_policy_all_params() @responses.activate - def test_create_placement_group_value_error(self): + def test_create_backup_policy_required_params(self): """ - test_create_placement_group_value_error() + test_create_backup_policy_required_params() """ # Set up mock - url = preprocess_url('/placement_groups') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}' + url = preprocess_url('/backup_policies') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_resource_types": ["volume"], "match_user_tags": ["match_user_tags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy"}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) - # Construct a dict representation of a ResourceGroupIdentityById model - resource_group_identity_model = {} - resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + # Invoke method + response = _service.create_backup_policy() - # Set up parameter values - strategy = 'host_spread' - name = 'my-placement-group' - resource_group = resource_group_identity_model + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 201 + + def test_create_backup_policy_required_params_with_retries(self): + # Enable retries and run test_create_backup_policy_required_params. + _service.enable_retries() + self.test_create_backup_policy_required_params() + + # Disable retries and run test_create_backup_policy_required_params. + _service.disable_retries() + self.test_create_backup_policy_required_params() + + @responses.activate + def test_create_backup_policy_value_error(self): + """ + test_create_backup_policy_value_error() + """ + # Set up mock + url = preprocess_url('/backup_policies') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_resource_types": ["volume"], "match_user_tags": ["match_user_tags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy"}' + responses.add(responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201) # Pass in all but one required param and check for a ValueError req_param_dict = { - "strategy": strategy, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.create_placement_group(**req_copy) + _service.create_backup_policy(**req_copy) - def test_create_placement_group_value_error_with_retries(self): - # Enable retries and run test_create_placement_group_value_error. + def test_create_backup_policy_value_error_with_retries(self): + # Enable retries and run test_create_backup_policy_value_error. _service.enable_retries() - self.test_create_placement_group_value_error() + self.test_create_backup_policy_value_error() - # Disable retries and run test_create_placement_group_value_error. + # Disable retries and run test_create_backup_policy_value_error. _service.disable_retries() - self.test_create_placement_group_value_error() + self.test_create_backup_policy_value_error() -class TestDeletePlacementGroup(): +class TestListBackupPolicyPlans(): """ - Test Class for delete_placement_group + Test Class for list_backup_policy_plans """ @responses.activate - def test_delete_placement_group_all_params(self): + def test_list_backup_policy_plans_all_params(self): """ - delete_placement_group() + list_backup_policy_plans() """ # Set up mock - url = preprocess_url('/placement_groups/testString') - responses.add(responses.DELETE, + url = preprocess_url('/backup_policies/testString/plans') + mock_response = '{"plans": [{"active": true, "attach_user_tags": ["attach_user_tags"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}]}' + responses.add(responses.GET, url, - status=202) + body=mock_response, + content_type='application/json', + status=200) # Set up parameter values - id = 'testString' + backup_policy_id = 'testString' + name = 'testString' # Invoke method - response = _service.delete_placement_group( - id, + response = _service.list_backup_policy_plans( + backup_policy_id, + name=name, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 202 - - def test_delete_placement_group_all_params_with_retries(self): - # Enable retries and run test_delete_placement_group_all_params. - _service.enable_retries() - self.test_delete_placement_group_all_params() - - # Disable retries and run test_delete_placement_group_all_params. - _service.disable_retries() - self.test_delete_placement_group_all_params() - - @responses.activate - def test_delete_placement_group_value_error(self): - """ - test_delete_placement_group_value_error() - """ - # Set up mock - url = preprocess_url('/placement_groups/testString') - responses.add(responses.DELETE, - url, - status=202) - - # Set up parameter values - id = 'testString' - - # Pass in all but one required param and check for a ValueError - req_param_dict = { - "id": id, - } - for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} - with pytest.raises(ValueError): - _service.delete_placement_group(**req_copy) - + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?',1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'name={}'.format(name) in query_string - def test_delete_placement_group_value_error_with_retries(self): - # Enable retries and run test_delete_placement_group_value_error. + def test_list_backup_policy_plans_all_params_with_retries(self): + # Enable retries and run test_list_backup_policy_plans_all_params. _service.enable_retries() - self.test_delete_placement_group_value_error() + self.test_list_backup_policy_plans_all_params() - # Disable retries and run test_delete_placement_group_value_error. + # Disable retries and run test_list_backup_policy_plans_all_params. _service.disable_retries() - self.test_delete_placement_group_value_error() - -class TestGetPlacementGroup(): - """ - Test Class for get_placement_group - """ + self.test_list_backup_policy_plans_all_params() @responses.activate - def test_get_placement_group_all_params(self): + def test_list_backup_policy_plans_required_params(self): """ - get_placement_group() + test_list_backup_policy_plans_required_params() """ # Set up mock - url = preprocess_url('/placement_groups/testString') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}' + url = preprocess_url('/backup_policies/testString/plans') + mock_response = '{"plans": [{"active": true, "attach_user_tags": ["attach_user_tags"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}]}' responses.add(responses.GET, url, body=mock_response, @@ -13684,11 +13821,11 @@ def test_get_placement_group_all_params(self): status=200) # Set up parameter values - id = 'testString' + backup_policy_id = 'testString' # Invoke method - response = _service.get_placement_group( - id, + response = _service.list_backup_policy_plans( + backup_policy_id, headers={} ) @@ -13696,23 +13833,23 @@ def test_get_placement_group_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 200 - def test_get_placement_group_all_params_with_retries(self): - # Enable retries and run test_get_placement_group_all_params. + def test_list_backup_policy_plans_required_params_with_retries(self): + # Enable retries and run test_list_backup_policy_plans_required_params. _service.enable_retries() - self.test_get_placement_group_all_params() + self.test_list_backup_policy_plans_required_params() - # Disable retries and run test_get_placement_group_all_params. + # Disable retries and run test_list_backup_policy_plans_required_params. _service.disable_retries() - self.test_get_placement_group_all_params() + self.test_list_backup_policy_plans_required_params() @responses.activate - def test_get_placement_group_value_error(self): + def test_list_backup_policy_plans_value_error(self): """ - test_get_placement_group_value_error() + test_list_backup_policy_plans_value_error() """ # Set up mock - url = preprocess_url('/placement_groups/testString') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}' + url = preprocess_url('/backup_policies/testString/plans') + mock_response = '{"plans": [{"active": true, "attach_user_tags": ["attach_user_tags"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}]}' responses.add(responses.GET, url, body=mock_response, @@ -13720,297 +13857,275 @@ def test_get_placement_group_value_error(self): status=200) # Set up parameter values - id = 'testString' + backup_policy_id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "id": id, + "backup_policy_id": backup_policy_id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.get_placement_group(**req_copy) + _service.list_backup_policy_plans(**req_copy) - def test_get_placement_group_value_error_with_retries(self): - # Enable retries and run test_get_placement_group_value_error. + def test_list_backup_policy_plans_value_error_with_retries(self): + # Enable retries and run test_list_backup_policy_plans_value_error. _service.enable_retries() - self.test_get_placement_group_value_error() + self.test_list_backup_policy_plans_value_error() - # Disable retries and run test_get_placement_group_value_error. + # Disable retries and run test_list_backup_policy_plans_value_error. _service.disable_retries() - self.test_get_placement_group_value_error() + self.test_list_backup_policy_plans_value_error() -class TestUpdatePlacementGroup(): +class TestCreateBackupPolicyPlan(): """ - Test Class for update_placement_group + Test Class for create_backup_policy_plan """ @responses.activate - def test_update_placement_group_all_params(self): + def test_create_backup_policy_plan_all_params(self): """ - update_placement_group() + create_backup_policy_plan() """ # Set up mock - url = preprocess_url('/placement_groups/testString') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}' - responses.add(responses.PATCH, + url = preprocess_url('/backup_policies/testString/plans') + mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}' + responses.add(responses.POST, url, body=mock_response, content_type='application/json', - status=200) + status=201) - # Construct a dict representation of a PlacementGroupPatch model - placement_group_patch_model = {} - placement_group_patch_model['name'] = 'my-placement-group' + # Construct a dict representation of a BackupPolicyPlanDeletionTriggerPrototype model + backup_policy_plan_deletion_trigger_prototype_model = {} + backup_policy_plan_deletion_trigger_prototype_model['delete_after'] = 20 + backup_policy_plan_deletion_trigger_prototype_model['delete_over_count'] = 20 # Set up parameter values - id = 'testString' - placement_group_patch = placement_group_patch_model + backup_policy_id = 'testString' + cron_spec = '*/5 1,2,3 * * *' + active = True + attach_user_tags = ['my-daily-backup-plan'] + copy_user_tags = True + deletion_trigger = backup_policy_plan_deletion_trigger_prototype_model + name = 'my-policy-plan' # Invoke method - response = _service.update_placement_group( - id, - placement_group_patch, + response = _service.create_backup_policy_plan( + backup_policy_id, + cron_spec, + active=active, + attach_user_tags=attach_user_tags, + copy_user_tags=copy_user_tags, + deletion_trigger=deletion_trigger, + name=name, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 200 + assert response.status_code == 201 # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == placement_group_patch + assert req_body['cron_spec'] == '*/5 1,2,3 * * *' + assert req_body['active'] == True + assert req_body['attach_user_tags'] == ['my-daily-backup-plan'] + assert req_body['copy_user_tags'] == True + assert req_body['deletion_trigger'] == backup_policy_plan_deletion_trigger_prototype_model + assert req_body['name'] == 'my-policy-plan' - def test_update_placement_group_all_params_with_retries(self): - # Enable retries and run test_update_placement_group_all_params. + def test_create_backup_policy_plan_all_params_with_retries(self): + # Enable retries and run test_create_backup_policy_plan_all_params. _service.enable_retries() - self.test_update_placement_group_all_params() + self.test_create_backup_policy_plan_all_params() - # Disable retries and run test_update_placement_group_all_params. + # Disable retries and run test_create_backup_policy_plan_all_params. _service.disable_retries() - self.test_update_placement_group_all_params() + self.test_create_backup_policy_plan_all_params() @responses.activate - def test_update_placement_group_value_error(self): + def test_create_backup_policy_plan_value_error(self): """ - test_update_placement_group_value_error() + test_create_backup_policy_plan_value_error() """ # Set up mock - url = preprocess_url('/placement_groups/testString') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}' - responses.add(responses.PATCH, + url = preprocess_url('/backup_policies/testString/plans') + mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}' + responses.add(responses.POST, url, body=mock_response, content_type='application/json', - status=200) + status=201) - # Construct a dict representation of a PlacementGroupPatch model - placement_group_patch_model = {} - placement_group_patch_model['name'] = 'my-placement-group' + # Construct a dict representation of a BackupPolicyPlanDeletionTriggerPrototype model + backup_policy_plan_deletion_trigger_prototype_model = {} + backup_policy_plan_deletion_trigger_prototype_model['delete_after'] = 20 + backup_policy_plan_deletion_trigger_prototype_model['delete_over_count'] = 20 # Set up parameter values - id = 'testString' - placement_group_patch = placement_group_patch_model + backup_policy_id = 'testString' + cron_spec = '*/5 1,2,3 * * *' + active = True + attach_user_tags = ['my-daily-backup-plan'] + copy_user_tags = True + deletion_trigger = backup_policy_plan_deletion_trigger_prototype_model + name = 'my-policy-plan' # Pass in all but one required param and check for a ValueError req_param_dict = { - "id": id, - "placement_group_patch": placement_group_patch, + "backup_policy_id": backup_policy_id, + "cron_spec": cron_spec, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.update_placement_group(**req_copy) + _service.create_backup_policy_plan(**req_copy) - def test_update_placement_group_value_error_with_retries(self): - # Enable retries and run test_update_placement_group_value_error. + def test_create_backup_policy_plan_value_error_with_retries(self): + # Enable retries and run test_create_backup_policy_plan_value_error. _service.enable_retries() - self.test_update_placement_group_value_error() + self.test_create_backup_policy_plan_value_error() - # Disable retries and run test_update_placement_group_value_error. + # Disable retries and run test_create_backup_policy_plan_value_error. _service.disable_retries() - self.test_update_placement_group_value_error() - -# endregion -############################################################################## -# End of Service: PlacementGroups -############################################################################## + self.test_create_backup_policy_plan_value_error() -############################################################################## -# Start of Service: BareMetalServers -############################################################################## -# region - -class TestNewInstance(): - """ - Test Class for new_instance - """ - - def test_new_instance(self): - """ - new_instance() - """ - os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' - - service = VpcV1.new_instance( - version=version, - service_name='TEST_SERVICE', - ) - - assert service is not None - assert isinstance(service, VpcV1) - - def test_new_instance_without_authenticator(self): - """ - new_instance_without_authenticator() - """ - with pytest.raises(ValueError, match='authenticator must be provided'): - service = VpcV1.new_instance( - version=version, - service_name='TEST_SERVICE_NOT_FOUND', - ) - - def test_new_instance_without_required_params(self): - """ - new_instance_without_required_params() - """ - with pytest.raises(TypeError, match='new_instance\\(\\) missing \\d required positional arguments?: \'.*\''): - service = VpcV1.new_instance() - - def test_new_instance_required_param_none(self): - """ - new_instance_required_param_none() - """ - with pytest.raises(ValueError, match='version must be provided'): - service = VpcV1.new_instance( - version=None, - ) -class TestListBareMetalServerProfiles(): +class TestDeleteBackupPolicyPlan(): """ - Test Class for list_bare_metal_server_profiles + Test Class for delete_backup_policy_plan """ @responses.activate - def test_list_bare_metal_server_profiles_all_params(self): + def test_delete_backup_policy_plan_all_params(self): """ - list_bare_metal_server_profiles() + delete_backup_policy_plan() """ # Set up mock - url = preprocess_url('/bare_metal_server/profiles') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}], "total_count": 132}' - responses.add(responses.GET, + url = preprocess_url('/backup_policies/testString/plans/testString') + mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}' + responses.add(responses.DELETE, url, body=mock_response, content_type='application/json', - status=200) + status=202) # Set up parameter values - start = 'testString' - limit = 1 + backup_policy_id = 'testString' + id = 'testString' + if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"' # Invoke method - response = _service.list_bare_metal_server_profiles( - start=start, - limit=limit, + response = _service.delete_backup_policy_plan( + backup_policy_id, + id, + if_match=if_match, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 200 - # Validate query params - query_string = responses.calls[0].request.url.split('?',1)[1] - query_string = urllib.parse.unquote_plus(query_string) - assert 'start={}'.format(start) in query_string - assert 'limit={}'.format(limit) in query_string + assert response.status_code == 202 - def test_list_bare_metal_server_profiles_all_params_with_retries(self): - # Enable retries and run test_list_bare_metal_server_profiles_all_params. + def test_delete_backup_policy_plan_all_params_with_retries(self): + # Enable retries and run test_delete_backup_policy_plan_all_params. _service.enable_retries() - self.test_list_bare_metal_server_profiles_all_params() + self.test_delete_backup_policy_plan_all_params() - # Disable retries and run test_list_bare_metal_server_profiles_all_params. + # Disable retries and run test_delete_backup_policy_plan_all_params. _service.disable_retries() - self.test_list_bare_metal_server_profiles_all_params() + self.test_delete_backup_policy_plan_all_params() @responses.activate - def test_list_bare_metal_server_profiles_required_params(self): + def test_delete_backup_policy_plan_required_params(self): """ - test_list_bare_metal_server_profiles_required_params() + test_delete_backup_policy_plan_required_params() """ # Set up mock - url = preprocess_url('/bare_metal_server/profiles') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}], "total_count": 132}' - responses.add(responses.GET, + url = preprocess_url('/backup_policies/testString/plans/testString') + mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}' + responses.add(responses.DELETE, url, body=mock_response, content_type='application/json', - status=200) + status=202) - # Invoke method - response = _service.list_bare_metal_server_profiles() + # Set up parameter values + backup_policy_id = 'testString' + id = 'testString' + # Invoke method + response = _service.delete_backup_policy_plan( + backup_policy_id, + id, + headers={} + ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 200 + assert response.status_code == 202 - def test_list_bare_metal_server_profiles_required_params_with_retries(self): - # Enable retries and run test_list_bare_metal_server_profiles_required_params. + def test_delete_backup_policy_plan_required_params_with_retries(self): + # Enable retries and run test_delete_backup_policy_plan_required_params. _service.enable_retries() - self.test_list_bare_metal_server_profiles_required_params() + self.test_delete_backup_policy_plan_required_params() - # Disable retries and run test_list_bare_metal_server_profiles_required_params. + # Disable retries and run test_delete_backup_policy_plan_required_params. _service.disable_retries() - self.test_list_bare_metal_server_profiles_required_params() + self.test_delete_backup_policy_plan_required_params() @responses.activate - def test_list_bare_metal_server_profiles_value_error(self): + def test_delete_backup_policy_plan_value_error(self): """ - test_list_bare_metal_server_profiles_value_error() + test_delete_backup_policy_plan_value_error() """ # Set up mock - url = preprocess_url('/bare_metal_server/profiles') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}], "total_count": 132}' - responses.add(responses.GET, + url = preprocess_url('/backup_policies/testString/plans/testString') + mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}' + responses.add(responses.DELETE, url, body=mock_response, content_type='application/json', - status=200) + status=202) + + # Set up parameter values + backup_policy_id = 'testString' + id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { + "backup_policy_id": backup_policy_id, + "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_bare_metal_server_profiles(**req_copy) + _service.delete_backup_policy_plan(**req_copy) - def test_list_bare_metal_server_profiles_value_error_with_retries(self): - # Enable retries and run test_list_bare_metal_server_profiles_value_error. + def test_delete_backup_policy_plan_value_error_with_retries(self): + # Enable retries and run test_delete_backup_policy_plan_value_error. _service.enable_retries() - self.test_list_bare_metal_server_profiles_value_error() + self.test_delete_backup_policy_plan_value_error() - # Disable retries and run test_list_bare_metal_server_profiles_value_error. + # Disable retries and run test_delete_backup_policy_plan_value_error. _service.disable_retries() - self.test_list_bare_metal_server_profiles_value_error() + self.test_delete_backup_policy_plan_value_error() -class TestGetBareMetalServerProfile(): +class TestGetBackupPolicyPlan(): """ - Test Class for get_bare_metal_server_profile + Test Class for get_backup_policy_plan """ @responses.activate - def test_get_bare_metal_server_profile_all_params(self): + def test_get_backup_policy_plan_all_params(self): """ - get_bare_metal_server_profile() + get_backup_policy_plan() """ # Set up mock - url = preprocess_url('/bare_metal_server/profiles/testString') - mock_response = '{"bandwidth": {"type": "fixed", "value": 20000}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}' + url = preprocess_url('/backup_policies/testString/plans/testString') + mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}' responses.add(responses.GET, url, body=mock_response, @@ -14018,11 +14133,13 @@ def test_get_bare_metal_server_profile_all_params(self): status=200) # Set up parameter values - name = 'testString' + backup_policy_id = 'testString' + id = 'testString' # Invoke method - response = _service.get_bare_metal_server_profile( - name, + response = _service.get_backup_policy_plan( + backup_policy_id, + id, headers={} ) @@ -14030,23 +14147,23 @@ def test_get_bare_metal_server_profile_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 200 - def test_get_bare_metal_server_profile_all_params_with_retries(self): - # Enable retries and run test_get_bare_metal_server_profile_all_params. + def test_get_backup_policy_plan_all_params_with_retries(self): + # Enable retries and run test_get_backup_policy_plan_all_params. _service.enable_retries() - self.test_get_bare_metal_server_profile_all_params() + self.test_get_backup_policy_plan_all_params() - # Disable retries and run test_get_bare_metal_server_profile_all_params. + # Disable retries and run test_get_backup_policy_plan_all_params. _service.disable_retries() - self.test_get_bare_metal_server_profile_all_params() + self.test_get_backup_policy_plan_all_params() @responses.activate - def test_get_bare_metal_server_profile_value_error(self): + def test_get_backup_policy_plan_value_error(self): """ - test_get_bare_metal_server_profile_value_error() + test_get_backup_policy_plan_value_error() """ # Set up mock - url = preprocess_url('/bare_metal_server/profiles/testString') - mock_response = '{"bandwidth": {"type": "fixed", "value": 20000}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}' + url = preprocess_url('/backup_policies/testString/plans/testString') + mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}' responses.add(responses.GET, url, body=mock_response, @@ -14054,508 +14171,332 @@ def test_get_bare_metal_server_profile_value_error(self): status=200) # Set up parameter values - name = 'testString' + backup_policy_id = 'testString' + id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "name": name, + "backup_policy_id": backup_policy_id, + "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.get_bare_metal_server_profile(**req_copy) + _service.get_backup_policy_plan(**req_copy) - def test_get_bare_metal_server_profile_value_error_with_retries(self): - # Enable retries and run test_get_bare_metal_server_profile_value_error. + def test_get_backup_policy_plan_value_error_with_retries(self): + # Enable retries and run test_get_backup_policy_plan_value_error. _service.enable_retries() - self.test_get_bare_metal_server_profile_value_error() + self.test_get_backup_policy_plan_value_error() - # Disable retries and run test_get_bare_metal_server_profile_value_error. + # Disable retries and run test_get_backup_policy_plan_value_error. _service.disable_retries() - self.test_get_bare_metal_server_profile_value_error() + self.test_get_backup_policy_plan_value_error() -class TestListBareMetalServers(): +class TestUpdateBackupPolicyPlan(): """ - Test Class for list_bare_metal_servers + Test Class for update_backup_policy_plan """ @responses.activate - def test_list_bare_metal_servers_all_params(self): + def test_update_backup_policy_plan_all_params(self): """ - list_bare_metal_servers() + update_backup_policy_plan() """ # Set up mock - url = preprocess_url('/bare_metal_servers') - mock_response = '{"bare_metal_servers": [{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "failed", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}' - responses.add(responses.GET, + url = preprocess_url('/backup_policies/testString/plans/testString') + mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}' + responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) + # Construct a dict representation of a BackupPolicyPlanDeletionTriggerPatch model + backup_policy_plan_deletion_trigger_patch_model = {} + backup_policy_plan_deletion_trigger_patch_model['delete_after'] = 20 + backup_policy_plan_deletion_trigger_patch_model['delete_over_count'] = 38 + + # Construct a dict representation of a BackupPolicyPlanPatch model + backup_policy_plan_patch_model = {} + backup_policy_plan_patch_model['active'] = True + backup_policy_plan_patch_model['attach_user_tags'] = ['my-daily-backup-plan'] + backup_policy_plan_patch_model['copy_user_tags'] = True + backup_policy_plan_patch_model['cron_spec'] = '*/5 1,2,3 * * *' + backup_policy_plan_patch_model['deletion_trigger'] = backup_policy_plan_deletion_trigger_patch_model + backup_policy_plan_patch_model['name'] = 'my-policy-plan' + # Set up parameter values - start = 'testString' - limit = 1 - resource_group_id = 'testString' - name = 'testString' - vpc_id = 'testString' - vpc_crn = 'testString' - vpc_name = 'testString' - network_interfaces_subnet_id = 'testString' - network_interfaces_subnet_crn = 'testString' - network_interfaces_subnet_name = 'testString' + backup_policy_id = 'testString' + id = 'testString' + backup_policy_plan_patch = backup_policy_plan_patch_model + if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"' # Invoke method - response = _service.list_bare_metal_servers( - start=start, - limit=limit, - resource_group_id=resource_group_id, - name=name, - vpc_id=vpc_id, - vpc_crn=vpc_crn, - vpc_name=vpc_name, - network_interfaces_subnet_id=network_interfaces_subnet_id, - network_interfaces_subnet_crn=network_interfaces_subnet_crn, - network_interfaces_subnet_name=network_interfaces_subnet_name, + response = _service.update_backup_policy_plan( + backup_policy_id, + id, + backup_policy_plan_patch, + if_match=if_match, headers={} ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 - # Validate query params - query_string = responses.calls[0].request.url.split('?',1)[1] - query_string = urllib.parse.unquote_plus(query_string) - assert 'start={}'.format(start) in query_string - assert 'limit={}'.format(limit) in query_string - assert 'resource_group.id={}'.format(resource_group_id) in query_string - assert 'name={}'.format(name) in query_string - assert 'vpc.id={}'.format(vpc_id) in query_string - assert 'vpc.crn={}'.format(vpc_crn) in query_string - assert 'vpc.name={}'.format(vpc_name) in query_string - assert 'network_interfaces.subnet.id={}'.format(network_interfaces_subnet_id) in query_string - assert 'network_interfaces.subnet.crn={}'.format(network_interfaces_subnet_crn) in query_string - assert 'network_interfaces.subnet.name={}'.format(network_interfaces_subnet_name) in query_string + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body == backup_policy_plan_patch - def test_list_bare_metal_servers_all_params_with_retries(self): - # Enable retries and run test_list_bare_metal_servers_all_params. + def test_update_backup_policy_plan_all_params_with_retries(self): + # Enable retries and run test_update_backup_policy_plan_all_params. _service.enable_retries() - self.test_list_bare_metal_servers_all_params() + self.test_update_backup_policy_plan_all_params() - # Disable retries and run test_list_bare_metal_servers_all_params. + # Disable retries and run test_update_backup_policy_plan_all_params. _service.disable_retries() - self.test_list_bare_metal_servers_all_params() + self.test_update_backup_policy_plan_all_params() @responses.activate - def test_list_bare_metal_servers_required_params(self): + def test_update_backup_policy_plan_required_params(self): """ - test_list_bare_metal_servers_required_params() + test_update_backup_policy_plan_required_params() """ # Set up mock - url = preprocess_url('/bare_metal_servers') - mock_response = '{"bare_metal_servers": [{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "failed", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}' - responses.add(responses.GET, + url = preprocess_url('/backup_policies/testString/plans/testString') + mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}' + responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) - # Invoke method - response = _service.list_bare_metal_servers() + # Construct a dict representation of a BackupPolicyPlanDeletionTriggerPatch model + backup_policy_plan_deletion_trigger_patch_model = {} + backup_policy_plan_deletion_trigger_patch_model['delete_after'] = 20 + backup_policy_plan_deletion_trigger_patch_model['delete_over_count'] = 38 + + # Construct a dict representation of a BackupPolicyPlanPatch model + backup_policy_plan_patch_model = {} + backup_policy_plan_patch_model['active'] = True + backup_policy_plan_patch_model['attach_user_tags'] = ['my-daily-backup-plan'] + backup_policy_plan_patch_model['copy_user_tags'] = True + backup_policy_plan_patch_model['cron_spec'] = '*/5 1,2,3 * * *' + backup_policy_plan_patch_model['deletion_trigger'] = backup_policy_plan_deletion_trigger_patch_model + backup_policy_plan_patch_model['name'] = 'my-policy-plan' + + # Set up parameter values + backup_policy_id = 'testString' + id = 'testString' + backup_policy_plan_patch = backup_policy_plan_patch_model + # Invoke method + response = _service.update_backup_policy_plan( + backup_policy_id, + id, + backup_policy_plan_patch, + headers={} + ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body == backup_policy_plan_patch - def test_list_bare_metal_servers_required_params_with_retries(self): - # Enable retries and run test_list_bare_metal_servers_required_params. + def test_update_backup_policy_plan_required_params_with_retries(self): + # Enable retries and run test_update_backup_policy_plan_required_params. _service.enable_retries() - self.test_list_bare_metal_servers_required_params() + self.test_update_backup_policy_plan_required_params() - # Disable retries and run test_list_bare_metal_servers_required_params. + # Disable retries and run test_update_backup_policy_plan_required_params. _service.disable_retries() - self.test_list_bare_metal_servers_required_params() + self.test_update_backup_policy_plan_required_params() @responses.activate - def test_list_bare_metal_servers_value_error(self): + def test_update_backup_policy_plan_value_error(self): """ - test_list_bare_metal_servers_value_error() + test_update_backup_policy_plan_value_error() """ # Set up mock - url = preprocess_url('/bare_metal_servers') - mock_response = '{"bare_metal_servers": [{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "failed", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}' - responses.add(responses.GET, + url = preprocess_url('/backup_policies/testString/plans/testString') + mock_response = '{"active": true, "attach_user_tags": ["attach_user_tags"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}' + responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) + # Construct a dict representation of a BackupPolicyPlanDeletionTriggerPatch model + backup_policy_plan_deletion_trigger_patch_model = {} + backup_policy_plan_deletion_trigger_patch_model['delete_after'] = 20 + backup_policy_plan_deletion_trigger_patch_model['delete_over_count'] = 38 + + # Construct a dict representation of a BackupPolicyPlanPatch model + backup_policy_plan_patch_model = {} + backup_policy_plan_patch_model['active'] = True + backup_policy_plan_patch_model['attach_user_tags'] = ['my-daily-backup-plan'] + backup_policy_plan_patch_model['copy_user_tags'] = True + backup_policy_plan_patch_model['cron_spec'] = '*/5 1,2,3 * * *' + backup_policy_plan_patch_model['deletion_trigger'] = backup_policy_plan_deletion_trigger_patch_model + backup_policy_plan_patch_model['name'] = 'my-policy-plan' + + # Set up parameter values + backup_policy_id = 'testString' + id = 'testString' + backup_policy_plan_patch = backup_policy_plan_patch_model + # Pass in all but one required param and check for a ValueError req_param_dict = { + "backup_policy_id": backup_policy_id, + "id": id, + "backup_policy_plan_patch": backup_policy_plan_patch, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_bare_metal_servers(**req_copy) + _service.update_backup_policy_plan(**req_copy) - def test_list_bare_metal_servers_value_error_with_retries(self): - # Enable retries and run test_list_bare_metal_servers_value_error. + def test_update_backup_policy_plan_value_error_with_retries(self): + # Enable retries and run test_update_backup_policy_plan_value_error. _service.enable_retries() - self.test_list_bare_metal_servers_value_error() + self.test_update_backup_policy_plan_value_error() - # Disable retries and run test_list_bare_metal_servers_value_error. + # Disable retries and run test_update_backup_policy_plan_value_error. _service.disable_retries() - self.test_list_bare_metal_servers_value_error() + self.test_update_backup_policy_plan_value_error() -class TestCreateBareMetalServer(): +class TestDeleteBackupPolicy(): """ - Test Class for create_bare_metal_server + Test Class for delete_backup_policy """ @responses.activate - def test_create_bare_metal_server_all_params(self): + def test_delete_backup_policy_all_params(self): """ - create_bare_metal_server() + delete_backup_policy() """ # Set up mock - url = preprocess_url('/bare_metal_servers') - mock_response = '{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "failed", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' - responses.add(responses.POST, + url = preprocess_url('/backup_policies/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_resource_types": ["volume"], "match_user_tags": ["match_user_tags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy"}' + responses.add(responses.DELETE, url, body=mock_response, content_type='application/json', - status=201) - - # Construct a dict representation of a ImageIdentityById model - image_identity_model = {} - image_identity_model['id'] = '72b27b5c-f4b0-48bb-b954-5becc7c1dcb8' - - # Construct a dict representation of a KeyIdentityById model - key_identity_model = {} - key_identity_model['id'] = 'a6b1a881-2ce8-41a3-80fc-36316a73f803' - - # Construct a dict representation of a BareMetalServerInitializationPrototype model - bare_metal_server_initialization_prototype_model = {} - bare_metal_server_initialization_prototype_model['image'] = image_identity_model - bare_metal_server_initialization_prototype_model['keys'] = [key_identity_model] - bare_metal_server_initialization_prototype_model['user_data'] = 'testString' - - # Construct a dict representation of a NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - network_interface_ip_prototype_model = {} - network_interface_ip_prototype_model['address'] = '10.0.0.5' - network_interface_ip_prototype_model['auto_delete'] = False - network_interface_ip_prototype_model['name'] = 'my-reserved-ip' - - # Construct a dict representation of a SecurityGroupIdentityById model - security_group_identity_model = {} - security_group_identity_model['id'] = 'be5df5ca-12a0-494b-907e-aa6ec2bfa271' - - # Construct a dict representation of a SubnetIdentityById model - subnet_identity_model = {} - subnet_identity_model['id'] = '7ec86020-1c6e-4889-b3f0-a15f2e50f87e' - - # Construct a dict representation of a BareMetalServerPrimaryNetworkInterfacePrototype model - bare_metal_server_primary_network_interface_prototype_model = {} - bare_metal_server_primary_network_interface_prototype_model['allow_ip_spoofing'] = True - bare_metal_server_primary_network_interface_prototype_model['allowed_vlans'] = [4] - bare_metal_server_primary_network_interface_prototype_model['enable_infrastructure_nat'] = True - bare_metal_server_primary_network_interface_prototype_model['interface_type'] = 'pci' - bare_metal_server_primary_network_interface_prototype_model['name'] = 'my-network-interface' - bare_metal_server_primary_network_interface_prototype_model['primary_ip'] = network_interface_ip_prototype_model - bare_metal_server_primary_network_interface_prototype_model['security_groups'] = [security_group_identity_model] - bare_metal_server_primary_network_interface_prototype_model['subnet'] = subnet_identity_model - - # Construct a dict representation of a BareMetalServerProfileIdentityByName model - bare_metal_server_profile_identity_model = {} - bare_metal_server_profile_identity_model['name'] = 'bx2-metal-192x768' - - # Construct a dict representation of a ZoneIdentityByName model - zone_identity_model = {} - zone_identity_model['name'] = 'us-south-1' - - # Construct a dict representation of a BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVLANPrototype model - bare_metal_server_network_interface_prototype_model = {} - bare_metal_server_network_interface_prototype_model['allow_ip_spoofing'] = True - bare_metal_server_network_interface_prototype_model['enable_infrastructure_nat'] = True - bare_metal_server_network_interface_prototype_model['name'] = 'my-network-interface' - bare_metal_server_network_interface_prototype_model['primary_ip'] = network_interface_ip_prototype_model - bare_metal_server_network_interface_prototype_model['security_groups'] = [security_group_identity_model] - bare_metal_server_network_interface_prototype_model['subnet'] = subnet_identity_model - bare_metal_server_network_interface_prototype_model['allow_interface_to_float'] = False - bare_metal_server_network_interface_prototype_model['interface_type'] = 'vlan' - bare_metal_server_network_interface_prototype_model['vlan'] = 4 - - # Construct a dict representation of a ResourceGroupIdentityById model - resource_group_identity_model = {} - resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' - - # Construct a dict representation of a VPCIdentityById model - vpc_identity_model = {} - vpc_identity_model['id'] = '4727d842-f94f-4a2d-824a-9bc9b02c523b' + status=202) # Set up parameter values - initialization = bare_metal_server_initialization_prototype_model - primary_network_interface = bare_metal_server_primary_network_interface_prototype_model - profile = bare_metal_server_profile_identity_model - zone = zone_identity_model - name = 'my-bare-metal-server' - network_interfaces = [bare_metal_server_network_interface_prototype_model] - resource_group = resource_group_identity_model - vpc = vpc_identity_model + id = 'testString' + if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"' # Invoke method - response = _service.create_bare_metal_server( - initialization, - primary_network_interface, - profile, - zone, - name=name, - network_interfaces=network_interfaces, - resource_group=resource_group, - vpc=vpc, + response = _service.delete_backup_policy( + id, + if_match=if_match, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 201 - # Validate body params - req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body['initialization'] == bare_metal_server_initialization_prototype_model - assert req_body['primary_network_interface'] == bare_metal_server_primary_network_interface_prototype_model - assert req_body['profile'] == bare_metal_server_profile_identity_model - assert req_body['zone'] == zone_identity_model - assert req_body['name'] == 'my-bare-metal-server' - assert req_body['network_interfaces'] == [bare_metal_server_network_interface_prototype_model] - assert req_body['resource_group'] == resource_group_identity_model - assert req_body['vpc'] == vpc_identity_model - - def test_create_bare_metal_server_all_params_with_retries(self): - # Enable retries and run test_create_bare_metal_server_all_params. - _service.enable_retries() - self.test_create_bare_metal_server_all_params() - - # Disable retries and run test_create_bare_metal_server_all_params. - _service.disable_retries() - self.test_create_bare_metal_server_all_params() - - @responses.activate - def test_create_bare_metal_server_value_error(self): - """ - test_create_bare_metal_server_value_error() - """ - # Set up mock - url = preprocess_url('/bare_metal_servers') - mock_response = '{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "failed", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' - responses.add(responses.POST, - url, - body=mock_response, - content_type='application/json', - status=201) - - # Construct a dict representation of a ImageIdentityById model - image_identity_model = {} - image_identity_model['id'] = '72b27b5c-f4b0-48bb-b954-5becc7c1dcb8' - - # Construct a dict representation of a KeyIdentityById model - key_identity_model = {} - key_identity_model['id'] = 'a6b1a881-2ce8-41a3-80fc-36316a73f803' - - # Construct a dict representation of a BareMetalServerInitializationPrototype model - bare_metal_server_initialization_prototype_model = {} - bare_metal_server_initialization_prototype_model['image'] = image_identity_model - bare_metal_server_initialization_prototype_model['keys'] = [key_identity_model] - bare_metal_server_initialization_prototype_model['user_data'] = 'testString' - - # Construct a dict representation of a NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - network_interface_ip_prototype_model = {} - network_interface_ip_prototype_model['address'] = '10.0.0.5' - network_interface_ip_prototype_model['auto_delete'] = False - network_interface_ip_prototype_model['name'] = 'my-reserved-ip' - - # Construct a dict representation of a SecurityGroupIdentityById model - security_group_identity_model = {} - security_group_identity_model['id'] = 'be5df5ca-12a0-494b-907e-aa6ec2bfa271' - - # Construct a dict representation of a SubnetIdentityById model - subnet_identity_model = {} - subnet_identity_model['id'] = '7ec86020-1c6e-4889-b3f0-a15f2e50f87e' - - # Construct a dict representation of a BareMetalServerPrimaryNetworkInterfacePrototype model - bare_metal_server_primary_network_interface_prototype_model = {} - bare_metal_server_primary_network_interface_prototype_model['allow_ip_spoofing'] = True - bare_metal_server_primary_network_interface_prototype_model['allowed_vlans'] = [4] - bare_metal_server_primary_network_interface_prototype_model['enable_infrastructure_nat'] = True - bare_metal_server_primary_network_interface_prototype_model['interface_type'] = 'pci' - bare_metal_server_primary_network_interface_prototype_model['name'] = 'my-network-interface' - bare_metal_server_primary_network_interface_prototype_model['primary_ip'] = network_interface_ip_prototype_model - bare_metal_server_primary_network_interface_prototype_model['security_groups'] = [security_group_identity_model] - bare_metal_server_primary_network_interface_prototype_model['subnet'] = subnet_identity_model - - # Construct a dict representation of a BareMetalServerProfileIdentityByName model - bare_metal_server_profile_identity_model = {} - bare_metal_server_profile_identity_model['name'] = 'bx2-metal-192x768' - - # Construct a dict representation of a ZoneIdentityByName model - zone_identity_model = {} - zone_identity_model['name'] = 'us-south-1' - - # Construct a dict representation of a BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVLANPrototype model - bare_metal_server_network_interface_prototype_model = {} - bare_metal_server_network_interface_prototype_model['allow_ip_spoofing'] = True - bare_metal_server_network_interface_prototype_model['enable_infrastructure_nat'] = True - bare_metal_server_network_interface_prototype_model['name'] = 'my-network-interface' - bare_metal_server_network_interface_prototype_model['primary_ip'] = network_interface_ip_prototype_model - bare_metal_server_network_interface_prototype_model['security_groups'] = [security_group_identity_model] - bare_metal_server_network_interface_prototype_model['subnet'] = subnet_identity_model - bare_metal_server_network_interface_prototype_model['allow_interface_to_float'] = False - bare_metal_server_network_interface_prototype_model['interface_type'] = 'vlan' - bare_metal_server_network_interface_prototype_model['vlan'] = 4 - - # Construct a dict representation of a ResourceGroupIdentityById model - resource_group_identity_model = {} - resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' - - # Construct a dict representation of a VPCIdentityById model - vpc_identity_model = {} - vpc_identity_model['id'] = '4727d842-f94f-4a2d-824a-9bc9b02c523b' - - # Set up parameter values - initialization = bare_metal_server_initialization_prototype_model - primary_network_interface = bare_metal_server_primary_network_interface_prototype_model - profile = bare_metal_server_profile_identity_model - zone = zone_identity_model - name = 'my-bare-metal-server' - network_interfaces = [bare_metal_server_network_interface_prototype_model] - resource_group = resource_group_identity_model - vpc = vpc_identity_model - - # Pass in all but one required param and check for a ValueError - req_param_dict = { - "initialization": initialization, - "primary_network_interface": primary_network_interface, - "profile": profile, - "zone": zone, - } - for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} - with pytest.raises(ValueError): - _service.create_bare_metal_server(**req_copy) - + assert response.status_code == 202 - def test_create_bare_metal_server_value_error_with_retries(self): - # Enable retries and run test_create_bare_metal_server_value_error. + def test_delete_backup_policy_all_params_with_retries(self): + # Enable retries and run test_delete_backup_policy_all_params. _service.enable_retries() - self.test_create_bare_metal_server_value_error() + self.test_delete_backup_policy_all_params() - # Disable retries and run test_create_bare_metal_server_value_error. + # Disable retries and run test_delete_backup_policy_all_params. _service.disable_retries() - self.test_create_bare_metal_server_value_error() - -class TestCreateBareMetalServerConsoleAccessToken(): - """ - Test Class for create_bare_metal_server_console_access_token - """ + self.test_delete_backup_policy_all_params() @responses.activate - def test_create_bare_metal_server_console_access_token_all_params(self): + def test_delete_backup_policy_required_params(self): """ - create_bare_metal_server_console_access_token() + test_delete_backup_policy_required_params() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/console_access_token') - mock_response = '{"access_token": "VGhpcyBJcyBhIHRva2Vu", "console_type": "serial", "created_at": "2020-07-27T21:50:14.000Z", "expires_at": "2020-07-27T21:51:14.000Z", "force": false, "href": "wss://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/console?access_token=VGhpcyBJcyBhIHRva2Vu"}' - responses.add(responses.POST, + url = preprocess_url('/backup_policies/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_resource_types": ["volume"], "match_user_tags": ["match_user_tags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy"}' + responses.add(responses.DELETE, url, body=mock_response, content_type='application/json', - status=200) + status=202) # Set up parameter values - bare_metal_server_id = 'testString' - console_type = 'serial' - force = False + id = 'testString' # Invoke method - response = _service.create_bare_metal_server_console_access_token( - bare_metal_server_id, - console_type, - force=force, + response = _service.delete_backup_policy( + id, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 200 - # Validate body params - req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body['console_type'] == 'serial' - assert req_body['force'] == False + assert response.status_code == 202 - def test_create_bare_metal_server_console_access_token_all_params_with_retries(self): - # Enable retries and run test_create_bare_metal_server_console_access_token_all_params. + def test_delete_backup_policy_required_params_with_retries(self): + # Enable retries and run test_delete_backup_policy_required_params. _service.enable_retries() - self.test_create_bare_metal_server_console_access_token_all_params() + self.test_delete_backup_policy_required_params() - # Disable retries and run test_create_bare_metal_server_console_access_token_all_params. + # Disable retries and run test_delete_backup_policy_required_params. _service.disable_retries() - self.test_create_bare_metal_server_console_access_token_all_params() + self.test_delete_backup_policy_required_params() @responses.activate - def test_create_bare_metal_server_console_access_token_value_error(self): + def test_delete_backup_policy_value_error(self): """ - test_create_bare_metal_server_console_access_token_value_error() + test_delete_backup_policy_value_error() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/console_access_token') - mock_response = '{"access_token": "VGhpcyBJcyBhIHRva2Vu", "console_type": "serial", "created_at": "2020-07-27T21:50:14.000Z", "expires_at": "2020-07-27T21:51:14.000Z", "force": false, "href": "wss://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/console?access_token=VGhpcyBJcyBhIHRva2Vu"}' - responses.add(responses.POST, + url = preprocess_url('/backup_policies/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_resource_types": ["volume"], "match_user_tags": ["match_user_tags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy"}' + responses.add(responses.DELETE, url, body=mock_response, content_type='application/json', - status=200) + status=202) # Set up parameter values - bare_metal_server_id = 'testString' - console_type = 'serial' - force = False + id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "bare_metal_server_id": bare_metal_server_id, - "console_type": console_type, + "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.create_bare_metal_server_console_access_token(**req_copy) + _service.delete_backup_policy(**req_copy) - def test_create_bare_metal_server_console_access_token_value_error_with_retries(self): - # Enable retries and run test_create_bare_metal_server_console_access_token_value_error. + def test_delete_backup_policy_value_error_with_retries(self): + # Enable retries and run test_delete_backup_policy_value_error. _service.enable_retries() - self.test_create_bare_metal_server_console_access_token_value_error() + self.test_delete_backup_policy_value_error() - # Disable retries and run test_create_bare_metal_server_console_access_token_value_error. + # Disable retries and run test_delete_backup_policy_value_error. _service.disable_retries() - self.test_create_bare_metal_server_console_access_token_value_error() + self.test_delete_backup_policy_value_error() -class TestListBareMetalServerDisks(): +class TestGetBackupPolicy(): """ - Test Class for list_bare_metal_server_disks + Test Class for get_backup_policy """ @responses.activate - def test_list_bare_metal_server_disks_all_params(self): + def test_get_backup_policy_all_params(self): """ - list_bare_metal_server_disks() + get_backup_policy() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/disks') - mock_response = '{"disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}]}' + url = preprocess_url('/backup_policies/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_resource_types": ["volume"], "match_user_tags": ["match_user_tags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy"}' responses.add(responses.GET, url, body=mock_response, @@ -14563,11 +14504,11 @@ def test_list_bare_metal_server_disks_all_params(self): status=200) # Set up parameter values - bare_metal_server_id = 'testString' + id = 'testString' # Invoke method - response = _service.list_bare_metal_server_disks( - bare_metal_server_id, + response = _service.get_backup_policy( + id, headers={} ) @@ -14575,23 +14516,23 @@ def test_list_bare_metal_server_disks_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 200 - def test_list_bare_metal_server_disks_all_params_with_retries(self): - # Enable retries and run test_list_bare_metal_server_disks_all_params. + def test_get_backup_policy_all_params_with_retries(self): + # Enable retries and run test_get_backup_policy_all_params. _service.enable_retries() - self.test_list_bare_metal_server_disks_all_params() + self.test_get_backup_policy_all_params() - # Disable retries and run test_list_bare_metal_server_disks_all_params. + # Disable retries and run test_get_backup_policy_all_params. _service.disable_retries() - self.test_list_bare_metal_server_disks_all_params() + self.test_get_backup_policy_all_params() @responses.activate - def test_list_bare_metal_server_disks_value_error(self): + def test_get_backup_policy_value_error(self): """ - test_list_bare_metal_server_disks_value_error() + test_get_backup_policy_value_error() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/disks') - mock_response = '{"disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}]}' + url = preprocess_url('/backup_policies/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_resource_types": ["volume"], "match_user_tags": ["match_user_tags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy"}' responses.add(responses.GET, url, body=mock_response, @@ -14599,141 +14540,107 @@ def test_list_bare_metal_server_disks_value_error(self): status=200) # Set up parameter values - bare_metal_server_id = 'testString' + id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "bare_metal_server_id": bare_metal_server_id, + "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_bare_metal_server_disks(**req_copy) + _service.get_backup_policy(**req_copy) - def test_list_bare_metal_server_disks_value_error_with_retries(self): - # Enable retries and run test_list_bare_metal_server_disks_value_error. + def test_get_backup_policy_value_error_with_retries(self): + # Enable retries and run test_get_backup_policy_value_error. _service.enable_retries() - self.test_list_bare_metal_server_disks_value_error() + self.test_get_backup_policy_value_error() - # Disable retries and run test_list_bare_metal_server_disks_value_error. + # Disable retries and run test_get_backup_policy_value_error. _service.disable_retries() - self.test_list_bare_metal_server_disks_value_error() + self.test_get_backup_policy_value_error() -class TestGetBareMetalServerDisk(): +class TestUpdateBackupPolicy(): """ - Test Class for get_bare_metal_server_disk + Test Class for update_backup_policy """ @responses.activate - def test_get_bare_metal_server_disk_all_params(self): + def test_update_backup_policy_all_params(self): """ - get_bare_metal_server_disk() + update_backup_policy() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/disks/testString') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}' - responses.add(responses.GET, + url = preprocess_url('/backup_policies/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_resource_types": ["volume"], "match_user_tags": ["match_user_tags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy"}' + responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) + # Construct a dict representation of a BackupPolicyPatch model + backup_policy_patch_model = {} + backup_policy_patch_model['match_user_tags'] = ['my-daily-backup-policy'] + backup_policy_patch_model['name'] = 'my-backup-policy' + # Set up parameter values - bare_metal_server_id = 'testString' id = 'testString' + backup_policy_patch = backup_policy_patch_model + if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"' # Invoke method - response = _service.get_bare_metal_server_disk( - bare_metal_server_id, + response = _service.update_backup_policy( id, + backup_policy_patch, + if_match=if_match, headers={} ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body == backup_policy_patch - def test_get_bare_metal_server_disk_all_params_with_retries(self): - # Enable retries and run test_get_bare_metal_server_disk_all_params. - _service.enable_retries() - self.test_get_bare_metal_server_disk_all_params() - - # Disable retries and run test_get_bare_metal_server_disk_all_params. - _service.disable_retries() - self.test_get_bare_metal_server_disk_all_params() - - @responses.activate - def test_get_bare_metal_server_disk_value_error(self): - """ - test_get_bare_metal_server_disk_value_error() - """ - # Set up mock - url = preprocess_url('/bare_metal_servers/testString/disks/testString') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) - - # Set up parameter values - bare_metal_server_id = 'testString' - id = 'testString' - - # Pass in all but one required param and check for a ValueError - req_param_dict = { - "bare_metal_server_id": bare_metal_server_id, - "id": id, - } - for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} - with pytest.raises(ValueError): - _service.get_bare_metal_server_disk(**req_copy) - - - def test_get_bare_metal_server_disk_value_error_with_retries(self): - # Enable retries and run test_get_bare_metal_server_disk_value_error. + def test_update_backup_policy_all_params_with_retries(self): + # Enable retries and run test_update_backup_policy_all_params. _service.enable_retries() - self.test_get_bare_metal_server_disk_value_error() + self.test_update_backup_policy_all_params() - # Disable retries and run test_get_bare_metal_server_disk_value_error. + # Disable retries and run test_update_backup_policy_all_params. _service.disable_retries() - self.test_get_bare_metal_server_disk_value_error() - -class TestUpdateBareMetalServerDisk(): - """ - Test Class for update_bare_metal_server_disk - """ + self.test_update_backup_policy_all_params() @responses.activate - def test_update_bare_metal_server_disk_all_params(self): + def test_update_backup_policy_required_params(self): """ - update_bare_metal_server_disk() + test_update_backup_policy_required_params() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/disks/testString') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}' + url = preprocess_url('/backup_policies/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_resource_types": ["volume"], "match_user_tags": ["match_user_tags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy"}' responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) - # Construct a dict representation of a BareMetalServerDiskPatch model - bare_metal_server_disk_patch_model = {} - bare_metal_server_disk_patch_model['name'] = 'my-bare-metal-server-disk-updated' + # Construct a dict representation of a BackupPolicyPatch model + backup_policy_patch_model = {} + backup_policy_patch_model['match_user_tags'] = ['my-daily-backup-policy'] + backup_policy_patch_model['name'] = 'my-backup-policy' # Set up parameter values - bare_metal_server_id = 'testString' id = 'testString' - bare_metal_server_disk_patch = bare_metal_server_disk_patch_model + backup_policy_patch = backup_policy_patch_model # Invoke method - response = _service.update_bare_metal_server_disk( - bare_metal_server_id, + response = _service.update_backup_policy( id, - bare_metal_server_disk_patch, + backup_policy_patch, headers={} ) @@ -14742,119 +14649,127 @@ def test_update_bare_metal_server_disk_all_params(self): assert response.status_code == 200 # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == bare_metal_server_disk_patch + assert req_body == backup_policy_patch - def test_update_bare_metal_server_disk_all_params_with_retries(self): - # Enable retries and run test_update_bare_metal_server_disk_all_params. + def test_update_backup_policy_required_params_with_retries(self): + # Enable retries and run test_update_backup_policy_required_params. _service.enable_retries() - self.test_update_bare_metal_server_disk_all_params() + self.test_update_backup_policy_required_params() - # Disable retries and run test_update_bare_metal_server_disk_all_params. + # Disable retries and run test_update_backup_policy_required_params. _service.disable_retries() - self.test_update_bare_metal_server_disk_all_params() + self.test_update_backup_policy_required_params() @responses.activate - def test_update_bare_metal_server_disk_value_error(self): + def test_update_backup_policy_value_error(self): """ - test_update_bare_metal_server_disk_value_error() + test_update_backup_policy_value_error() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/disks/testString') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}' + url = preprocess_url('/backup_policies/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_resource_types": ["volume"], "match_user_tags": ["match_user_tags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy"}' responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) - # Construct a dict representation of a BareMetalServerDiskPatch model - bare_metal_server_disk_patch_model = {} - bare_metal_server_disk_patch_model['name'] = 'my-bare-metal-server-disk-updated' + # Construct a dict representation of a BackupPolicyPatch model + backup_policy_patch_model = {} + backup_policy_patch_model['match_user_tags'] = ['my-daily-backup-policy'] + backup_policy_patch_model['name'] = 'my-backup-policy' # Set up parameter values - bare_metal_server_id = 'testString' id = 'testString' - bare_metal_server_disk_patch = bare_metal_server_disk_patch_model + backup_policy_patch = backup_policy_patch_model # Pass in all but one required param and check for a ValueError req_param_dict = { - "bare_metal_server_id": bare_metal_server_id, "id": id, - "bare_metal_server_disk_patch": bare_metal_server_disk_patch, + "backup_policy_patch": backup_policy_patch, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.update_bare_metal_server_disk(**req_copy) + _service.update_backup_policy(**req_copy) - def test_update_bare_metal_server_disk_value_error_with_retries(self): - # Enable retries and run test_update_bare_metal_server_disk_value_error. + def test_update_backup_policy_value_error_with_retries(self): + # Enable retries and run test_update_backup_policy_value_error. _service.enable_retries() - self.test_update_bare_metal_server_disk_value_error() + self.test_update_backup_policy_value_error() - # Disable retries and run test_update_bare_metal_server_disk_value_error. + # Disable retries and run test_update_backup_policy_value_error. _service.disable_retries() - self.test_update_bare_metal_server_disk_value_error() + self.test_update_backup_policy_value_error() -class TestListBareMetalServerNetworkInterfaces(): +# endregion +############################################################################## +# End of Service: BackupPolicies +############################################################################## + +############################################################################## +# Start of Service: PlacementGroups +############################################################################## +# region + +class TestNewInstance(): """ - Test Class for list_bare_metal_server_network_interfaces + Test Class for new_instance """ - @responses.activate - def test_list_bare_metal_server_network_interfaces_all_params(self): + def test_new_instance(self): """ - list_bare_metal_server_network_interfaces() + new_instance() """ - # Set up mock - url = preprocess_url('/bare_metal_servers/testString/network_interfaces') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_interfaces?limit=20"}, "limit": 20, "network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:0a:00:23:94", "name": "my-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_interfaces?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) - - # Set up parameter values - bare_metal_server_id = 'testString' - start = 'testString' - limit = 1 + os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' - # Invoke method - response = _service.list_bare_metal_server_network_interfaces( - bare_metal_server_id, - start=start, - limit=limit, - headers={} + service = VpcV1.new_instance( + version=version, + service_name='TEST_SERVICE', ) - # Check for correct operation - assert len(responses.calls) == 1 - assert response.status_code == 200 - # Validate query params - query_string = responses.calls[0].request.url.split('?',1)[1] - query_string = urllib.parse.unquote_plus(query_string) - assert 'start={}'.format(start) in query_string - assert 'limit={}'.format(limit) in query_string + assert service is not None + assert isinstance(service, VpcV1) - def test_list_bare_metal_server_network_interfaces_all_params_with_retries(self): - # Enable retries and run test_list_bare_metal_server_network_interfaces_all_params. - _service.enable_retries() - self.test_list_bare_metal_server_network_interfaces_all_params() + def test_new_instance_without_authenticator(self): + """ + new_instance_without_authenticator() + """ + with pytest.raises(ValueError, match='authenticator must be provided'): + service = VpcV1.new_instance( + version=version, + service_name='TEST_SERVICE_NOT_FOUND', + ) - # Disable retries and run test_list_bare_metal_server_network_interfaces_all_params. - _service.disable_retries() - self.test_list_bare_metal_server_network_interfaces_all_params() + def test_new_instance_without_required_params(self): + """ + new_instance_without_required_params() + """ + with pytest.raises(TypeError, match='new_instance\\(\\) missing \\d required positional arguments?: \'.*\''): + service = VpcV1.new_instance() + + def test_new_instance_required_param_none(self): + """ + new_instance_required_param_none() + """ + with pytest.raises(ValueError, match='version must be provided'): + service = VpcV1.new_instance( + version=None, + ) +class TestListPlacementGroups(): + """ + Test Class for list_placement_groups + """ @responses.activate - def test_list_bare_metal_server_network_interfaces_required_params(self): + def test_list_placement_groups_all_params(self): """ - test_list_bare_metal_server_network_interfaces_required_params() + list_placement_groups() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/network_interfaces') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_interfaces?limit=20"}, "limit": 20, "network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:0a:00:23:94", "name": "my-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_interfaces?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132}' + url = preprocess_url('/placement_groups') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "placement_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -14862,116 +14777,130 @@ def test_list_bare_metal_server_network_interfaces_required_params(self): status=200) # Set up parameter values - bare_metal_server_id = 'testString' + start = 'testString' + limit = 1 # Invoke method - response = _service.list_bare_metal_server_network_interfaces( - bare_metal_server_id, + response = _service.list_placement_groups( + start=start, + limit=limit, headers={} ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?',1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'start={}'.format(start) in query_string + assert 'limit={}'.format(limit) in query_string - def test_list_bare_metal_server_network_interfaces_required_params_with_retries(self): - # Enable retries and run test_list_bare_metal_server_network_interfaces_required_params. + def test_list_placement_groups_all_params_with_retries(self): + # Enable retries and run test_list_placement_groups_all_params. _service.enable_retries() - self.test_list_bare_metal_server_network_interfaces_required_params() + self.test_list_placement_groups_all_params() - # Disable retries and run test_list_bare_metal_server_network_interfaces_required_params. + # Disable retries and run test_list_placement_groups_all_params. _service.disable_retries() - self.test_list_bare_metal_server_network_interfaces_required_params() + self.test_list_placement_groups_all_params() @responses.activate - def test_list_bare_metal_server_network_interfaces_value_error(self): + def test_list_placement_groups_required_params(self): """ - test_list_bare_metal_server_network_interfaces_value_error() + test_list_placement_groups_required_params() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/network_interfaces') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_interfaces?limit=20"}, "limit": 20, "network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:0a:00:23:94", "name": "my-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_interfaces?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132}' + url = preprocess_url('/placement_groups') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "placement_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) - # Set up parameter values - bare_metal_server_id = 'testString' + # Invoke method + response = _service.list_placement_groups() + + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_placement_groups_required_params_with_retries(self): + # Enable retries and run test_list_placement_groups_required_params. + _service.enable_retries() + self.test_list_placement_groups_required_params() + + # Disable retries and run test_list_placement_groups_required_params. + _service.disable_retries() + self.test_list_placement_groups_required_params() + + @responses.activate + def test_list_placement_groups_value_error(self): + """ + test_list_placement_groups_value_error() + """ + # Set up mock + url = preprocess_url('/placement_groups') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "placement_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}], "total_count": 132}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) # Pass in all but one required param and check for a ValueError req_param_dict = { - "bare_metal_server_id": bare_metal_server_id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_bare_metal_server_network_interfaces(**req_copy) + _service.list_placement_groups(**req_copy) - def test_list_bare_metal_server_network_interfaces_value_error_with_retries(self): - # Enable retries and run test_list_bare_metal_server_network_interfaces_value_error. + def test_list_placement_groups_value_error_with_retries(self): + # Enable retries and run test_list_placement_groups_value_error. _service.enable_retries() - self.test_list_bare_metal_server_network_interfaces_value_error() + self.test_list_placement_groups_value_error() - # Disable retries and run test_list_bare_metal_server_network_interfaces_value_error. + # Disable retries and run test_list_placement_groups_value_error. _service.disable_retries() - self.test_list_bare_metal_server_network_interfaces_value_error() + self.test_list_placement_groups_value_error() -class TestCreateBareMetalServerNetworkInterface(): +class TestCreatePlacementGroup(): """ - Test Class for create_bare_metal_server_network_interface + Test Class for create_placement_group """ @responses.activate - def test_create_bare_metal_server_network_interface_all_params(self): + def test_create_placement_group_all_params(self): """ - create_bare_metal_server_network_interface() + create_placement_group() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/network_interfaces') - mock_response = '{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:0a:00:23:94", "name": "my-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}' + url = preprocess_url('/placement_groups') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) - # Construct a dict representation of a NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - network_interface_ip_prototype_model = {} - network_interface_ip_prototype_model['address'] = '10.0.0.5' - network_interface_ip_prototype_model['auto_delete'] = False - network_interface_ip_prototype_model['name'] = 'my-reserved-ip' - - # Construct a dict representation of a SecurityGroupIdentityById model - security_group_identity_model = {} - security_group_identity_model['id'] = 'be5df5ca-12a0-494b-907e-aa6ec2bfa271' - - # Construct a dict representation of a SubnetIdentityById model - subnet_identity_model = {} - subnet_identity_model['id'] = '7ec86020-1c6e-4889-b3f0-a15f2e50f87e' - - # Construct a dict representation of a BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVLANPrototype model - bare_metal_server_network_interface_prototype_model = {} - bare_metal_server_network_interface_prototype_model['allow_ip_spoofing'] = True - bare_metal_server_network_interface_prototype_model['enable_infrastructure_nat'] = True - bare_metal_server_network_interface_prototype_model['name'] = 'my-network-interface' - bare_metal_server_network_interface_prototype_model['primary_ip'] = network_interface_ip_prototype_model - bare_metal_server_network_interface_prototype_model['security_groups'] = [security_group_identity_model] - bare_metal_server_network_interface_prototype_model['subnet'] = subnet_identity_model - bare_metal_server_network_interface_prototype_model['allow_interface_to_float'] = False - bare_metal_server_network_interface_prototype_model['interface_type'] = 'vlan' - bare_metal_server_network_interface_prototype_model['vlan'] = 4 + # Construct a dict representation of a ResourceGroupIdentityById model + resource_group_identity_model = {} + resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' # Set up parameter values - bare_metal_server_id = 'testString' - bare_metal_server_network_interface_prototype = bare_metal_server_network_interface_prototype_model + strategy = 'host_spread' + name = 'my-placement-group' + resource_group = resource_group_identity_model # Invoke method - response = _service.create_bare_metal_server_network_interface( - bare_metal_server_id, - bare_metal_server_network_interface_prototype, + response = _service.create_placement_group( + strategy, + name=name, + resource_group=resource_group, headers={} ) @@ -14980,169 +14909,145 @@ def test_create_bare_metal_server_network_interface_all_params(self): assert response.status_code == 201 # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == bare_metal_server_network_interface_prototype + assert req_body['strategy'] == 'host_spread' + assert req_body['name'] == 'my-placement-group' + assert req_body['resource_group'] == resource_group_identity_model - def test_create_bare_metal_server_network_interface_all_params_with_retries(self): - # Enable retries and run test_create_bare_metal_server_network_interface_all_params. + def test_create_placement_group_all_params_with_retries(self): + # Enable retries and run test_create_placement_group_all_params. _service.enable_retries() - self.test_create_bare_metal_server_network_interface_all_params() + self.test_create_placement_group_all_params() - # Disable retries and run test_create_bare_metal_server_network_interface_all_params. + # Disable retries and run test_create_placement_group_all_params. _service.disable_retries() - self.test_create_bare_metal_server_network_interface_all_params() + self.test_create_placement_group_all_params() @responses.activate - def test_create_bare_metal_server_network_interface_value_error(self): + def test_create_placement_group_value_error(self): """ - test_create_bare_metal_server_network_interface_value_error() + test_create_placement_group_value_error() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/network_interfaces') - mock_response = '{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:0a:00:23:94", "name": "my-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}' + url = preprocess_url('/placement_groups') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) - # Construct a dict representation of a NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - network_interface_ip_prototype_model = {} - network_interface_ip_prototype_model['address'] = '10.0.0.5' - network_interface_ip_prototype_model['auto_delete'] = False - network_interface_ip_prototype_model['name'] = 'my-reserved-ip' - - # Construct a dict representation of a SecurityGroupIdentityById model - security_group_identity_model = {} - security_group_identity_model['id'] = 'be5df5ca-12a0-494b-907e-aa6ec2bfa271' - - # Construct a dict representation of a SubnetIdentityById model - subnet_identity_model = {} - subnet_identity_model['id'] = '7ec86020-1c6e-4889-b3f0-a15f2e50f87e' - - # Construct a dict representation of a BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVLANPrototype model - bare_metal_server_network_interface_prototype_model = {} - bare_metal_server_network_interface_prototype_model['allow_ip_spoofing'] = True - bare_metal_server_network_interface_prototype_model['enable_infrastructure_nat'] = True - bare_metal_server_network_interface_prototype_model['name'] = 'my-network-interface' - bare_metal_server_network_interface_prototype_model['primary_ip'] = network_interface_ip_prototype_model - bare_metal_server_network_interface_prototype_model['security_groups'] = [security_group_identity_model] - bare_metal_server_network_interface_prototype_model['subnet'] = subnet_identity_model - bare_metal_server_network_interface_prototype_model['allow_interface_to_float'] = False - bare_metal_server_network_interface_prototype_model['interface_type'] = 'vlan' - bare_metal_server_network_interface_prototype_model['vlan'] = 4 + # Construct a dict representation of a ResourceGroupIdentityById model + resource_group_identity_model = {} + resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' # Set up parameter values - bare_metal_server_id = 'testString' - bare_metal_server_network_interface_prototype = bare_metal_server_network_interface_prototype_model + strategy = 'host_spread' + name = 'my-placement-group' + resource_group = resource_group_identity_model # Pass in all but one required param and check for a ValueError req_param_dict = { - "bare_metal_server_id": bare_metal_server_id, - "bare_metal_server_network_interface_prototype": bare_metal_server_network_interface_prototype, + "strategy": strategy, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.create_bare_metal_server_network_interface(**req_copy) + _service.create_placement_group(**req_copy) - def test_create_bare_metal_server_network_interface_value_error_with_retries(self): - # Enable retries and run test_create_bare_metal_server_network_interface_value_error. + def test_create_placement_group_value_error_with_retries(self): + # Enable retries and run test_create_placement_group_value_error. _service.enable_retries() - self.test_create_bare_metal_server_network_interface_value_error() + self.test_create_placement_group_value_error() - # Disable retries and run test_create_bare_metal_server_network_interface_value_error. + # Disable retries and run test_create_placement_group_value_error. _service.disable_retries() - self.test_create_bare_metal_server_network_interface_value_error() + self.test_create_placement_group_value_error() -class TestDeleteBareMetalServerNetworkInterface(): +class TestDeletePlacementGroup(): """ - Test Class for delete_bare_metal_server_network_interface + Test Class for delete_placement_group """ @responses.activate - def test_delete_bare_metal_server_network_interface_all_params(self): + def test_delete_placement_group_all_params(self): """ - delete_bare_metal_server_network_interface() + delete_placement_group() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString') + url = preprocess_url('/placement_groups/testString') responses.add(responses.DELETE, url, - status=204) + status=202) # Set up parameter values - bare_metal_server_id = 'testString' id = 'testString' # Invoke method - response = _service.delete_bare_metal_server_network_interface( - bare_metal_server_id, + response = _service.delete_placement_group( id, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 204 + assert response.status_code == 202 - def test_delete_bare_metal_server_network_interface_all_params_with_retries(self): - # Enable retries and run test_delete_bare_metal_server_network_interface_all_params. + def test_delete_placement_group_all_params_with_retries(self): + # Enable retries and run test_delete_placement_group_all_params. _service.enable_retries() - self.test_delete_bare_metal_server_network_interface_all_params() + self.test_delete_placement_group_all_params() - # Disable retries and run test_delete_bare_metal_server_network_interface_all_params. + # Disable retries and run test_delete_placement_group_all_params. _service.disable_retries() - self.test_delete_bare_metal_server_network_interface_all_params() + self.test_delete_placement_group_all_params() @responses.activate - def test_delete_bare_metal_server_network_interface_value_error(self): + def test_delete_placement_group_value_error(self): """ - test_delete_bare_metal_server_network_interface_value_error() + test_delete_placement_group_value_error() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString') + url = preprocess_url('/placement_groups/testString') responses.add(responses.DELETE, url, - status=204) + status=202) # Set up parameter values - bare_metal_server_id = 'testString' id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "bare_metal_server_id": bare_metal_server_id, "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.delete_bare_metal_server_network_interface(**req_copy) + _service.delete_placement_group(**req_copy) - def test_delete_bare_metal_server_network_interface_value_error_with_retries(self): - # Enable retries and run test_delete_bare_metal_server_network_interface_value_error. + def test_delete_placement_group_value_error_with_retries(self): + # Enable retries and run test_delete_placement_group_value_error. _service.enable_retries() - self.test_delete_bare_metal_server_network_interface_value_error() + self.test_delete_placement_group_value_error() - # Disable retries and run test_delete_bare_metal_server_network_interface_value_error. + # Disable retries and run test_delete_placement_group_value_error. _service.disable_retries() - self.test_delete_bare_metal_server_network_interface_value_error() + self.test_delete_placement_group_value_error() -class TestGetBareMetalServerNetworkInterface(): +class TestGetPlacementGroup(): """ - Test Class for get_bare_metal_server_network_interface + Test Class for get_placement_group """ @responses.activate - def test_get_bare_metal_server_network_interface_all_params(self): + def test_get_placement_group_all_params(self): """ - get_bare_metal_server_network_interface() + get_placement_group() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString') - mock_response = '{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:0a:00:23:94", "name": "my-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}' + url = preprocess_url('/placement_groups/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}' responses.add(responses.GET, url, body=mock_response, @@ -15150,12 +15055,10 @@ def test_get_bare_metal_server_network_interface_all_params(self): status=200) # Set up parameter values - bare_metal_server_id = 'testString' id = 'testString' # Invoke method - response = _service.get_bare_metal_server_network_interface( - bare_metal_server_id, + response = _service.get_placement_group( id, headers={} ) @@ -15164,23 +15067,23 @@ def test_get_bare_metal_server_network_interface_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 200 - def test_get_bare_metal_server_network_interface_all_params_with_retries(self): - # Enable retries and run test_get_bare_metal_server_network_interface_all_params. + def test_get_placement_group_all_params_with_retries(self): + # Enable retries and run test_get_placement_group_all_params. _service.enable_retries() - self.test_get_bare_metal_server_network_interface_all_params() + self.test_get_placement_group_all_params() - # Disable retries and run test_get_bare_metal_server_network_interface_all_params. + # Disable retries and run test_get_placement_group_all_params. _service.disable_retries() - self.test_get_bare_metal_server_network_interface_all_params() + self.test_get_placement_group_all_params() @responses.activate - def test_get_bare_metal_server_network_interface_value_error(self): + def test_get_placement_group_value_error(self): """ - test_get_bare_metal_server_network_interface_value_error() + test_get_placement_group_value_error() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString') - mock_response = '{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:0a:00:23:94", "name": "my-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}' + url = preprocess_url('/placement_groups/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}' responses.add(responses.GET, url, body=mock_response, @@ -15188,65 +15091,58 @@ def test_get_bare_metal_server_network_interface_value_error(self): status=200) # Set up parameter values - bare_metal_server_id = 'testString' id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "bare_metal_server_id": bare_metal_server_id, "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.get_bare_metal_server_network_interface(**req_copy) + _service.get_placement_group(**req_copy) - def test_get_bare_metal_server_network_interface_value_error_with_retries(self): - # Enable retries and run test_get_bare_metal_server_network_interface_value_error. + def test_get_placement_group_value_error_with_retries(self): + # Enable retries and run test_get_placement_group_value_error. _service.enable_retries() - self.test_get_bare_metal_server_network_interface_value_error() + self.test_get_placement_group_value_error() - # Disable retries and run test_get_bare_metal_server_network_interface_value_error. + # Disable retries and run test_get_placement_group_value_error. _service.disable_retries() - self.test_get_bare_metal_server_network_interface_value_error() + self.test_get_placement_group_value_error() -class TestUpdateBareMetalServerNetworkInterface(): +class TestUpdatePlacementGroup(): """ - Test Class for update_bare_metal_server_network_interface + Test Class for update_placement_group """ @responses.activate - def test_update_bare_metal_server_network_interface_all_params(self): + def test_update_placement_group_all_params(self): """ - update_bare_metal_server_network_interface() + update_placement_group() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString') - mock_response = '{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:0a:00:23:94", "name": "my-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}' + url = preprocess_url('/placement_groups/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}' responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) - # Construct a dict representation of a BareMetalServerNetworkInterfacePatch model - bare_metal_server_network_interface_patch_model = {} - bare_metal_server_network_interface_patch_model['allow_ip_spoofing'] = True - bare_metal_server_network_interface_patch_model['allowed_vlans'] = [4] - bare_metal_server_network_interface_patch_model['enable_infrastructure_nat'] = True - bare_metal_server_network_interface_patch_model['name'] = 'my-network-interface' + # Construct a dict representation of a PlacementGroupPatch model + placement_group_patch_model = {} + placement_group_patch_model['name'] = 'my-placement-group' # Set up parameter values - bare_metal_server_id = 'testString' id = 'testString' - bare_metal_server_network_interface_patch = bare_metal_server_network_interface_patch_model + placement_group_patch = placement_group_patch_model # Invoke method - response = _service.update_bare_metal_server_network_interface( - bare_metal_server_id, + response = _service.update_placement_group( id, - bare_metal_server_network_interface_patch, + placement_group_patch, headers={} ) @@ -15255,77 +15151,126 @@ def test_update_bare_metal_server_network_interface_all_params(self): assert response.status_code == 200 # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == bare_metal_server_network_interface_patch + assert req_body == placement_group_patch - def test_update_bare_metal_server_network_interface_all_params_with_retries(self): - # Enable retries and run test_update_bare_metal_server_network_interface_all_params. + def test_update_placement_group_all_params_with_retries(self): + # Enable retries and run test_update_placement_group_all_params. _service.enable_retries() - self.test_update_bare_metal_server_network_interface_all_params() + self.test_update_placement_group_all_params() - # Disable retries and run test_update_bare_metal_server_network_interface_all_params. + # Disable retries and run test_update_placement_group_all_params. _service.disable_retries() - self.test_update_bare_metal_server_network_interface_all_params() + self.test_update_placement_group_all_params() @responses.activate - def test_update_bare_metal_server_network_interface_value_error(self): + def test_update_placement_group_value_error(self): """ - test_update_bare_metal_server_network_interface_value_error() + test_update_placement_group_value_error() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString') - mock_response = '{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:0a:00:23:94", "name": "my-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}' + url = preprocess_url('/placement_groups/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}' responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) - # Construct a dict representation of a BareMetalServerNetworkInterfacePatch model - bare_metal_server_network_interface_patch_model = {} - bare_metal_server_network_interface_patch_model['allow_ip_spoofing'] = True - bare_metal_server_network_interface_patch_model['allowed_vlans'] = [4] - bare_metal_server_network_interface_patch_model['enable_infrastructure_nat'] = True - bare_metal_server_network_interface_patch_model['name'] = 'my-network-interface' + # Construct a dict representation of a PlacementGroupPatch model + placement_group_patch_model = {} + placement_group_patch_model['name'] = 'my-placement-group' # Set up parameter values - bare_metal_server_id = 'testString' id = 'testString' - bare_metal_server_network_interface_patch = bare_metal_server_network_interface_patch_model + placement_group_patch = placement_group_patch_model # Pass in all but one required param and check for a ValueError req_param_dict = { - "bare_metal_server_id": bare_metal_server_id, "id": id, - "bare_metal_server_network_interface_patch": bare_metal_server_network_interface_patch, + "placement_group_patch": placement_group_patch, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.update_bare_metal_server_network_interface(**req_copy) + _service.update_placement_group(**req_copy) - def test_update_bare_metal_server_network_interface_value_error_with_retries(self): - # Enable retries and run test_update_bare_metal_server_network_interface_value_error. + def test_update_placement_group_value_error_with_retries(self): + # Enable retries and run test_update_placement_group_value_error. _service.enable_retries() - self.test_update_bare_metal_server_network_interface_value_error() + self.test_update_placement_group_value_error() - # Disable retries and run test_update_bare_metal_server_network_interface_value_error. + # Disable retries and run test_update_placement_group_value_error. _service.disable_retries() - self.test_update_bare_metal_server_network_interface_value_error() + self.test_update_placement_group_value_error() -class TestListBareMetalServerNetworkInterfaceFloatingIps(): +# endregion +############################################################################## +# End of Service: PlacementGroups +############################################################################## + +############################################################################## +# Start of Service: BareMetalServers +############################################################################## +# region + +class TestNewInstance(): """ - Test Class for list_bare_metal_server_network_interface_floating_ips + Test Class for new_instance + """ + + def test_new_instance(self): + """ + new_instance() + """ + os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' + + service = VpcV1.new_instance( + version=version, + service_name='TEST_SERVICE', + ) + + assert service is not None + assert isinstance(service, VpcV1) + + def test_new_instance_without_authenticator(self): + """ + new_instance_without_authenticator() + """ + with pytest.raises(ValueError, match='authenticator must be provided'): + service = VpcV1.new_instance( + version=version, + service_name='TEST_SERVICE_NOT_FOUND', + ) + + def test_new_instance_without_required_params(self): + """ + new_instance_without_required_params() + """ + with pytest.raises(TypeError, match='new_instance\\(\\) missing \\d required positional arguments?: \'.*\''): + service = VpcV1.new_instance() + + def test_new_instance_required_param_none(self): + """ + new_instance_required_param_none() + """ + with pytest.raises(ValueError, match='version must be provided'): + service = VpcV1.new_instance( + version=None, + ) +class TestListBareMetalServerProfiles(): + """ + Test Class for list_bare_metal_server_profiles """ @responses.activate - def test_list_bare_metal_server_network_interface_floating_ips_all_params(self): + def test_list_bare_metal_server_profiles_all_params(self): """ - list_bare_metal_server_network_interface_floating_ips() + list_bare_metal_server_profiles() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/floating_ips') - mock_response = '{"floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}' + url = preprocess_url('/bare_metal_server/profiles') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -15333,37 +15278,2346 @@ def test_list_bare_metal_server_network_interface_floating_ips_all_params(self): status=200) # Set up parameter values - bare_metal_server_id = 'testString' - network_interface_id = 'testString' + start = 'testString' + limit = 1 # Invoke method - response = _service.list_bare_metal_server_network_interface_floating_ips( - bare_metal_server_id, - network_interface_id, + response = _service.list_bare_metal_server_profiles( + start=start, + limit=limit, headers={} ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?',1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'start={}'.format(start) in query_string + assert 'limit={}'.format(limit) in query_string - def test_list_bare_metal_server_network_interface_floating_ips_all_params_with_retries(self): - # Enable retries and run test_list_bare_metal_server_network_interface_floating_ips_all_params. + def test_list_bare_metal_server_profiles_all_params_with_retries(self): + # Enable retries and run test_list_bare_metal_server_profiles_all_params. _service.enable_retries() - self.test_list_bare_metal_server_network_interface_floating_ips_all_params() + self.test_list_bare_metal_server_profiles_all_params() - # Disable retries and run test_list_bare_metal_server_network_interface_floating_ips_all_params. + # Disable retries and run test_list_bare_metal_server_profiles_all_params. _service.disable_retries() - self.test_list_bare_metal_server_network_interface_floating_ips_all_params() + self.test_list_bare_metal_server_profiles_all_params() @responses.activate - def test_list_bare_metal_server_network_interface_floating_ips_value_error(self): + def test_list_bare_metal_server_profiles_required_params(self): + """ + test_list_bare_metal_server_profiles_required_params() + """ + # Set up mock + url = preprocess_url('/bare_metal_server/profiles') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}], "total_count": 132}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Invoke method + response = _service.list_bare_metal_server_profiles() + + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_bare_metal_server_profiles_required_params_with_retries(self): + # Enable retries and run test_list_bare_metal_server_profiles_required_params. + _service.enable_retries() + self.test_list_bare_metal_server_profiles_required_params() + + # Disable retries and run test_list_bare_metal_server_profiles_required_params. + _service.disable_retries() + self.test_list_bare_metal_server_profiles_required_params() + + @responses.activate + def test_list_bare_metal_server_profiles_value_error(self): + """ + test_list_bare_metal_server_profiles_value_error() + """ + # Set up mock + url = preprocess_url('/bare_metal_server/profiles') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}], "total_count": 132}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_bare_metal_server_profiles(**req_copy) + + + def test_list_bare_metal_server_profiles_value_error_with_retries(self): + # Enable retries and run test_list_bare_metal_server_profiles_value_error. + _service.enable_retries() + self.test_list_bare_metal_server_profiles_value_error() + + # Disable retries and run test_list_bare_metal_server_profiles_value_error. + _service.disable_retries() + self.test_list_bare_metal_server_profiles_value_error() + +class TestGetBareMetalServerProfile(): + """ + Test Class for get_bare_metal_server_profile + """ + + @responses.activate + def test_get_bare_metal_server_profile_all_params(self): + """ + get_bare_metal_server_profile() + """ + # Set up mock + url = preprocess_url('/bare_metal_server/profiles/testString') + mock_response = '{"bandwidth": {"type": "fixed", "value": 20000}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + name = 'testString' + + # Invoke method + response = _service.get_bare_metal_server_profile( + name, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_bare_metal_server_profile_all_params_with_retries(self): + # Enable retries and run test_get_bare_metal_server_profile_all_params. + _service.enable_retries() + self.test_get_bare_metal_server_profile_all_params() + + # Disable retries and run test_get_bare_metal_server_profile_all_params. + _service.disable_retries() + self.test_get_bare_metal_server_profile_all_params() + + @responses.activate + def test_get_bare_metal_server_profile_value_error(self): + """ + test_get_bare_metal_server_profile_value_error() + """ + # Set up mock + url = preprocess_url('/bare_metal_server/profiles/testString') + mock_response = '{"bandwidth": {"type": "fixed", "value": 20000}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + name = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "name": name, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_bare_metal_server_profile(**req_copy) + + + def test_get_bare_metal_server_profile_value_error_with_retries(self): + # Enable retries and run test_get_bare_metal_server_profile_value_error. + _service.enable_retries() + self.test_get_bare_metal_server_profile_value_error() + + # Disable retries and run test_get_bare_metal_server_profile_value_error. + _service.disable_retries() + self.test_get_bare_metal_server_profile_value_error() + +class TestListBareMetalServers(): + """ + Test Class for list_bare_metal_servers + """ + + @responses.activate + def test_list_bare_metal_servers_all_params(self): + """ + list_bare_metal_servers() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers') + mock_response = '{"bare_metal_servers": [{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "failed", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + start = 'testString' + limit = 1 + resource_group_id = 'testString' + name = 'testString' + vpc_id = 'testString' + vpc_crn = 'testString' + vpc_name = 'testString' + network_interfaces_subnet_id = 'testString' + network_interfaces_subnet_crn = 'testString' + network_interfaces_subnet_name = 'testString' + + # Invoke method + response = _service.list_bare_metal_servers( + start=start, + limit=limit, + resource_group_id=resource_group_id, + name=name, + vpc_id=vpc_id, + vpc_crn=vpc_crn, + vpc_name=vpc_name, + network_interfaces_subnet_id=network_interfaces_subnet_id, + network_interfaces_subnet_crn=network_interfaces_subnet_crn, + network_interfaces_subnet_name=network_interfaces_subnet_name, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?',1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'start={}'.format(start) in query_string + assert 'limit={}'.format(limit) in query_string + assert 'resource_group.id={}'.format(resource_group_id) in query_string + assert 'name={}'.format(name) in query_string + assert 'vpc.id={}'.format(vpc_id) in query_string + assert 'vpc.crn={}'.format(vpc_crn) in query_string + assert 'vpc.name={}'.format(vpc_name) in query_string + assert 'network_interfaces.subnet.id={}'.format(network_interfaces_subnet_id) in query_string + assert 'network_interfaces.subnet.crn={}'.format(network_interfaces_subnet_crn) in query_string + assert 'network_interfaces.subnet.name={}'.format(network_interfaces_subnet_name) in query_string + + def test_list_bare_metal_servers_all_params_with_retries(self): + # Enable retries and run test_list_bare_metal_servers_all_params. + _service.enable_retries() + self.test_list_bare_metal_servers_all_params() + + # Disable retries and run test_list_bare_metal_servers_all_params. + _service.disable_retries() + self.test_list_bare_metal_servers_all_params() + + @responses.activate + def test_list_bare_metal_servers_required_params(self): + """ + test_list_bare_metal_servers_required_params() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers') + mock_response = '{"bare_metal_servers": [{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "failed", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Invoke method + response = _service.list_bare_metal_servers() + + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_bare_metal_servers_required_params_with_retries(self): + # Enable retries and run test_list_bare_metal_servers_required_params. + _service.enable_retries() + self.test_list_bare_metal_servers_required_params() + + # Disable retries and run test_list_bare_metal_servers_required_params. + _service.disable_retries() + self.test_list_bare_metal_servers_required_params() + + @responses.activate + def test_list_bare_metal_servers_value_error(self): + """ + test_list_bare_metal_servers_value_error() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers') + mock_response = '{"bare_metal_servers": [{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "failed", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_bare_metal_servers(**req_copy) + + + def test_list_bare_metal_servers_value_error_with_retries(self): + # Enable retries and run test_list_bare_metal_servers_value_error. + _service.enable_retries() + self.test_list_bare_metal_servers_value_error() + + # Disable retries and run test_list_bare_metal_servers_value_error. + _service.disable_retries() + self.test_list_bare_metal_servers_value_error() + +class TestCreateBareMetalServer(): + """ + Test Class for create_bare_metal_server + """ + + @responses.activate + def test_create_bare_metal_server_all_params(self): + """ + create_bare_metal_server() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers') + mock_response = '{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "failed", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + responses.add(responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201) + + # Construct a dict representation of a ImageIdentityById model + image_identity_model = {} + image_identity_model['id'] = '72b27b5c-f4b0-48bb-b954-5becc7c1dcb8' + + # Construct a dict representation of a KeyIdentityById model + key_identity_model = {} + key_identity_model['id'] = 'a6b1a881-2ce8-41a3-80fc-36316a73f803' + + # Construct a dict representation of a BareMetalServerInitializationPrototype model + bare_metal_server_initialization_prototype_model = {} + bare_metal_server_initialization_prototype_model['image'] = image_identity_model + bare_metal_server_initialization_prototype_model['keys'] = [key_identity_model] + bare_metal_server_initialization_prototype_model['user_data'] = 'testString' + + # Construct a dict representation of a NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + network_interface_ip_prototype_model = {} + network_interface_ip_prototype_model['address'] = '10.0.0.5' + network_interface_ip_prototype_model['auto_delete'] = False + network_interface_ip_prototype_model['name'] = 'my-reserved-ip' + + # Construct a dict representation of a SecurityGroupIdentityById model + security_group_identity_model = {} + security_group_identity_model['id'] = 'be5df5ca-12a0-494b-907e-aa6ec2bfa271' + + # Construct a dict representation of a SubnetIdentityById model + subnet_identity_model = {} + subnet_identity_model['id'] = '7ec86020-1c6e-4889-b3f0-a15f2e50f87e' + + # Construct a dict representation of a BareMetalServerPrimaryNetworkInterfacePrototype model + bare_metal_server_primary_network_interface_prototype_model = {} + bare_metal_server_primary_network_interface_prototype_model['allow_ip_spoofing'] = True + bare_metal_server_primary_network_interface_prototype_model['allowed_vlans'] = [4] + bare_metal_server_primary_network_interface_prototype_model['enable_infrastructure_nat'] = True + bare_metal_server_primary_network_interface_prototype_model['interface_type'] = 'pci' + bare_metal_server_primary_network_interface_prototype_model['name'] = 'my-network-interface' + bare_metal_server_primary_network_interface_prototype_model['primary_ip'] = network_interface_ip_prototype_model + bare_metal_server_primary_network_interface_prototype_model['security_groups'] = [security_group_identity_model] + bare_metal_server_primary_network_interface_prototype_model['subnet'] = subnet_identity_model + + # Construct a dict representation of a BareMetalServerProfileIdentityByName model + bare_metal_server_profile_identity_model = {} + bare_metal_server_profile_identity_model['name'] = 'bx2-metal-192x768' + + # Construct a dict representation of a ZoneIdentityByName model + zone_identity_model = {} + zone_identity_model['name'] = 'us-south-1' + + # Construct a dict representation of a BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVLANPrototype model + bare_metal_server_network_interface_prototype_model = {} + bare_metal_server_network_interface_prototype_model['allow_ip_spoofing'] = True + bare_metal_server_network_interface_prototype_model['enable_infrastructure_nat'] = True + bare_metal_server_network_interface_prototype_model['name'] = 'my-network-interface' + bare_metal_server_network_interface_prototype_model['primary_ip'] = network_interface_ip_prototype_model + bare_metal_server_network_interface_prototype_model['security_groups'] = [security_group_identity_model] + bare_metal_server_network_interface_prototype_model['subnet'] = subnet_identity_model + bare_metal_server_network_interface_prototype_model['allow_interface_to_float'] = False + bare_metal_server_network_interface_prototype_model['interface_type'] = 'vlan' + bare_metal_server_network_interface_prototype_model['vlan'] = 4 + + # Construct a dict representation of a ResourceGroupIdentityById model + resource_group_identity_model = {} + resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + + # Construct a dict representation of a VPCIdentityById model + vpc_identity_model = {} + vpc_identity_model['id'] = '4727d842-f94f-4a2d-824a-9bc9b02c523b' + + # Set up parameter values + initialization = bare_metal_server_initialization_prototype_model + primary_network_interface = bare_metal_server_primary_network_interface_prototype_model + profile = bare_metal_server_profile_identity_model + zone = zone_identity_model + name = 'my-bare-metal-server' + network_interfaces = [bare_metal_server_network_interface_prototype_model] + resource_group = resource_group_identity_model + vpc = vpc_identity_model + + # Invoke method + response = _service.create_bare_metal_server( + initialization, + primary_network_interface, + profile, + zone, + name=name, + network_interfaces=network_interfaces, + resource_group=resource_group, + vpc=vpc, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 201 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['initialization'] == bare_metal_server_initialization_prototype_model + assert req_body['primary_network_interface'] == bare_metal_server_primary_network_interface_prototype_model + assert req_body['profile'] == bare_metal_server_profile_identity_model + assert req_body['zone'] == zone_identity_model + assert req_body['name'] == 'my-bare-metal-server' + assert req_body['network_interfaces'] == [bare_metal_server_network_interface_prototype_model] + assert req_body['resource_group'] == resource_group_identity_model + assert req_body['vpc'] == vpc_identity_model + + def test_create_bare_metal_server_all_params_with_retries(self): + # Enable retries and run test_create_bare_metal_server_all_params. + _service.enable_retries() + self.test_create_bare_metal_server_all_params() + + # Disable retries and run test_create_bare_metal_server_all_params. + _service.disable_retries() + self.test_create_bare_metal_server_all_params() + + @responses.activate + def test_create_bare_metal_server_value_error(self): + """ + test_create_bare_metal_server_value_error() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers') + mock_response = '{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "failed", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + responses.add(responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201) + + # Construct a dict representation of a ImageIdentityById model + image_identity_model = {} + image_identity_model['id'] = '72b27b5c-f4b0-48bb-b954-5becc7c1dcb8' + + # Construct a dict representation of a KeyIdentityById model + key_identity_model = {} + key_identity_model['id'] = 'a6b1a881-2ce8-41a3-80fc-36316a73f803' + + # Construct a dict representation of a BareMetalServerInitializationPrototype model + bare_metal_server_initialization_prototype_model = {} + bare_metal_server_initialization_prototype_model['image'] = image_identity_model + bare_metal_server_initialization_prototype_model['keys'] = [key_identity_model] + bare_metal_server_initialization_prototype_model['user_data'] = 'testString' + + # Construct a dict representation of a NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + network_interface_ip_prototype_model = {} + network_interface_ip_prototype_model['address'] = '10.0.0.5' + network_interface_ip_prototype_model['auto_delete'] = False + network_interface_ip_prototype_model['name'] = 'my-reserved-ip' + + # Construct a dict representation of a SecurityGroupIdentityById model + security_group_identity_model = {} + security_group_identity_model['id'] = 'be5df5ca-12a0-494b-907e-aa6ec2bfa271' + + # Construct a dict representation of a SubnetIdentityById model + subnet_identity_model = {} + subnet_identity_model['id'] = '7ec86020-1c6e-4889-b3f0-a15f2e50f87e' + + # Construct a dict representation of a BareMetalServerPrimaryNetworkInterfacePrototype model + bare_metal_server_primary_network_interface_prototype_model = {} + bare_metal_server_primary_network_interface_prototype_model['allow_ip_spoofing'] = True + bare_metal_server_primary_network_interface_prototype_model['allowed_vlans'] = [4] + bare_metal_server_primary_network_interface_prototype_model['enable_infrastructure_nat'] = True + bare_metal_server_primary_network_interface_prototype_model['interface_type'] = 'pci' + bare_metal_server_primary_network_interface_prototype_model['name'] = 'my-network-interface' + bare_metal_server_primary_network_interface_prototype_model['primary_ip'] = network_interface_ip_prototype_model + bare_metal_server_primary_network_interface_prototype_model['security_groups'] = [security_group_identity_model] + bare_metal_server_primary_network_interface_prototype_model['subnet'] = subnet_identity_model + + # Construct a dict representation of a BareMetalServerProfileIdentityByName model + bare_metal_server_profile_identity_model = {} + bare_metal_server_profile_identity_model['name'] = 'bx2-metal-192x768' + + # Construct a dict representation of a ZoneIdentityByName model + zone_identity_model = {} + zone_identity_model['name'] = 'us-south-1' + + # Construct a dict representation of a BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVLANPrototype model + bare_metal_server_network_interface_prototype_model = {} + bare_metal_server_network_interface_prototype_model['allow_ip_spoofing'] = True + bare_metal_server_network_interface_prototype_model['enable_infrastructure_nat'] = True + bare_metal_server_network_interface_prototype_model['name'] = 'my-network-interface' + bare_metal_server_network_interface_prototype_model['primary_ip'] = network_interface_ip_prototype_model + bare_metal_server_network_interface_prototype_model['security_groups'] = [security_group_identity_model] + bare_metal_server_network_interface_prototype_model['subnet'] = subnet_identity_model + bare_metal_server_network_interface_prototype_model['allow_interface_to_float'] = False + bare_metal_server_network_interface_prototype_model['interface_type'] = 'vlan' + bare_metal_server_network_interface_prototype_model['vlan'] = 4 + + # Construct a dict representation of a ResourceGroupIdentityById model + resource_group_identity_model = {} + resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + + # Construct a dict representation of a VPCIdentityById model + vpc_identity_model = {} + vpc_identity_model['id'] = '4727d842-f94f-4a2d-824a-9bc9b02c523b' + + # Set up parameter values + initialization = bare_metal_server_initialization_prototype_model + primary_network_interface = bare_metal_server_primary_network_interface_prototype_model + profile = bare_metal_server_profile_identity_model + zone = zone_identity_model + name = 'my-bare-metal-server' + network_interfaces = [bare_metal_server_network_interface_prototype_model] + resource_group = resource_group_identity_model + vpc = vpc_identity_model + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "initialization": initialization, + "primary_network_interface": primary_network_interface, + "profile": profile, + "zone": zone, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.create_bare_metal_server(**req_copy) + + + def test_create_bare_metal_server_value_error_with_retries(self): + # Enable retries and run test_create_bare_metal_server_value_error. + _service.enable_retries() + self.test_create_bare_metal_server_value_error() + + # Disable retries and run test_create_bare_metal_server_value_error. + _service.disable_retries() + self.test_create_bare_metal_server_value_error() + +class TestCreateBareMetalServerConsoleAccessToken(): + """ + Test Class for create_bare_metal_server_console_access_token + """ + + @responses.activate + def test_create_bare_metal_server_console_access_token_all_params(self): + """ + create_bare_metal_server_console_access_token() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/console_access_token') + mock_response = '{"access_token": "VGhpcyBJcyBhIHRva2Vu", "console_type": "serial", "created_at": "2020-07-27T21:50:14.000Z", "expires_at": "2020-07-27T21:51:14.000Z", "force": false, "href": "wss://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/console?access_token=VGhpcyBJcyBhIHRva2Vu"}' + responses.add(responses.POST, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + bare_metal_server_id = 'testString' + console_type = 'serial' + force = False + + # Invoke method + response = _service.create_bare_metal_server_console_access_token( + bare_metal_server_id, + console_type, + force=force, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['console_type'] == 'serial' + assert req_body['force'] == False + + def test_create_bare_metal_server_console_access_token_all_params_with_retries(self): + # Enable retries and run test_create_bare_metal_server_console_access_token_all_params. + _service.enable_retries() + self.test_create_bare_metal_server_console_access_token_all_params() + + # Disable retries and run test_create_bare_metal_server_console_access_token_all_params. + _service.disable_retries() + self.test_create_bare_metal_server_console_access_token_all_params() + + @responses.activate + def test_create_bare_metal_server_console_access_token_value_error(self): + """ + test_create_bare_metal_server_console_access_token_value_error() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/console_access_token') + mock_response = '{"access_token": "VGhpcyBJcyBhIHRva2Vu", "console_type": "serial", "created_at": "2020-07-27T21:50:14.000Z", "expires_at": "2020-07-27T21:51:14.000Z", "force": false, "href": "wss://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/console?access_token=VGhpcyBJcyBhIHRva2Vu"}' + responses.add(responses.POST, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + bare_metal_server_id = 'testString' + console_type = 'serial' + force = False + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "bare_metal_server_id": bare_metal_server_id, + "console_type": console_type, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.create_bare_metal_server_console_access_token(**req_copy) + + + def test_create_bare_metal_server_console_access_token_value_error_with_retries(self): + # Enable retries and run test_create_bare_metal_server_console_access_token_value_error. + _service.enable_retries() + self.test_create_bare_metal_server_console_access_token_value_error() + + # Disable retries and run test_create_bare_metal_server_console_access_token_value_error. + _service.disable_retries() + self.test_create_bare_metal_server_console_access_token_value_error() + +class TestListBareMetalServerDisks(): + """ + Test Class for list_bare_metal_server_disks + """ + + @responses.activate + def test_list_bare_metal_server_disks_all_params(self): + """ + list_bare_metal_server_disks() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/disks') + mock_response = '{"disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}]}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + bare_metal_server_id = 'testString' + + # Invoke method + response = _service.list_bare_metal_server_disks( + bare_metal_server_id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_bare_metal_server_disks_all_params_with_retries(self): + # Enable retries and run test_list_bare_metal_server_disks_all_params. + _service.enable_retries() + self.test_list_bare_metal_server_disks_all_params() + + # Disable retries and run test_list_bare_metal_server_disks_all_params. + _service.disable_retries() + self.test_list_bare_metal_server_disks_all_params() + + @responses.activate + def test_list_bare_metal_server_disks_value_error(self): + """ + test_list_bare_metal_server_disks_value_error() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/disks') + mock_response = '{"disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}]}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + bare_metal_server_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "bare_metal_server_id": bare_metal_server_id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_bare_metal_server_disks(**req_copy) + + + def test_list_bare_metal_server_disks_value_error_with_retries(self): + # Enable retries and run test_list_bare_metal_server_disks_value_error. + _service.enable_retries() + self.test_list_bare_metal_server_disks_value_error() + + # Disable retries and run test_list_bare_metal_server_disks_value_error. + _service.disable_retries() + self.test_list_bare_metal_server_disks_value_error() + +class TestGetBareMetalServerDisk(): + """ + Test Class for get_bare_metal_server_disk + """ + + @responses.activate + def test_get_bare_metal_server_disk_all_params(self): + """ + get_bare_metal_server_disk() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/disks/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + bare_metal_server_id = 'testString' + id = 'testString' + + # Invoke method + response = _service.get_bare_metal_server_disk( + bare_metal_server_id, + id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_bare_metal_server_disk_all_params_with_retries(self): + # Enable retries and run test_get_bare_metal_server_disk_all_params. + _service.enable_retries() + self.test_get_bare_metal_server_disk_all_params() + + # Disable retries and run test_get_bare_metal_server_disk_all_params. + _service.disable_retries() + self.test_get_bare_metal_server_disk_all_params() + + @responses.activate + def test_get_bare_metal_server_disk_value_error(self): + """ + test_get_bare_metal_server_disk_value_error() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/disks/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + bare_metal_server_id = 'testString' + id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "bare_metal_server_id": bare_metal_server_id, + "id": id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_bare_metal_server_disk(**req_copy) + + + def test_get_bare_metal_server_disk_value_error_with_retries(self): + # Enable retries and run test_get_bare_metal_server_disk_value_error. + _service.enable_retries() + self.test_get_bare_metal_server_disk_value_error() + + # Disable retries and run test_get_bare_metal_server_disk_value_error. + _service.disable_retries() + self.test_get_bare_metal_server_disk_value_error() + +class TestUpdateBareMetalServerDisk(): + """ + Test Class for update_bare_metal_server_disk + """ + + @responses.activate + def test_update_bare_metal_server_disk_all_params(self): + """ + update_bare_metal_server_disk() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/disks/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}' + responses.add(responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Construct a dict representation of a BareMetalServerDiskPatch model + bare_metal_server_disk_patch_model = {} + bare_metal_server_disk_patch_model['name'] = 'my-bare-metal-server-disk-updated' + + # Set up parameter values + bare_metal_server_id = 'testString' + id = 'testString' + bare_metal_server_disk_patch = bare_metal_server_disk_patch_model + + # Invoke method + response = _service.update_bare_metal_server_disk( + bare_metal_server_id, + id, + bare_metal_server_disk_patch, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body == bare_metal_server_disk_patch + + def test_update_bare_metal_server_disk_all_params_with_retries(self): + # Enable retries and run test_update_bare_metal_server_disk_all_params. + _service.enable_retries() + self.test_update_bare_metal_server_disk_all_params() + + # Disable retries and run test_update_bare_metal_server_disk_all_params. + _service.disable_retries() + self.test_update_bare_metal_server_disk_all_params() + + @responses.activate + def test_update_bare_metal_server_disk_value_error(self): + """ + test_update_bare_metal_server_disk_value_error() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/disks/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}' + responses.add(responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Construct a dict representation of a BareMetalServerDiskPatch model + bare_metal_server_disk_patch_model = {} + bare_metal_server_disk_patch_model['name'] = 'my-bare-metal-server-disk-updated' + + # Set up parameter values + bare_metal_server_id = 'testString' + id = 'testString' + bare_metal_server_disk_patch = bare_metal_server_disk_patch_model + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "bare_metal_server_id": bare_metal_server_id, + "id": id, + "bare_metal_server_disk_patch": bare_metal_server_disk_patch, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.update_bare_metal_server_disk(**req_copy) + + + def test_update_bare_metal_server_disk_value_error_with_retries(self): + # Enable retries and run test_update_bare_metal_server_disk_value_error. + _service.enable_retries() + self.test_update_bare_metal_server_disk_value_error() + + # Disable retries and run test_update_bare_metal_server_disk_value_error. + _service.disable_retries() + self.test_update_bare_metal_server_disk_value_error() + +class TestListBareMetalServerNetworkInterfaces(): + """ + Test Class for list_bare_metal_server_network_interfaces + """ + + @responses.activate + def test_list_bare_metal_server_network_interfaces_all_params(self): + """ + list_bare_metal_server_network_interfaces() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/network_interfaces') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_interfaces?limit=20"}, "limit": 20, "network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:0a:00:23:94", "name": "my-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_interfaces?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + bare_metal_server_id = 'testString' + start = 'testString' + limit = 1 + + # Invoke method + response = _service.list_bare_metal_server_network_interfaces( + bare_metal_server_id, + start=start, + limit=limit, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?',1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'start={}'.format(start) in query_string + assert 'limit={}'.format(limit) in query_string + + def test_list_bare_metal_server_network_interfaces_all_params_with_retries(self): + # Enable retries and run test_list_bare_metal_server_network_interfaces_all_params. + _service.enable_retries() + self.test_list_bare_metal_server_network_interfaces_all_params() + + # Disable retries and run test_list_bare_metal_server_network_interfaces_all_params. + _service.disable_retries() + self.test_list_bare_metal_server_network_interfaces_all_params() + + @responses.activate + def test_list_bare_metal_server_network_interfaces_required_params(self): + """ + test_list_bare_metal_server_network_interfaces_required_params() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/network_interfaces') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_interfaces?limit=20"}, "limit": 20, "network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:0a:00:23:94", "name": "my-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_interfaces?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + bare_metal_server_id = 'testString' + + # Invoke method + response = _service.list_bare_metal_server_network_interfaces( + bare_metal_server_id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_bare_metal_server_network_interfaces_required_params_with_retries(self): + # Enable retries and run test_list_bare_metal_server_network_interfaces_required_params. + _service.enable_retries() + self.test_list_bare_metal_server_network_interfaces_required_params() + + # Disable retries and run test_list_bare_metal_server_network_interfaces_required_params. + _service.disable_retries() + self.test_list_bare_metal_server_network_interfaces_required_params() + + @responses.activate + def test_list_bare_metal_server_network_interfaces_value_error(self): + """ + test_list_bare_metal_server_network_interfaces_value_error() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/network_interfaces') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_interfaces?limit=20"}, "limit": 20, "network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:0a:00:23:94", "name": "my-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_interfaces?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + bare_metal_server_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "bare_metal_server_id": bare_metal_server_id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_bare_metal_server_network_interfaces(**req_copy) + + + def test_list_bare_metal_server_network_interfaces_value_error_with_retries(self): + # Enable retries and run test_list_bare_metal_server_network_interfaces_value_error. + _service.enable_retries() + self.test_list_bare_metal_server_network_interfaces_value_error() + + # Disable retries and run test_list_bare_metal_server_network_interfaces_value_error. + _service.disable_retries() + self.test_list_bare_metal_server_network_interfaces_value_error() + +class TestCreateBareMetalServerNetworkInterface(): + """ + Test Class for create_bare_metal_server_network_interface + """ + + @responses.activate + def test_create_bare_metal_server_network_interface_all_params(self): + """ + create_bare_metal_server_network_interface() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/network_interfaces') + mock_response = '{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:0a:00:23:94", "name": "my-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}' + responses.add(responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201) + + # Construct a dict representation of a NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + network_interface_ip_prototype_model = {} + network_interface_ip_prototype_model['address'] = '10.0.0.5' + network_interface_ip_prototype_model['auto_delete'] = False + network_interface_ip_prototype_model['name'] = 'my-reserved-ip' + + # Construct a dict representation of a SecurityGroupIdentityById model + security_group_identity_model = {} + security_group_identity_model['id'] = 'be5df5ca-12a0-494b-907e-aa6ec2bfa271' + + # Construct a dict representation of a SubnetIdentityById model + subnet_identity_model = {} + subnet_identity_model['id'] = '7ec86020-1c6e-4889-b3f0-a15f2e50f87e' + + # Construct a dict representation of a BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVLANPrototype model + bare_metal_server_network_interface_prototype_model = {} + bare_metal_server_network_interface_prototype_model['allow_ip_spoofing'] = True + bare_metal_server_network_interface_prototype_model['enable_infrastructure_nat'] = True + bare_metal_server_network_interface_prototype_model['name'] = 'my-network-interface' + bare_metal_server_network_interface_prototype_model['primary_ip'] = network_interface_ip_prototype_model + bare_metal_server_network_interface_prototype_model['security_groups'] = [security_group_identity_model] + bare_metal_server_network_interface_prototype_model['subnet'] = subnet_identity_model + bare_metal_server_network_interface_prototype_model['allow_interface_to_float'] = False + bare_metal_server_network_interface_prototype_model['interface_type'] = 'vlan' + bare_metal_server_network_interface_prototype_model['vlan'] = 4 + + # Set up parameter values + bare_metal_server_id = 'testString' + bare_metal_server_network_interface_prototype = bare_metal_server_network_interface_prototype_model + + # Invoke method + response = _service.create_bare_metal_server_network_interface( + bare_metal_server_id, + bare_metal_server_network_interface_prototype, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 201 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body == bare_metal_server_network_interface_prototype + + def test_create_bare_metal_server_network_interface_all_params_with_retries(self): + # Enable retries and run test_create_bare_metal_server_network_interface_all_params. + _service.enable_retries() + self.test_create_bare_metal_server_network_interface_all_params() + + # Disable retries and run test_create_bare_metal_server_network_interface_all_params. + _service.disable_retries() + self.test_create_bare_metal_server_network_interface_all_params() + + @responses.activate + def test_create_bare_metal_server_network_interface_value_error(self): + """ + test_create_bare_metal_server_network_interface_value_error() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/network_interfaces') + mock_response = '{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:0a:00:23:94", "name": "my-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}' + responses.add(responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201) + + # Construct a dict representation of a NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + network_interface_ip_prototype_model = {} + network_interface_ip_prototype_model['address'] = '10.0.0.5' + network_interface_ip_prototype_model['auto_delete'] = False + network_interface_ip_prototype_model['name'] = 'my-reserved-ip' + + # Construct a dict representation of a SecurityGroupIdentityById model + security_group_identity_model = {} + security_group_identity_model['id'] = 'be5df5ca-12a0-494b-907e-aa6ec2bfa271' + + # Construct a dict representation of a SubnetIdentityById model + subnet_identity_model = {} + subnet_identity_model['id'] = '7ec86020-1c6e-4889-b3f0-a15f2e50f87e' + + # Construct a dict representation of a BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVLANPrototype model + bare_metal_server_network_interface_prototype_model = {} + bare_metal_server_network_interface_prototype_model['allow_ip_spoofing'] = True + bare_metal_server_network_interface_prototype_model['enable_infrastructure_nat'] = True + bare_metal_server_network_interface_prototype_model['name'] = 'my-network-interface' + bare_metal_server_network_interface_prototype_model['primary_ip'] = network_interface_ip_prototype_model + bare_metal_server_network_interface_prototype_model['security_groups'] = [security_group_identity_model] + bare_metal_server_network_interface_prototype_model['subnet'] = subnet_identity_model + bare_metal_server_network_interface_prototype_model['allow_interface_to_float'] = False + bare_metal_server_network_interface_prototype_model['interface_type'] = 'vlan' + bare_metal_server_network_interface_prototype_model['vlan'] = 4 + + # Set up parameter values + bare_metal_server_id = 'testString' + bare_metal_server_network_interface_prototype = bare_metal_server_network_interface_prototype_model + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "bare_metal_server_id": bare_metal_server_id, + "bare_metal_server_network_interface_prototype": bare_metal_server_network_interface_prototype, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.create_bare_metal_server_network_interface(**req_copy) + + + def test_create_bare_metal_server_network_interface_value_error_with_retries(self): + # Enable retries and run test_create_bare_metal_server_network_interface_value_error. + _service.enable_retries() + self.test_create_bare_metal_server_network_interface_value_error() + + # Disable retries and run test_create_bare_metal_server_network_interface_value_error. + _service.disable_retries() + self.test_create_bare_metal_server_network_interface_value_error() + +class TestDeleteBareMetalServerNetworkInterface(): + """ + Test Class for delete_bare_metal_server_network_interface + """ + + @responses.activate + def test_delete_bare_metal_server_network_interface_all_params(self): + """ + delete_bare_metal_server_network_interface() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString') + responses.add(responses.DELETE, + url, + status=204) + + # Set up parameter values + bare_metal_server_id = 'testString' + id = 'testString' + + # Invoke method + response = _service.delete_bare_metal_server_network_interface( + bare_metal_server_id, + id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 204 + + def test_delete_bare_metal_server_network_interface_all_params_with_retries(self): + # Enable retries and run test_delete_bare_metal_server_network_interface_all_params. + _service.enable_retries() + self.test_delete_bare_metal_server_network_interface_all_params() + + # Disable retries and run test_delete_bare_metal_server_network_interface_all_params. + _service.disable_retries() + self.test_delete_bare_metal_server_network_interface_all_params() + + @responses.activate + def test_delete_bare_metal_server_network_interface_value_error(self): + """ + test_delete_bare_metal_server_network_interface_value_error() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString') + responses.add(responses.DELETE, + url, + status=204) + + # Set up parameter values + bare_metal_server_id = 'testString' + id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "bare_metal_server_id": bare_metal_server_id, + "id": id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.delete_bare_metal_server_network_interface(**req_copy) + + + def test_delete_bare_metal_server_network_interface_value_error_with_retries(self): + # Enable retries and run test_delete_bare_metal_server_network_interface_value_error. + _service.enable_retries() + self.test_delete_bare_metal_server_network_interface_value_error() + + # Disable retries and run test_delete_bare_metal_server_network_interface_value_error. + _service.disable_retries() + self.test_delete_bare_metal_server_network_interface_value_error() + +class TestGetBareMetalServerNetworkInterface(): + """ + Test Class for get_bare_metal_server_network_interface + """ + + @responses.activate + def test_get_bare_metal_server_network_interface_all_params(self): + """ + get_bare_metal_server_network_interface() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString') + mock_response = '{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:0a:00:23:94", "name": "my-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + bare_metal_server_id = 'testString' + id = 'testString' + + # Invoke method + response = _service.get_bare_metal_server_network_interface( + bare_metal_server_id, + id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_bare_metal_server_network_interface_all_params_with_retries(self): + # Enable retries and run test_get_bare_metal_server_network_interface_all_params. + _service.enable_retries() + self.test_get_bare_metal_server_network_interface_all_params() + + # Disable retries and run test_get_bare_metal_server_network_interface_all_params. + _service.disable_retries() + self.test_get_bare_metal_server_network_interface_all_params() + + @responses.activate + def test_get_bare_metal_server_network_interface_value_error(self): + """ + test_get_bare_metal_server_network_interface_value_error() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString') + mock_response = '{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:0a:00:23:94", "name": "my-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + bare_metal_server_id = 'testString' + id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "bare_metal_server_id": bare_metal_server_id, + "id": id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_bare_metal_server_network_interface(**req_copy) + + + def test_get_bare_metal_server_network_interface_value_error_with_retries(self): + # Enable retries and run test_get_bare_metal_server_network_interface_value_error. + _service.enable_retries() + self.test_get_bare_metal_server_network_interface_value_error() + + # Disable retries and run test_get_bare_metal_server_network_interface_value_error. + _service.disable_retries() + self.test_get_bare_metal_server_network_interface_value_error() + +class TestUpdateBareMetalServerNetworkInterface(): + """ + Test Class for update_bare_metal_server_network_interface + """ + + @responses.activate + def test_update_bare_metal_server_network_interface_all_params(self): + """ + update_bare_metal_server_network_interface() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString') + mock_response = '{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:0a:00:23:94", "name": "my-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}' + responses.add(responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Construct a dict representation of a BareMetalServerNetworkInterfacePatch model + bare_metal_server_network_interface_patch_model = {} + bare_metal_server_network_interface_patch_model['allow_ip_spoofing'] = True + bare_metal_server_network_interface_patch_model['allowed_vlans'] = [4] + bare_metal_server_network_interface_patch_model['enable_infrastructure_nat'] = True + bare_metal_server_network_interface_patch_model['name'] = 'my-network-interface' + + # Set up parameter values + bare_metal_server_id = 'testString' + id = 'testString' + bare_metal_server_network_interface_patch = bare_metal_server_network_interface_patch_model + + # Invoke method + response = _service.update_bare_metal_server_network_interface( + bare_metal_server_id, + id, + bare_metal_server_network_interface_patch, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body == bare_metal_server_network_interface_patch + + def test_update_bare_metal_server_network_interface_all_params_with_retries(self): + # Enable retries and run test_update_bare_metal_server_network_interface_all_params. + _service.enable_retries() + self.test_update_bare_metal_server_network_interface_all_params() + + # Disable retries and run test_update_bare_metal_server_network_interface_all_params. + _service.disable_retries() + self.test_update_bare_metal_server_network_interface_all_params() + + @responses.activate + def test_update_bare_metal_server_network_interface_value_error(self): + """ + test_update_bare_metal_server_network_interface_value_error() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString') + mock_response = '{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:0a:00:23:94", "name": "my-network-interface", "port_speed": 1000, "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}' + responses.add(responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Construct a dict representation of a BareMetalServerNetworkInterfacePatch model + bare_metal_server_network_interface_patch_model = {} + bare_metal_server_network_interface_patch_model['allow_ip_spoofing'] = True + bare_metal_server_network_interface_patch_model['allowed_vlans'] = [4] + bare_metal_server_network_interface_patch_model['enable_infrastructure_nat'] = True + bare_metal_server_network_interface_patch_model['name'] = 'my-network-interface' + + # Set up parameter values + bare_metal_server_id = 'testString' + id = 'testString' + bare_metal_server_network_interface_patch = bare_metal_server_network_interface_patch_model + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "bare_metal_server_id": bare_metal_server_id, + "id": id, + "bare_metal_server_network_interface_patch": bare_metal_server_network_interface_patch, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.update_bare_metal_server_network_interface(**req_copy) + + + def test_update_bare_metal_server_network_interface_value_error_with_retries(self): + # Enable retries and run test_update_bare_metal_server_network_interface_value_error. + _service.enable_retries() + self.test_update_bare_metal_server_network_interface_value_error() + + # Disable retries and run test_update_bare_metal_server_network_interface_value_error. + _service.disable_retries() + self.test_update_bare_metal_server_network_interface_value_error() + +class TestListBareMetalServerNetworkInterfaceFloatingIps(): + """ + Test Class for list_bare_metal_server_network_interface_floating_ips + """ + + @responses.activate + def test_list_bare_metal_server_network_interface_floating_ips_all_params(self): + """ + list_bare_metal_server_network_interface_floating_ips() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/floating_ips') + mock_response = '{"floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + bare_metal_server_id = 'testString' + network_interface_id = 'testString' + + # Invoke method + response = _service.list_bare_metal_server_network_interface_floating_ips( + bare_metal_server_id, + network_interface_id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_bare_metal_server_network_interface_floating_ips_all_params_with_retries(self): + # Enable retries and run test_list_bare_metal_server_network_interface_floating_ips_all_params. + _service.enable_retries() + self.test_list_bare_metal_server_network_interface_floating_ips_all_params() + + # Disable retries and run test_list_bare_metal_server_network_interface_floating_ips_all_params. + _service.disable_retries() + self.test_list_bare_metal_server_network_interface_floating_ips_all_params() + + @responses.activate + def test_list_bare_metal_server_network_interface_floating_ips_value_error(self): + """ + test_list_bare_metal_server_network_interface_floating_ips_value_error() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/floating_ips') + mock_response = '{"floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + bare_metal_server_id = 'testString' + network_interface_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "bare_metal_server_id": bare_metal_server_id, + "network_interface_id": network_interface_id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_bare_metal_server_network_interface_floating_ips(**req_copy) + + + def test_list_bare_metal_server_network_interface_floating_ips_value_error_with_retries(self): + # Enable retries and run test_list_bare_metal_server_network_interface_floating_ips_value_error. + _service.enable_retries() + self.test_list_bare_metal_server_network_interface_floating_ips_value_error() + + # Disable retries and run test_list_bare_metal_server_network_interface_floating_ips_value_error. + _service.disable_retries() + self.test_list_bare_metal_server_network_interface_floating_ips_value_error() + +class TestRemoveBareMetalServerNetworkInterfaceFloatingIp(): + """ + Test Class for remove_bare_metal_server_network_interface_floating_ip + """ + + @responses.activate + def test_remove_bare_metal_server_network_interface_floating_ip_all_params(self): + """ + remove_bare_metal_server_network_interface_floating_ip() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString') + responses.add(responses.DELETE, + url, + status=204) + + # Set up parameter values + bare_metal_server_id = 'testString' + network_interface_id = 'testString' + id = 'testString' + + # Invoke method + response = _service.remove_bare_metal_server_network_interface_floating_ip( + bare_metal_server_id, + network_interface_id, + id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 204 + + def test_remove_bare_metal_server_network_interface_floating_ip_all_params_with_retries(self): + # Enable retries and run test_remove_bare_metal_server_network_interface_floating_ip_all_params. + _service.enable_retries() + self.test_remove_bare_metal_server_network_interface_floating_ip_all_params() + + # Disable retries and run test_remove_bare_metal_server_network_interface_floating_ip_all_params. + _service.disable_retries() + self.test_remove_bare_metal_server_network_interface_floating_ip_all_params() + + @responses.activate + def test_remove_bare_metal_server_network_interface_floating_ip_value_error(self): + """ + test_remove_bare_metal_server_network_interface_floating_ip_value_error() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString') + responses.add(responses.DELETE, + url, + status=204) + + # Set up parameter values + bare_metal_server_id = 'testString' + network_interface_id = 'testString' + id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "bare_metal_server_id": bare_metal_server_id, + "network_interface_id": network_interface_id, + "id": id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.remove_bare_metal_server_network_interface_floating_ip(**req_copy) + + + def test_remove_bare_metal_server_network_interface_floating_ip_value_error_with_retries(self): + # Enable retries and run test_remove_bare_metal_server_network_interface_floating_ip_value_error. + _service.enable_retries() + self.test_remove_bare_metal_server_network_interface_floating_ip_value_error() + + # Disable retries and run test_remove_bare_metal_server_network_interface_floating_ip_value_error. + _service.disable_retries() + self.test_remove_bare_metal_server_network_interface_floating_ip_value_error() + +class TestGetBareMetalServerNetworkInterfaceFloatingIp(): + """ + Test Class for get_bare_metal_server_network_interface_floating_ip + """ + + @responses.activate + def test_get_bare_metal_server_network_interface_floating_ip_all_params(self): + """ + get_bare_metal_server_network_interface_floating_ip() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString') + mock_response = '{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + bare_metal_server_id = 'testString' + network_interface_id = 'testString' + id = 'testString' + + # Invoke method + response = _service.get_bare_metal_server_network_interface_floating_ip( + bare_metal_server_id, + network_interface_id, + id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_bare_metal_server_network_interface_floating_ip_all_params_with_retries(self): + # Enable retries and run test_get_bare_metal_server_network_interface_floating_ip_all_params. + _service.enable_retries() + self.test_get_bare_metal_server_network_interface_floating_ip_all_params() + + # Disable retries and run test_get_bare_metal_server_network_interface_floating_ip_all_params. + _service.disable_retries() + self.test_get_bare_metal_server_network_interface_floating_ip_all_params() + + @responses.activate + def test_get_bare_metal_server_network_interface_floating_ip_value_error(self): + """ + test_get_bare_metal_server_network_interface_floating_ip_value_error() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString') + mock_response = '{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + bare_metal_server_id = 'testString' + network_interface_id = 'testString' + id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "bare_metal_server_id": bare_metal_server_id, + "network_interface_id": network_interface_id, + "id": id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_bare_metal_server_network_interface_floating_ip(**req_copy) + + + def test_get_bare_metal_server_network_interface_floating_ip_value_error_with_retries(self): + # Enable retries and run test_get_bare_metal_server_network_interface_floating_ip_value_error. + _service.enable_retries() + self.test_get_bare_metal_server_network_interface_floating_ip_value_error() + + # Disable retries and run test_get_bare_metal_server_network_interface_floating_ip_value_error. + _service.disable_retries() + self.test_get_bare_metal_server_network_interface_floating_ip_value_error() + +class TestAddBareMetalServerNetworkInterfaceFloatingIp(): + """ + Test Class for add_bare_metal_server_network_interface_floating_ip + """ + + @responses.activate + def test_add_bare_metal_server_network_interface_floating_ip_all_params(self): + """ + add_bare_metal_server_network_interface_floating_ip() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString') + mock_response = '{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + responses.add(responses.PUT, + url, + body=mock_response, + content_type='application/json', + status=201) + + # Set up parameter values + bare_metal_server_id = 'testString' + network_interface_id = 'testString' + id = 'testString' + + # Invoke method + response = _service.add_bare_metal_server_network_interface_floating_ip( + bare_metal_server_id, + network_interface_id, + id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 201 + + def test_add_bare_metal_server_network_interface_floating_ip_all_params_with_retries(self): + # Enable retries and run test_add_bare_metal_server_network_interface_floating_ip_all_params. + _service.enable_retries() + self.test_add_bare_metal_server_network_interface_floating_ip_all_params() + + # Disable retries and run test_add_bare_metal_server_network_interface_floating_ip_all_params. + _service.disable_retries() + self.test_add_bare_metal_server_network_interface_floating_ip_all_params() + + @responses.activate + def test_add_bare_metal_server_network_interface_floating_ip_value_error(self): + """ + test_add_bare_metal_server_network_interface_floating_ip_value_error() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString') + mock_response = '{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + responses.add(responses.PUT, + url, + body=mock_response, + content_type='application/json', + status=201) + + # Set up parameter values + bare_metal_server_id = 'testString' + network_interface_id = 'testString' + id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "bare_metal_server_id": bare_metal_server_id, + "network_interface_id": network_interface_id, + "id": id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.add_bare_metal_server_network_interface_floating_ip(**req_copy) + + + def test_add_bare_metal_server_network_interface_floating_ip_value_error_with_retries(self): + # Enable retries and run test_add_bare_metal_server_network_interface_floating_ip_value_error. + _service.enable_retries() + self.test_add_bare_metal_server_network_interface_floating_ip_value_error() + + # Disable retries and run test_add_bare_metal_server_network_interface_floating_ip_value_error. + _service.disable_retries() + self.test_add_bare_metal_server_network_interface_floating_ip_value_error() + +class TestDeleteBareMetalServer(): + """ + Test Class for delete_bare_metal_server + """ + + @responses.activate + def test_delete_bare_metal_server_all_params(self): + """ + delete_bare_metal_server() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString') + responses.add(responses.DELETE, + url, + status=204) + + # Set up parameter values + id = 'testString' + + # Invoke method + response = _service.delete_bare_metal_server( + id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 204 + + def test_delete_bare_metal_server_all_params_with_retries(self): + # Enable retries and run test_delete_bare_metal_server_all_params. + _service.enable_retries() + self.test_delete_bare_metal_server_all_params() + + # Disable retries and run test_delete_bare_metal_server_all_params. + _service.disable_retries() + self.test_delete_bare_metal_server_all_params() + + @responses.activate + def test_delete_bare_metal_server_value_error(self): + """ + test_delete_bare_metal_server_value_error() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString') + responses.add(responses.DELETE, + url, + status=204) + + # Set up parameter values + id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "id": id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.delete_bare_metal_server(**req_copy) + + + def test_delete_bare_metal_server_value_error_with_retries(self): + # Enable retries and run test_delete_bare_metal_server_value_error. + _service.enable_retries() + self.test_delete_bare_metal_server_value_error() + + # Disable retries and run test_delete_bare_metal_server_value_error. + _service.disable_retries() + self.test_delete_bare_metal_server_value_error() + +class TestGetBareMetalServer(): + """ + Test Class for get_bare_metal_server + """ + + @responses.activate + def test_get_bare_metal_server_all_params(self): + """ + get_bare_metal_server() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString') + mock_response = '{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "failed", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + id = 'testString' + + # Invoke method + response = _service.get_bare_metal_server( + id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_bare_metal_server_all_params_with_retries(self): + # Enable retries and run test_get_bare_metal_server_all_params. + _service.enable_retries() + self.test_get_bare_metal_server_all_params() + + # Disable retries and run test_get_bare_metal_server_all_params. + _service.disable_retries() + self.test_get_bare_metal_server_all_params() + + @responses.activate + def test_get_bare_metal_server_value_error(self): + """ + test_get_bare_metal_server_value_error() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString') + mock_response = '{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "failed", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "id": id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_bare_metal_server(**req_copy) + + + def test_get_bare_metal_server_value_error_with_retries(self): + # Enable retries and run test_get_bare_metal_server_value_error. + _service.enable_retries() + self.test_get_bare_metal_server_value_error() + + # Disable retries and run test_get_bare_metal_server_value_error. + _service.disable_retries() + self.test_get_bare_metal_server_value_error() + +class TestUpdateBareMetalServer(): + """ + Test Class for update_bare_metal_server + """ + + @responses.activate + def test_update_bare_metal_server_all_params(self): + """ + update_bare_metal_server() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString') + mock_response = '{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "failed", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + responses.add(responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Construct a dict representation of a BareMetalServerPatch model + bare_metal_server_patch_model = {} + bare_metal_server_patch_model['name'] = 'my-bare-metal-server' + + # Set up parameter values + id = 'testString' + bare_metal_server_patch = bare_metal_server_patch_model + + # Invoke method + response = _service.update_bare_metal_server( + id, + bare_metal_server_patch, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body == bare_metal_server_patch + + def test_update_bare_metal_server_all_params_with_retries(self): + # Enable retries and run test_update_bare_metal_server_all_params. + _service.enable_retries() + self.test_update_bare_metal_server_all_params() + + # Disable retries and run test_update_bare_metal_server_all_params. + _service.disable_retries() + self.test_update_bare_metal_server_all_params() + + @responses.activate + def test_update_bare_metal_server_value_error(self): + """ + test_update_bare_metal_server_value_error() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString') + mock_response = '{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "failed", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + responses.add(responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Construct a dict representation of a BareMetalServerPatch model + bare_metal_server_patch_model = {} + bare_metal_server_patch_model['name'] = 'my-bare-metal-server' + + # Set up parameter values + id = 'testString' + bare_metal_server_patch = bare_metal_server_patch_model + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "id": id, + "bare_metal_server_patch": bare_metal_server_patch, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.update_bare_metal_server(**req_copy) + + + def test_update_bare_metal_server_value_error_with_retries(self): + # Enable retries and run test_update_bare_metal_server_value_error. + _service.enable_retries() + self.test_update_bare_metal_server_value_error() + + # Disable retries and run test_update_bare_metal_server_value_error. + _service.disable_retries() + self.test_update_bare_metal_server_value_error() + +class TestGetBareMetalServerInitialization(): + """ + Test Class for get_bare_metal_server_initialization + """ + + @responses.activate + def test_get_bare_metal_server_initialization_all_params(self): + """ + get_bare_metal_server_initialization() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/initialization') + mock_response = '{"image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}], "user_accounts": [{"encrypted_password": "VGhpcyBpcyBhbiBlbmNvZGVkIGJ5dGUgYXJyYXku", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}, "resource_type": "host_user_account", "username": "Administrator"}]}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + id = 'testString' + + # Invoke method + response = _service.get_bare_metal_server_initialization( + id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_bare_metal_server_initialization_all_params_with_retries(self): + # Enable retries and run test_get_bare_metal_server_initialization_all_params. + _service.enable_retries() + self.test_get_bare_metal_server_initialization_all_params() + + # Disable retries and run test_get_bare_metal_server_initialization_all_params. + _service.disable_retries() + self.test_get_bare_metal_server_initialization_all_params() + + @responses.activate + def test_get_bare_metal_server_initialization_value_error(self): + """ + test_get_bare_metal_server_initialization_value_error() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/initialization') + mock_response = '{"image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}], "user_accounts": [{"encrypted_password": "VGhpcyBpcyBhbiBlbmNvZGVkIGJ5dGUgYXJyYXku", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}, "resource_type": "host_user_account", "username": "Administrator"}]}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "id": id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_bare_metal_server_initialization(**req_copy) + + + def test_get_bare_metal_server_initialization_value_error_with_retries(self): + # Enable retries and run test_get_bare_metal_server_initialization_value_error. + _service.enable_retries() + self.test_get_bare_metal_server_initialization_value_error() + + # Disable retries and run test_get_bare_metal_server_initialization_value_error. + _service.disable_retries() + self.test_get_bare_metal_server_initialization_value_error() + +class TestRestartBareMetalServer(): + """ + Test Class for restart_bare_metal_server + """ + + @responses.activate + def test_restart_bare_metal_server_all_params(self): + """ + restart_bare_metal_server() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/restart') + responses.add(responses.POST, + url, + status=204) + + # Set up parameter values + id = 'testString' + + # Invoke method + response = _service.restart_bare_metal_server( + id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 204 + + def test_restart_bare_metal_server_all_params_with_retries(self): + # Enable retries and run test_restart_bare_metal_server_all_params. + _service.enable_retries() + self.test_restart_bare_metal_server_all_params() + + # Disable retries and run test_restart_bare_metal_server_all_params. + _service.disable_retries() + self.test_restart_bare_metal_server_all_params() + + @responses.activate + def test_restart_bare_metal_server_value_error(self): + """ + test_restart_bare_metal_server_value_error() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/restart') + responses.add(responses.POST, + url, + status=204) + + # Set up parameter values + id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "id": id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.restart_bare_metal_server(**req_copy) + + + def test_restart_bare_metal_server_value_error_with_retries(self): + # Enable retries and run test_restart_bare_metal_server_value_error. + _service.enable_retries() + self.test_restart_bare_metal_server_value_error() + + # Disable retries and run test_restart_bare_metal_server_value_error. + _service.disable_retries() + self.test_restart_bare_metal_server_value_error() + +class TestStartBareMetalServer(): + """ + Test Class for start_bare_metal_server + """ + + @responses.activate + def test_start_bare_metal_server_all_params(self): + """ + start_bare_metal_server() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/start') + responses.add(responses.POST, + url, + status=204) + + # Set up parameter values + id = 'testString' + + # Invoke method + response = _service.start_bare_metal_server( + id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 204 + + def test_start_bare_metal_server_all_params_with_retries(self): + # Enable retries and run test_start_bare_metal_server_all_params. + _service.enable_retries() + self.test_start_bare_metal_server_all_params() + + # Disable retries and run test_start_bare_metal_server_all_params. + _service.disable_retries() + self.test_start_bare_metal_server_all_params() + + @responses.activate + def test_start_bare_metal_server_value_error(self): + """ + test_start_bare_metal_server_value_error() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/start') + responses.add(responses.POST, + url, + status=204) + + # Set up parameter values + id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "id": id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.start_bare_metal_server(**req_copy) + + + def test_start_bare_metal_server_value_error_with_retries(self): + # Enable retries and run test_start_bare_metal_server_value_error. + _service.enable_retries() + self.test_start_bare_metal_server_value_error() + + # Disable retries and run test_start_bare_metal_server_value_error. + _service.disable_retries() + self.test_start_bare_metal_server_value_error() + +class TestStopBareMetalServer(): + """ + Test Class for stop_bare_metal_server + """ + + @responses.activate + def test_stop_bare_metal_server_all_params(self): + """ + stop_bare_metal_server() + """ + # Set up mock + url = preprocess_url('/bare_metal_servers/testString/stop') + responses.add(responses.POST, + url, + status=204) + + # Set up parameter values + id = 'testString' + type = 'hard' + + # Invoke method + response = _service.stop_bare_metal_server( + id, + type, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 204 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['type'] == 'hard' + + def test_stop_bare_metal_server_all_params_with_retries(self): + # Enable retries and run test_stop_bare_metal_server_all_params. + _service.enable_retries() + self.test_stop_bare_metal_server_all_params() + + # Disable retries and run test_stop_bare_metal_server_all_params. + _service.disable_retries() + self.test_stop_bare_metal_server_all_params() + + @responses.activate + def test_stop_bare_metal_server_value_error(self): """ - test_list_bare_metal_server_network_interface_floating_ips_value_error() + test_stop_bare_metal_server_value_error() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/floating_ips') - mock_response = '{"floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}' + url = preprocess_url('/bare_metal_servers/testString/stop') + responses.add(responses.POST, + url, + status=204) + + # Set up parameter values + id = 'testString' + type = 'hard' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "id": id, + "type": type, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.stop_bare_metal_server(**req_copy) + + + def test_stop_bare_metal_server_value_error_with_retries(self): + # Enable retries and run test_stop_bare_metal_server_value_error. + _service.enable_retries() + self.test_stop_bare_metal_server_value_error() + + # Disable retries and run test_stop_bare_metal_server_value_error. + _service.disable_retries() + self.test_stop_bare_metal_server_value_error() + +# endregion +############################################################################## +# End of Service: BareMetalServers +############################################################################## + +############################################################################## +# Start of Service: Volumes +############################################################################## +# region + +class TestNewInstance(): + """ + Test Class for new_instance + """ + + def test_new_instance(self): + """ + new_instance() + """ + os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' + + service = VpcV1.new_instance( + version=version, + service_name='TEST_SERVICE', + ) + + assert service is not None + assert isinstance(service, VpcV1) + + def test_new_instance_without_authenticator(self): + """ + new_instance_without_authenticator() + """ + with pytest.raises(ValueError, match='authenticator must be provided'): + service = VpcV1.new_instance( + version=version, + service_name='TEST_SERVICE_NOT_FOUND', + ) + + def test_new_instance_without_required_params(self): + """ + new_instance_without_required_params() + """ + with pytest.raises(TypeError, match='new_instance\\(\\) missing \\d required positional arguments?: \'.*\''): + service = VpcV1.new_instance() + + def test_new_instance_required_param_none(self): + """ + new_instance_required_param_none() + """ + with pytest.raises(ValueError, match='version must be provided'): + service = VpcV1.new_instance( + version=None, + ) +class TestListVolumeProfiles(): + """ + Test Class for list_volume_profiles + """ + + @responses.activate + def test_list_volume_profiles_all_params(self): + """ + list_volume_profiles() + """ + # Set up mock + url = preprocess_url('/volume/profiles') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -15371,55 +17625,449 @@ def test_list_bare_metal_server_network_interface_floating_ips_value_error(self) status=200) # Set up parameter values - bare_metal_server_id = 'testString' - network_interface_id = 'testString' + start = 'testString' + limit = 1 + + # Invoke method + response = _service.list_volume_profiles( + start=start, + limit=limit, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?',1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'start={}'.format(start) in query_string + assert 'limit={}'.format(limit) in query_string + + def test_list_volume_profiles_all_params_with_retries(self): + # Enable retries and run test_list_volume_profiles_all_params. + _service.enable_retries() + self.test_list_volume_profiles_all_params() + + # Disable retries and run test_list_volume_profiles_all_params. + _service.disable_retries() + self.test_list_volume_profiles_all_params() + + @responses.activate + def test_list_volume_profiles_required_params(self): + """ + test_list_volume_profiles_required_params() + """ + # Set up mock + url = preprocess_url('/volume/profiles') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}], "total_count": 132}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Invoke method + response = _service.list_volume_profiles() + + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_volume_profiles_required_params_with_retries(self): + # Enable retries and run test_list_volume_profiles_required_params. + _service.enable_retries() + self.test_list_volume_profiles_required_params() + + # Disable retries and run test_list_volume_profiles_required_params. + _service.disable_retries() + self.test_list_volume_profiles_required_params() + + @responses.activate + def test_list_volume_profiles_value_error(self): + """ + test_list_volume_profiles_value_error() + """ + # Set up mock + url = preprocess_url('/volume/profiles') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}], "total_count": 132}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) # Pass in all but one required param and check for a ValueError req_param_dict = { - "bare_metal_server_id": bare_metal_server_id, - "network_interface_id": network_interface_id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_bare_metal_server_network_interface_floating_ips(**req_copy) + _service.list_volume_profiles(**req_copy) - def test_list_bare_metal_server_network_interface_floating_ips_value_error_with_retries(self): - # Enable retries and run test_list_bare_metal_server_network_interface_floating_ips_value_error. + def test_list_volume_profiles_value_error_with_retries(self): + # Enable retries and run test_list_volume_profiles_value_error. + _service.enable_retries() + self.test_list_volume_profiles_value_error() + + # Disable retries and run test_list_volume_profiles_value_error. + _service.disable_retries() + self.test_list_volume_profiles_value_error() + +class TestGetVolumeProfile(): + """ + Test Class for get_volume_profile + """ + + @responses.activate + def test_get_volume_profile_all_params(self): + """ + get_volume_profile() + """ + # Set up mock + url = preprocess_url('/volume/profiles/testString') + mock_response = '{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + name = 'testString' + + # Invoke method + response = _service.get_volume_profile( + name, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_volume_profile_all_params_with_retries(self): + # Enable retries and run test_get_volume_profile_all_params. + _service.enable_retries() + self.test_get_volume_profile_all_params() + + # Disable retries and run test_get_volume_profile_all_params. + _service.disable_retries() + self.test_get_volume_profile_all_params() + + @responses.activate + def test_get_volume_profile_value_error(self): + """ + test_get_volume_profile_value_error() + """ + # Set up mock + url = preprocess_url('/volume/profiles/testString') + mock_response = '{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + name = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "name": name, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_volume_profile(**req_copy) + + + def test_get_volume_profile_value_error_with_retries(self): + # Enable retries and run test_get_volume_profile_value_error. + _service.enable_retries() + self.test_get_volume_profile_value_error() + + # Disable retries and run test_get_volume_profile_value_error. + _service.disable_retries() + self.test_get_volume_profile_value_error() + +class TestListVolumes(): + """ + Test Class for list_volumes + """ + + @responses.activate + def test_list_volumes_all_params(self): + """ + list_volumes() + """ + # Set up mock + url = preprocess_url('/volumes') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volumes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volumes?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "volumes": [{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["user_tags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + start = 'testString' + limit = 1 + name = 'testString' + zone_name = 'testString' + + # Invoke method + response = _service.list_volumes( + start=start, + limit=limit, + name=name, + zone_name=zone_name, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?',1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'start={}'.format(start) in query_string + assert 'limit={}'.format(limit) in query_string + assert 'name={}'.format(name) in query_string + assert 'zone.name={}'.format(zone_name) in query_string + + def test_list_volumes_all_params_with_retries(self): + # Enable retries and run test_list_volumes_all_params. + _service.enable_retries() + self.test_list_volumes_all_params() + + # Disable retries and run test_list_volumes_all_params. + _service.disable_retries() + self.test_list_volumes_all_params() + + @responses.activate + def test_list_volumes_required_params(self): + """ + test_list_volumes_required_params() + """ + # Set up mock + url = preprocess_url('/volumes') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volumes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volumes?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "volumes": [{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["user_tags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Invoke method + response = _service.list_volumes() + + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_volumes_required_params_with_retries(self): + # Enable retries and run test_list_volumes_required_params. + _service.enable_retries() + self.test_list_volumes_required_params() + + # Disable retries and run test_list_volumes_required_params. + _service.disable_retries() + self.test_list_volumes_required_params() + + @responses.activate + def test_list_volumes_value_error(self): + """ + test_list_volumes_value_error() + """ + # Set up mock + url = preprocess_url('/volumes') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volumes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volumes?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "volumes": [{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["user_tags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_volumes(**req_copy) + + + def test_list_volumes_value_error_with_retries(self): + # Enable retries and run test_list_volumes_value_error. + _service.enable_retries() + self.test_list_volumes_value_error() + + # Disable retries and run test_list_volumes_value_error. + _service.disable_retries() + self.test_list_volumes_value_error() + +class TestCreateVolume(): + """ + Test Class for create_volume + """ + + @responses.activate + def test_create_volume_all_params(self): + """ + create_volume() + """ + # Set up mock + url = preprocess_url('/volumes') + mock_response = '{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["user_tags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + responses.add(responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201) + + # Construct a dict representation of a VolumeProfileIdentityByName model + volume_profile_identity_model = {} + volume_profile_identity_model['name'] = '5iops-tier' + + # Construct a dict representation of a ResourceGroupIdentityById model + resource_group_identity_model = {} + resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + + # Construct a dict representation of a ZoneIdentityByName model + zone_identity_model = {} + zone_identity_model['name'] = 'us-south-1' + + # Construct a dict representation of a EncryptionKeyIdentityByCRN model + encryption_key_identity_model = {} + encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179' + + # Construct a dict representation of a VolumePrototypeVolumeByCapacity model + volume_prototype_model = {} + volume_prototype_model['iops'] = 10000 + volume_prototype_model['name'] = 'my-volume' + volume_prototype_model['profile'] = volume_profile_identity_model + volume_prototype_model['resource_group'] = resource_group_identity_model + volume_prototype_model['user_tags'] = ['testString'] + volume_prototype_model['zone'] = zone_identity_model + volume_prototype_model['capacity'] = 100 + volume_prototype_model['encryption_key'] = encryption_key_identity_model + + # Set up parameter values + volume_prototype = volume_prototype_model + + # Invoke method + response = _service.create_volume( + volume_prototype, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 201 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body == volume_prototype + + def test_create_volume_all_params_with_retries(self): + # Enable retries and run test_create_volume_all_params. + _service.enable_retries() + self.test_create_volume_all_params() + + # Disable retries and run test_create_volume_all_params. + _service.disable_retries() + self.test_create_volume_all_params() + + @responses.activate + def test_create_volume_value_error(self): + """ + test_create_volume_value_error() + """ + # Set up mock + url = preprocess_url('/volumes') + mock_response = '{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["user_tags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + responses.add(responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201) + + # Construct a dict representation of a VolumeProfileIdentityByName model + volume_profile_identity_model = {} + volume_profile_identity_model['name'] = '5iops-tier' + + # Construct a dict representation of a ResourceGroupIdentityById model + resource_group_identity_model = {} + resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + + # Construct a dict representation of a ZoneIdentityByName model + zone_identity_model = {} + zone_identity_model['name'] = 'us-south-1' + + # Construct a dict representation of a EncryptionKeyIdentityByCRN model + encryption_key_identity_model = {} + encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179' + + # Construct a dict representation of a VolumePrototypeVolumeByCapacity model + volume_prototype_model = {} + volume_prototype_model['iops'] = 10000 + volume_prototype_model['name'] = 'my-volume' + volume_prototype_model['profile'] = volume_profile_identity_model + volume_prototype_model['resource_group'] = resource_group_identity_model + volume_prototype_model['user_tags'] = ['testString'] + volume_prototype_model['zone'] = zone_identity_model + volume_prototype_model['capacity'] = 100 + volume_prototype_model['encryption_key'] = encryption_key_identity_model + + # Set up parameter values + volume_prototype = volume_prototype_model + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "volume_prototype": volume_prototype, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.create_volume(**req_copy) + + + def test_create_volume_value_error_with_retries(self): + # Enable retries and run test_create_volume_value_error. _service.enable_retries() - self.test_list_bare_metal_server_network_interface_floating_ips_value_error() + self.test_create_volume_value_error() - # Disable retries and run test_list_bare_metal_server_network_interface_floating_ips_value_error. + # Disable retries and run test_create_volume_value_error. _service.disable_retries() - self.test_list_bare_metal_server_network_interface_floating_ips_value_error() + self.test_create_volume_value_error() -class TestRemoveBareMetalServerNetworkInterfaceFloatingIp(): +class TestDeleteVolume(): """ - Test Class for remove_bare_metal_server_network_interface_floating_ip + Test Class for delete_volume """ @responses.activate - def test_remove_bare_metal_server_network_interface_floating_ip_all_params(self): + def test_delete_volume_all_params(self): """ - remove_bare_metal_server_network_interface_floating_ip() + delete_volume() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString') + url = preprocess_url('/volumes/testString') responses.add(responses.DELETE, url, status=204) # Set up parameter values - bare_metal_server_id = 'testString' - network_interface_id = 'testString' id = 'testString' + if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"' # Invoke method - response = _service.remove_bare_metal_server_network_interface_floating_ip( - bare_metal_server_id, - network_interface_id, + response = _service.delete_volume( id, + if_match=if_match, headers={} ) @@ -15427,472 +18075,463 @@ def test_remove_bare_metal_server_network_interface_floating_ip_all_params(self) assert len(responses.calls) == 1 assert response.status_code == 204 - def test_remove_bare_metal_server_network_interface_floating_ip_all_params_with_retries(self): - # Enable retries and run test_remove_bare_metal_server_network_interface_floating_ip_all_params. + def test_delete_volume_all_params_with_retries(self): + # Enable retries and run test_delete_volume_all_params. _service.enable_retries() - self.test_remove_bare_metal_server_network_interface_floating_ip_all_params() + self.test_delete_volume_all_params() - # Disable retries and run test_remove_bare_metal_server_network_interface_floating_ip_all_params. + # Disable retries and run test_delete_volume_all_params. _service.disable_retries() - self.test_remove_bare_metal_server_network_interface_floating_ip_all_params() + self.test_delete_volume_all_params() @responses.activate - def test_remove_bare_metal_server_network_interface_floating_ip_value_error(self): + def test_delete_volume_required_params(self): """ - test_remove_bare_metal_server_network_interface_floating_ip_value_error() + test_delete_volume_required_params() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString') + url = preprocess_url('/volumes/testString') responses.add(responses.DELETE, url, status=204) # Set up parameter values - bare_metal_server_id = 'testString' - network_interface_id = 'testString' - id = 'testString' - - # Pass in all but one required param and check for a ValueError - req_param_dict = { - "bare_metal_server_id": bare_metal_server_id, - "network_interface_id": network_interface_id, - "id": id, - } - for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} - with pytest.raises(ValueError): - _service.remove_bare_metal_server_network_interface_floating_ip(**req_copy) - - - def test_remove_bare_metal_server_network_interface_floating_ip_value_error_with_retries(self): - # Enable retries and run test_remove_bare_metal_server_network_interface_floating_ip_value_error. - _service.enable_retries() - self.test_remove_bare_metal_server_network_interface_floating_ip_value_error() - - # Disable retries and run test_remove_bare_metal_server_network_interface_floating_ip_value_error. - _service.disable_retries() - self.test_remove_bare_metal_server_network_interface_floating_ip_value_error() - -class TestGetBareMetalServerNetworkInterfaceFloatingIp(): - """ - Test Class for get_bare_metal_server_network_interface_floating_ip - """ - - @responses.activate - def test_get_bare_metal_server_network_interface_floating_ip_all_params(self): - """ - get_bare_metal_server_network_interface_floating_ip() - """ - # Set up mock - url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString') - mock_response = '{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) - - # Set up parameter values - bare_metal_server_id = 'testString' - network_interface_id = 'testString' id = 'testString' # Invoke method - response = _service.get_bare_metal_server_network_interface_floating_ip( - bare_metal_server_id, - network_interface_id, + response = _service.delete_volume( id, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 200 + assert response.status_code == 204 - def test_get_bare_metal_server_network_interface_floating_ip_all_params_with_retries(self): - # Enable retries and run test_get_bare_metal_server_network_interface_floating_ip_all_params. + def test_delete_volume_required_params_with_retries(self): + # Enable retries and run test_delete_volume_required_params. _service.enable_retries() - self.test_get_bare_metal_server_network_interface_floating_ip_all_params() + self.test_delete_volume_required_params() - # Disable retries and run test_get_bare_metal_server_network_interface_floating_ip_all_params. + # Disable retries and run test_delete_volume_required_params. _service.disable_retries() - self.test_get_bare_metal_server_network_interface_floating_ip_all_params() + self.test_delete_volume_required_params() @responses.activate - def test_get_bare_metal_server_network_interface_floating_ip_value_error(self): + def test_delete_volume_value_error(self): """ - test_get_bare_metal_server_network_interface_floating_ip_value_error() + test_delete_volume_value_error() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString') - mock_response = '{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' - responses.add(responses.GET, + url = preprocess_url('/volumes/testString') + responses.add(responses.DELETE, url, - body=mock_response, - content_type='application/json', - status=200) + status=204) # Set up parameter values - bare_metal_server_id = 'testString' - network_interface_id = 'testString' id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "bare_metal_server_id": bare_metal_server_id, - "network_interface_id": network_interface_id, "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.get_bare_metal_server_network_interface_floating_ip(**req_copy) + _service.delete_volume(**req_copy) - def test_get_bare_metal_server_network_interface_floating_ip_value_error_with_retries(self): - # Enable retries and run test_get_bare_metal_server_network_interface_floating_ip_value_error. + def test_delete_volume_value_error_with_retries(self): + # Enable retries and run test_delete_volume_value_error. _service.enable_retries() - self.test_get_bare_metal_server_network_interface_floating_ip_value_error() + self.test_delete_volume_value_error() - # Disable retries and run test_get_bare_metal_server_network_interface_floating_ip_value_error. + # Disable retries and run test_delete_volume_value_error. _service.disable_retries() - self.test_get_bare_metal_server_network_interface_floating_ip_value_error() + self.test_delete_volume_value_error() -class TestAddBareMetalServerNetworkInterfaceFloatingIp(): +class TestGetVolume(): """ - Test Class for add_bare_metal_server_network_interface_floating_ip + Test Class for get_volume """ @responses.activate - def test_add_bare_metal_server_network_interface_floating_ip_all_params(self): + def test_get_volume_all_params(self): """ - add_bare_metal_server_network_interface_floating_ip() + get_volume() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString') - mock_response = '{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' - responses.add(responses.PUT, + url = preprocess_url('/volumes/testString') + mock_response = '{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["user_tags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + responses.add(responses.GET, url, body=mock_response, content_type='application/json', - status=201) + status=200) # Set up parameter values - bare_metal_server_id = 'testString' - network_interface_id = 'testString' id = 'testString' # Invoke method - response = _service.add_bare_metal_server_network_interface_floating_ip( - bare_metal_server_id, - network_interface_id, + response = _service.get_volume( id, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 201 + assert response.status_code == 200 - def test_add_bare_metal_server_network_interface_floating_ip_all_params_with_retries(self): - # Enable retries and run test_add_bare_metal_server_network_interface_floating_ip_all_params. + def test_get_volume_all_params_with_retries(self): + # Enable retries and run test_get_volume_all_params. _service.enable_retries() - self.test_add_bare_metal_server_network_interface_floating_ip_all_params() + self.test_get_volume_all_params() - # Disable retries and run test_add_bare_metal_server_network_interface_floating_ip_all_params. + # Disable retries and run test_get_volume_all_params. _service.disable_retries() - self.test_add_bare_metal_server_network_interface_floating_ip_all_params() + self.test_get_volume_all_params() @responses.activate - def test_add_bare_metal_server_network_interface_floating_ip_value_error(self): + def test_get_volume_value_error(self): """ - test_add_bare_metal_server_network_interface_floating_ip_value_error() + test_get_volume_value_error() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString') - mock_response = '{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' - responses.add(responses.PUT, + url = preprocess_url('/volumes/testString') + mock_response = '{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["user_tags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + responses.add(responses.GET, url, body=mock_response, content_type='application/json', - status=201) + status=200) # Set up parameter values - bare_metal_server_id = 'testString' - network_interface_id = 'testString' id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "bare_metal_server_id": bare_metal_server_id, - "network_interface_id": network_interface_id, "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.add_bare_metal_server_network_interface_floating_ip(**req_copy) + _service.get_volume(**req_copy) - def test_add_bare_metal_server_network_interface_floating_ip_value_error_with_retries(self): - # Enable retries and run test_add_bare_metal_server_network_interface_floating_ip_value_error. + def test_get_volume_value_error_with_retries(self): + # Enable retries and run test_get_volume_value_error. _service.enable_retries() - self.test_add_bare_metal_server_network_interface_floating_ip_value_error() + self.test_get_volume_value_error() - # Disable retries and run test_add_bare_metal_server_network_interface_floating_ip_value_error. + # Disable retries and run test_get_volume_value_error. _service.disable_retries() - self.test_add_bare_metal_server_network_interface_floating_ip_value_error() + self.test_get_volume_value_error() -class TestListBareMetalServerNetworkInterfaceIps(): +class TestUpdateVolume(): """ - Test Class for list_bare_metal_server_network_interface_ips + Test Class for update_volume """ @responses.activate - def test_list_bare_metal_server_network_interface_ips_all_params(self): + def test_update_volume_all_params(self): """ - list_bare_metal_server_network_interface_ips() + update_volume() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/ips') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e/ips?limit=20"}, "ips": [{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e/ips?start=a404e343444b4e1095c9edba76672d67&limit=20"}, "total_count": 132}' - responses.add(responses.GET, + url = preprocess_url('/volumes/testString') + mock_response = '{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["user_tags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) + # Construct a dict representation of a VolumeProfileIdentityByName model + volume_profile_identity_model = {} + volume_profile_identity_model['name'] = 'general-purpose' + + # Construct a dict representation of a VolumePatch model + volume_patch_model = {} + volume_patch_model['capacity'] = 100 + volume_patch_model['iops'] = 10000 + volume_patch_model['name'] = 'my-volume' + volume_patch_model['profile'] = volume_profile_identity_model + volume_patch_model['user_tags'] = ['testString'] + # Set up parameter values - bare_metal_server_id = 'testString' - network_interface_id = 'testString' + id = 'testString' + volume_patch = volume_patch_model + if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"' # Invoke method - response = _service.list_bare_metal_server_network_interface_ips( - bare_metal_server_id, - network_interface_id, + response = _service.update_volume( + id, + volume_patch, + if_match=if_match, headers={} ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body == volume_patch - def test_list_bare_metal_server_network_interface_ips_all_params_with_retries(self): - # Enable retries and run test_list_bare_metal_server_network_interface_ips_all_params. + def test_update_volume_all_params_with_retries(self): + # Enable retries and run test_update_volume_all_params. _service.enable_retries() - self.test_list_bare_metal_server_network_interface_ips_all_params() + self.test_update_volume_all_params() - # Disable retries and run test_list_bare_metal_server_network_interface_ips_all_params. + # Disable retries and run test_update_volume_all_params. _service.disable_retries() - self.test_list_bare_metal_server_network_interface_ips_all_params() + self.test_update_volume_all_params() @responses.activate - def test_list_bare_metal_server_network_interface_ips_value_error(self): + def test_update_volume_required_params(self): """ - test_list_bare_metal_server_network_interface_ips_value_error() + test_update_volume_required_params() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/ips') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e/ips?limit=20"}, "ips": [{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e/ips?start=a404e343444b4e1095c9edba76672d67&limit=20"}, "total_count": 132}' - responses.add(responses.GET, + url = preprocess_url('/volumes/testString') + mock_response = '{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["user_tags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) - # Set up parameter values - bare_metal_server_id = 'testString' - network_interface_id = 'testString' - - # Pass in all but one required param and check for a ValueError - req_param_dict = { - "bare_metal_server_id": bare_metal_server_id, - "network_interface_id": network_interface_id, - } - for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} - with pytest.raises(ValueError): - _service.list_bare_metal_server_network_interface_ips(**req_copy) - - - def test_list_bare_metal_server_network_interface_ips_value_error_with_retries(self): - # Enable retries and run test_list_bare_metal_server_network_interface_ips_value_error. - _service.enable_retries() - self.test_list_bare_metal_server_network_interface_ips_value_error() - - # Disable retries and run test_list_bare_metal_server_network_interface_ips_value_error. - _service.disable_retries() - self.test_list_bare_metal_server_network_interface_ips_value_error() - -class TestGetBareMetalServerNetworkInterfaceIp(): - """ - Test Class for get_bare_metal_server_network_interface_ip - """ + # Construct a dict representation of a VolumeProfileIdentityByName model + volume_profile_identity_model = {} + volume_profile_identity_model['name'] = 'general-purpose' - @responses.activate - def test_get_bare_metal_server_network_interface_ip_all_params(self): - """ - get_bare_metal_server_network_interface_ip() - """ - # Set up mock - url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/ips/testString') - mock_response = '{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + # Construct a dict representation of a VolumePatch model + volume_patch_model = {} + volume_patch_model['capacity'] = 100 + volume_patch_model['iops'] = 10000 + volume_patch_model['name'] = 'my-volume' + volume_patch_model['profile'] = volume_profile_identity_model + volume_patch_model['user_tags'] = ['testString'] # Set up parameter values - bare_metal_server_id = 'testString' - network_interface_id = 'testString' id = 'testString' + volume_patch = volume_patch_model # Invoke method - response = _service.get_bare_metal_server_network_interface_ip( - bare_metal_server_id, - network_interface_id, + response = _service.update_volume( id, + volume_patch, headers={} ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body == volume_patch - def test_get_bare_metal_server_network_interface_ip_all_params_with_retries(self): - # Enable retries and run test_get_bare_metal_server_network_interface_ip_all_params. + def test_update_volume_required_params_with_retries(self): + # Enable retries and run test_update_volume_required_params. _service.enable_retries() - self.test_get_bare_metal_server_network_interface_ip_all_params() + self.test_update_volume_required_params() - # Disable retries and run test_get_bare_metal_server_network_interface_ip_all_params. + # Disable retries and run test_update_volume_required_params. _service.disable_retries() - self.test_get_bare_metal_server_network_interface_ip_all_params() + self.test_update_volume_required_params() @responses.activate - def test_get_bare_metal_server_network_interface_ip_value_error(self): + def test_update_volume_value_error(self): """ - test_get_bare_metal_server_network_interface_ip_value_error() + test_update_volume_value_error() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/network_interfaces/testString/ips/testString') - mock_response = '{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}' - responses.add(responses.GET, + url = preprocess_url('/volumes/testString') + mock_response = '{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["user_tags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) + # Construct a dict representation of a VolumeProfileIdentityByName model + volume_profile_identity_model = {} + volume_profile_identity_model['name'] = 'general-purpose' + + # Construct a dict representation of a VolumePatch model + volume_patch_model = {} + volume_patch_model['capacity'] = 100 + volume_patch_model['iops'] = 10000 + volume_patch_model['name'] = 'my-volume' + volume_patch_model['profile'] = volume_profile_identity_model + volume_patch_model['user_tags'] = ['testString'] + # Set up parameter values - bare_metal_server_id = 'testString' - network_interface_id = 'testString' id = 'testString' + volume_patch = volume_patch_model # Pass in all but one required param and check for a ValueError req_param_dict = { - "bare_metal_server_id": bare_metal_server_id, - "network_interface_id": network_interface_id, "id": id, + "volume_patch": volume_patch, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.get_bare_metal_server_network_interface_ip(**req_copy) + _service.update_volume(**req_copy) - def test_get_bare_metal_server_network_interface_ip_value_error_with_retries(self): - # Enable retries and run test_get_bare_metal_server_network_interface_ip_value_error. + def test_update_volume_value_error_with_retries(self): + # Enable retries and run test_update_volume_value_error. _service.enable_retries() - self.test_get_bare_metal_server_network_interface_ip_value_error() + self.test_update_volume_value_error() - # Disable retries and run test_get_bare_metal_server_network_interface_ip_value_error. + # Disable retries and run test_update_volume_value_error. _service.disable_retries() - self.test_get_bare_metal_server_network_interface_ip_value_error() + self.test_update_volume_value_error() -class TestDeleteBareMetalServer(): +# endregion +############################################################################## +# End of Service: Volumes +############################################################################## + +############################################################################## +# Start of Service: Snapshots +############################################################################## +# region + +class TestNewInstance(): """ - Test Class for delete_bare_metal_server + Test Class for new_instance + """ + + def test_new_instance(self): + """ + new_instance() + """ + os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' + + service = VpcV1.new_instance( + version=version, + service_name='TEST_SERVICE', + ) + + assert service is not None + assert isinstance(service, VpcV1) + + def test_new_instance_without_authenticator(self): + """ + new_instance_without_authenticator() + """ + with pytest.raises(ValueError, match='authenticator must be provided'): + service = VpcV1.new_instance( + version=version, + service_name='TEST_SERVICE_NOT_FOUND', + ) + + def test_new_instance_without_required_params(self): + """ + new_instance_without_required_params() + """ + with pytest.raises(TypeError, match='new_instance\\(\\) missing \\d required positional arguments?: \'.*\''): + service = VpcV1.new_instance() + + def test_new_instance_required_param_none(self): + """ + new_instance_required_param_none() + """ + with pytest.raises(ValueError, match='version must be provided'): + service = VpcV1.new_instance( + version=None, + ) +class TestDeleteSnapshots(): + """ + Test Class for delete_snapshots """ @responses.activate - def test_delete_bare_metal_server_all_params(self): + def test_delete_snapshots_all_params(self): """ - delete_bare_metal_server() + delete_snapshots() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString') + url = preprocess_url('/snapshots') responses.add(responses.DELETE, url, status=204) # Set up parameter values - id = 'testString' + source_volume_id = 'testString' # Invoke method - response = _service.delete_bare_metal_server( - id, + response = _service.delete_snapshots( + source_volume_id, headers={} ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 204 + # Validate query params + query_string = responses.calls[0].request.url.split('?',1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'source_volume.id={}'.format(source_volume_id) in query_string - def test_delete_bare_metal_server_all_params_with_retries(self): - # Enable retries and run test_delete_bare_metal_server_all_params. + def test_delete_snapshots_all_params_with_retries(self): + # Enable retries and run test_delete_snapshots_all_params. _service.enable_retries() - self.test_delete_bare_metal_server_all_params() + self.test_delete_snapshots_all_params() - # Disable retries and run test_delete_bare_metal_server_all_params. + # Disable retries and run test_delete_snapshots_all_params. _service.disable_retries() - self.test_delete_bare_metal_server_all_params() + self.test_delete_snapshots_all_params() @responses.activate - def test_delete_bare_metal_server_value_error(self): + def test_delete_snapshots_value_error(self): """ - test_delete_bare_metal_server_value_error() + test_delete_snapshots_value_error() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString') + url = preprocess_url('/snapshots') responses.add(responses.DELETE, url, status=204) # Set up parameter values - id = 'testString' + source_volume_id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "id": id, + "source_volume_id": source_volume_id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.delete_bare_metal_server(**req_copy) + _service.delete_snapshots(**req_copy) - def test_delete_bare_metal_server_value_error_with_retries(self): - # Enable retries and run test_delete_bare_metal_server_value_error. + def test_delete_snapshots_value_error_with_retries(self): + # Enable retries and run test_delete_snapshots_value_error. _service.enable_retries() - self.test_delete_bare_metal_server_value_error() + self.test_delete_snapshots_value_error() - # Disable retries and run test_delete_bare_metal_server_value_error. + # Disable retries and run test_delete_snapshots_value_error. _service.disable_retries() - self.test_delete_bare_metal_server_value_error() + self.test_delete_snapshots_value_error() -class TestGetBareMetalServer(): +class TestListSnapshots(): """ - Test Class for get_bare_metal_server + Test Class for list_snapshots """ @responses.activate - def test_get_bare_metal_server_all_params(self): + def test_list_snapshots_all_params(self): """ - get_bare_metal_server() + list_snapshots() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString') - mock_response = '{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "failed", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + url = preprocess_url('/snapshots') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "snapshots": [{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["service_tags"], "size": 1, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["user_tags"]}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -15900,245 +18539,282 @@ def test_get_bare_metal_server_all_params(self): status=200) # Set up parameter values - id = 'testString' + start = 'testString' + limit = 1 + tag = 'testString' + resource_group_id = 'testString' + name = 'testString' + source_volume_id = 'testString' + source_volume_crn = 'testString' + source_image_id = 'testString' + source_image_crn = 'testString' + sort = 'name' + backup_policy_plan_id = 'testString' + + # Invoke method + response = _service.list_snapshots( + start=start, + limit=limit, + tag=tag, + resource_group_id=resource_group_id, + name=name, + source_volume_id=source_volume_id, + source_volume_crn=source_volume_crn, + source_image_id=source_image_id, + source_image_crn=source_image_crn, + sort=sort, + backup_policy_plan_id=backup_policy_plan_id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?',1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'start={}'.format(start) in query_string + assert 'limit={}'.format(limit) in query_string + assert 'tag={}'.format(tag) in query_string + assert 'resource_group.id={}'.format(resource_group_id) in query_string + assert 'name={}'.format(name) in query_string + assert 'source_volume.id={}'.format(source_volume_id) in query_string + assert 'source_volume.crn={}'.format(source_volume_crn) in query_string + assert 'source_image.id={}'.format(source_image_id) in query_string + assert 'source_image.crn={}'.format(source_image_crn) in query_string + assert 'sort={}'.format(sort) in query_string + assert 'backup_policy_plan.id={}'.format(backup_policy_plan_id) in query_string + + def test_list_snapshots_all_params_with_retries(self): + # Enable retries and run test_list_snapshots_all_params. + _service.enable_retries() + self.test_list_snapshots_all_params() + + # Disable retries and run test_list_snapshots_all_params. + _service.disable_retries() + self.test_list_snapshots_all_params() + + @responses.activate + def test_list_snapshots_required_params(self): + """ + test_list_snapshots_required_params() + """ + # Set up mock + url = preprocess_url('/snapshots') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "snapshots": [{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["service_tags"], "size": 1, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["user_tags"]}], "total_count": 132}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Invoke method + response = _service.list_snapshots() - # Invoke method - response = _service.get_bare_metal_server( - id, - headers={} - ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 - def test_get_bare_metal_server_all_params_with_retries(self): - # Enable retries and run test_get_bare_metal_server_all_params. + def test_list_snapshots_required_params_with_retries(self): + # Enable retries and run test_list_snapshots_required_params. _service.enable_retries() - self.test_get_bare_metal_server_all_params() + self.test_list_snapshots_required_params() - # Disable retries and run test_get_bare_metal_server_all_params. + # Disable retries and run test_list_snapshots_required_params. _service.disable_retries() - self.test_get_bare_metal_server_all_params() + self.test_list_snapshots_required_params() @responses.activate - def test_get_bare_metal_server_value_error(self): + def test_list_snapshots_value_error(self): """ - test_get_bare_metal_server_value_error() + test_list_snapshots_value_error() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString') - mock_response = '{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "failed", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + url = preprocess_url('/snapshots') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "snapshots": [{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["service_tags"], "size": 1, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["user_tags"]}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) - # Set up parameter values - id = 'testString' - # Pass in all but one required param and check for a ValueError req_param_dict = { - "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.get_bare_metal_server(**req_copy) + _service.list_snapshots(**req_copy) - def test_get_bare_metal_server_value_error_with_retries(self): - # Enable retries and run test_get_bare_metal_server_value_error. + def test_list_snapshots_value_error_with_retries(self): + # Enable retries and run test_list_snapshots_value_error. _service.enable_retries() - self.test_get_bare_metal_server_value_error() + self.test_list_snapshots_value_error() - # Disable retries and run test_get_bare_metal_server_value_error. + # Disable retries and run test_list_snapshots_value_error. _service.disable_retries() - self.test_get_bare_metal_server_value_error() + self.test_list_snapshots_value_error() -class TestUpdateBareMetalServer(): +class TestCreateSnapshot(): """ - Test Class for update_bare_metal_server + Test Class for create_snapshot """ @responses.activate - def test_update_bare_metal_server_all_params(self): + def test_create_snapshot_all_params(self): """ - update_bare_metal_server() + create_snapshot() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString') - mock_response = '{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "failed", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' - responses.add(responses.PATCH, + url = preprocess_url('/snapshots') + mock_response = '{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["service_tags"], "size": 1, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["user_tags"]}' + responses.add(responses.POST, url, body=mock_response, content_type='application/json', - status=200) + status=201) - # Construct a dict representation of a BareMetalServerPatch model - bare_metal_server_patch_model = {} - bare_metal_server_patch_model['name'] = 'my-bare-metal-server' + # Construct a dict representation of a ResourceGroupIdentityById model + resource_group_identity_model = {} + resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + + # Construct a dict representation of a VolumeIdentityById model + volume_identity_model = {} + volume_identity_model['id'] = '1a6b7274-678d-4dfb-8981-c71dd9d4daa5' + + # Construct a dict representation of a SnapshotPrototypeSnapshotBySourceVolume model + snapshot_prototype_model = {} + snapshot_prototype_model['name'] = 'my-snapshot' + snapshot_prototype_model['resource_group'] = resource_group_identity_model + snapshot_prototype_model['user_tags'] = ['testString'] + snapshot_prototype_model['source_volume'] = volume_identity_model # Set up parameter values - id = 'testString' - bare_metal_server_patch = bare_metal_server_patch_model + snapshot_prototype = snapshot_prototype_model # Invoke method - response = _service.update_bare_metal_server( - id, - bare_metal_server_patch, + response = _service.create_snapshot( + snapshot_prototype, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 200 + assert response.status_code == 201 # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == bare_metal_server_patch + assert req_body == snapshot_prototype - def test_update_bare_metal_server_all_params_with_retries(self): - # Enable retries and run test_update_bare_metal_server_all_params. + def test_create_snapshot_all_params_with_retries(self): + # Enable retries and run test_create_snapshot_all_params. _service.enable_retries() - self.test_update_bare_metal_server_all_params() + self.test_create_snapshot_all_params() - # Disable retries and run test_update_bare_metal_server_all_params. + # Disable retries and run test_create_snapshot_all_params. _service.disable_retries() - self.test_update_bare_metal_server_all_params() + self.test_create_snapshot_all_params() @responses.activate - def test_update_bare_metal_server_value_error(self): + def test_create_snapshot_value_error(self): """ - test_update_bare_metal_server_value_error() + test_create_snapshot_value_error() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString') - mock_response = '{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "failed", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' - responses.add(responses.PATCH, + url = preprocess_url('/snapshots') + mock_response = '{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["service_tags"], "size": 1, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["user_tags"]}' + responses.add(responses.POST, url, body=mock_response, content_type='application/json', - status=200) + status=201) - # Construct a dict representation of a BareMetalServerPatch model - bare_metal_server_patch_model = {} - bare_metal_server_patch_model['name'] = 'my-bare-metal-server' + # Construct a dict representation of a ResourceGroupIdentityById model + resource_group_identity_model = {} + resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + + # Construct a dict representation of a VolumeIdentityById model + volume_identity_model = {} + volume_identity_model['id'] = '1a6b7274-678d-4dfb-8981-c71dd9d4daa5' + + # Construct a dict representation of a SnapshotPrototypeSnapshotBySourceVolume model + snapshot_prototype_model = {} + snapshot_prototype_model['name'] = 'my-snapshot' + snapshot_prototype_model['resource_group'] = resource_group_identity_model + snapshot_prototype_model['user_tags'] = ['testString'] + snapshot_prototype_model['source_volume'] = volume_identity_model # Set up parameter values - id = 'testString' - bare_metal_server_patch = bare_metal_server_patch_model + snapshot_prototype = snapshot_prototype_model # Pass in all but one required param and check for a ValueError req_param_dict = { - "id": id, - "bare_metal_server_patch": bare_metal_server_patch, + "snapshot_prototype": snapshot_prototype, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.update_bare_metal_server(**req_copy) + _service.create_snapshot(**req_copy) - def test_update_bare_metal_server_value_error_with_retries(self): - # Enable retries and run test_update_bare_metal_server_value_error. + def test_create_snapshot_value_error_with_retries(self): + # Enable retries and run test_create_snapshot_value_error. _service.enable_retries() - self.test_update_bare_metal_server_value_error() + self.test_create_snapshot_value_error() - # Disable retries and run test_update_bare_metal_server_value_error. + # Disable retries and run test_create_snapshot_value_error. _service.disable_retries() - self.test_update_bare_metal_server_value_error() + self.test_create_snapshot_value_error() -class TestGetBareMetalServerInitialization(): +class TestDeleteSnapshot(): """ - Test Class for get_bare_metal_server_initialization + Test Class for delete_snapshot """ @responses.activate - def test_get_bare_metal_server_initialization_all_params(self): + def test_delete_snapshot_all_params(self): """ - get_bare_metal_server_initialization() + delete_snapshot() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/initialization') - mock_response = '{"image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}], "user_accounts": [{"encrypted_password": "VGhpcyBpcyBhbiBlbmNvZGVkIGJ5dGUgYXJyYXku", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}, "resource_type": "host_user_account", "username": "Administrator"}]}' - responses.add(responses.GET, + url = preprocess_url('/snapshots/testString') + responses.add(responses.DELETE, url, - body=mock_response, - content_type='application/json', - status=200) + status=204) # Set up parameter values id = 'testString' + if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"' # Invoke method - response = _service.get_bare_metal_server_initialization( + response = _service.delete_snapshot( id, + if_match=if_match, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 200 - - def test_get_bare_metal_server_initialization_all_params_with_retries(self): - # Enable retries and run test_get_bare_metal_server_initialization_all_params. - _service.enable_retries() - self.test_get_bare_metal_server_initialization_all_params() - - # Disable retries and run test_get_bare_metal_server_initialization_all_params. - _service.disable_retries() - self.test_get_bare_metal_server_initialization_all_params() - - @responses.activate - def test_get_bare_metal_server_initialization_value_error(self): - """ - test_get_bare_metal_server_initialization_value_error() - """ - # Set up mock - url = preprocess_url('/bare_metal_servers/testString/initialization') - mock_response = '{"image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}], "user_accounts": [{"encrypted_password": "VGhpcyBpcyBhbiBlbmNvZGVkIGJ5dGUgYXJyYXku", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}, "resource_type": "host_user_account", "username": "Administrator"}]}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) - - # Set up parameter values - id = 'testString' - - # Pass in all but one required param and check for a ValueError - req_param_dict = { - "id": id, - } - for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} - with pytest.raises(ValueError): - _service.get_bare_metal_server_initialization(**req_copy) - + assert response.status_code == 204 - def test_get_bare_metal_server_initialization_value_error_with_retries(self): - # Enable retries and run test_get_bare_metal_server_initialization_value_error. + def test_delete_snapshot_all_params_with_retries(self): + # Enable retries and run test_delete_snapshot_all_params. _service.enable_retries() - self.test_get_bare_metal_server_initialization_value_error() + self.test_delete_snapshot_all_params() - # Disable retries and run test_get_bare_metal_server_initialization_value_error. + # Disable retries and run test_delete_snapshot_all_params. _service.disable_retries() - self.test_get_bare_metal_server_initialization_value_error() - -class TestRestartBareMetalServer(): - """ - Test Class for restart_bare_metal_server - """ + self.test_delete_snapshot_all_params() @responses.activate - def test_restart_bare_metal_server_all_params(self): + def test_delete_snapshot_required_params(self): """ - restart_bare_metal_server() + test_delete_snapshot_required_params() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/restart') - responses.add(responses.POST, + url = preprocess_url('/snapshots/testString') + responses.add(responses.DELETE, url, status=204) @@ -16146,7 +18822,7 @@ def test_restart_bare_metal_server_all_params(self): id = 'testString' # Invoke method - response = _service.restart_bare_metal_server( + response = _service.delete_snapshot( id, headers={} ) @@ -16155,23 +18831,23 @@ def test_restart_bare_metal_server_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 204 - def test_restart_bare_metal_server_all_params_with_retries(self): - # Enable retries and run test_restart_bare_metal_server_all_params. + def test_delete_snapshot_required_params_with_retries(self): + # Enable retries and run test_delete_snapshot_required_params. _service.enable_retries() - self.test_restart_bare_metal_server_all_params() + self.test_delete_snapshot_required_params() - # Disable retries and run test_restart_bare_metal_server_all_params. + # Disable retries and run test_delete_snapshot_required_params. _service.disable_retries() - self.test_restart_bare_metal_server_all_params() + self.test_delete_snapshot_required_params() @responses.activate - def test_restart_bare_metal_server_value_error(self): + def test_delete_snapshot_value_error(self): """ - test_restart_bare_metal_server_value_error() + test_delete_snapshot_value_error() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/restart') - responses.add(responses.POST, + url = preprocess_url('/snapshots/testString') + responses.add(responses.DELETE, url, status=204) @@ -16185,66 +18861,72 @@ def test_restart_bare_metal_server_value_error(self): for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.restart_bare_metal_server(**req_copy) + _service.delete_snapshot(**req_copy) - def test_restart_bare_metal_server_value_error_with_retries(self): - # Enable retries and run test_restart_bare_metal_server_value_error. + def test_delete_snapshot_value_error_with_retries(self): + # Enable retries and run test_delete_snapshot_value_error. _service.enable_retries() - self.test_restart_bare_metal_server_value_error() + self.test_delete_snapshot_value_error() - # Disable retries and run test_restart_bare_metal_server_value_error. + # Disable retries and run test_delete_snapshot_value_error. _service.disable_retries() - self.test_restart_bare_metal_server_value_error() + self.test_delete_snapshot_value_error() -class TestStartBareMetalServer(): +class TestGetSnapshot(): """ - Test Class for start_bare_metal_server + Test Class for get_snapshot """ @responses.activate - def test_start_bare_metal_server_all_params(self): + def test_get_snapshot_all_params(self): """ - start_bare_metal_server() + get_snapshot() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/start') - responses.add(responses.POST, + url = preprocess_url('/snapshots/testString') + mock_response = '{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["service_tags"], "size": 1, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["user_tags"]}' + responses.add(responses.GET, url, - status=204) + body=mock_response, + content_type='application/json', + status=200) # Set up parameter values id = 'testString' # Invoke method - response = _service.start_bare_metal_server( + response = _service.get_snapshot( id, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 204 + assert response.status_code == 200 - def test_start_bare_metal_server_all_params_with_retries(self): - # Enable retries and run test_start_bare_metal_server_all_params. + def test_get_snapshot_all_params_with_retries(self): + # Enable retries and run test_get_snapshot_all_params. _service.enable_retries() - self.test_start_bare_metal_server_all_params() + self.test_get_snapshot_all_params() - # Disable retries and run test_start_bare_metal_server_all_params. + # Disable retries and run test_get_snapshot_all_params. _service.disable_retries() - self.test_start_bare_metal_server_all_params() + self.test_get_snapshot_all_params() @responses.activate - def test_start_bare_metal_server_value_error(self): + def test_get_snapshot_value_error(self): """ - test_start_bare_metal_server_value_error() + test_get_snapshot_value_error() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/start') - responses.add(responses.POST, + url = preprocess_url('/snapshots/testString') + mock_response = '{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["service_tags"], "size": 1, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["user_tags"]}' + responses.add(responses.GET, url, - status=204) + body=mock_response, + content_type='application/json', + status=200) # Set up parameter values id = 'testString' @@ -16256,103 +18938,167 @@ def test_start_bare_metal_server_value_error(self): for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.start_bare_metal_server(**req_copy) + _service.get_snapshot(**req_copy) - def test_start_bare_metal_server_value_error_with_retries(self): - # Enable retries and run test_start_bare_metal_server_value_error. + def test_get_snapshot_value_error_with_retries(self): + # Enable retries and run test_get_snapshot_value_error. _service.enable_retries() - self.test_start_bare_metal_server_value_error() + self.test_get_snapshot_value_error() - # Disable retries and run test_start_bare_metal_server_value_error. + # Disable retries and run test_get_snapshot_value_error. _service.disable_retries() - self.test_start_bare_metal_server_value_error() + self.test_get_snapshot_value_error() -class TestStopBareMetalServer(): +class TestUpdateSnapshot(): """ - Test Class for stop_bare_metal_server + Test Class for update_snapshot """ @responses.activate - def test_stop_bare_metal_server_all_params(self): + def test_update_snapshot_all_params(self): """ - stop_bare_metal_server() + update_snapshot() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/stop') - responses.add(responses.POST, + url = preprocess_url('/snapshots/testString') + mock_response = '{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["service_tags"], "size": 1, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["user_tags"]}' + responses.add(responses.PATCH, url, - status=204) + body=mock_response, + content_type='application/json', + status=200) + + # Construct a dict representation of a SnapshotPatch model + snapshot_patch_model = {} + snapshot_patch_model['name'] = 'my-snapshot' + snapshot_patch_model['user_tags'] = ['testString'] # Set up parameter values id = 'testString' - type = 'hard' + snapshot_patch = snapshot_patch_model + if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"' # Invoke method - response = _service.stop_bare_metal_server( + response = _service.update_snapshot( id, - type, + snapshot_patch, + if_match=if_match, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 204 + assert response.status_code == 200 # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body['type'] == 'hard' + assert req_body == snapshot_patch - def test_stop_bare_metal_server_all_params_with_retries(self): - # Enable retries and run test_stop_bare_metal_server_all_params. + def test_update_snapshot_all_params_with_retries(self): + # Enable retries and run test_update_snapshot_all_params. _service.enable_retries() - self.test_stop_bare_metal_server_all_params() + self.test_update_snapshot_all_params() - # Disable retries and run test_stop_bare_metal_server_all_params. + # Disable retries and run test_update_snapshot_all_params. _service.disable_retries() - self.test_stop_bare_metal_server_all_params() + self.test_update_snapshot_all_params() @responses.activate - def test_stop_bare_metal_server_value_error(self): + def test_update_snapshot_required_params(self): """ - test_stop_bare_metal_server_value_error() + test_update_snapshot_required_params() """ # Set up mock - url = preprocess_url('/bare_metal_servers/testString/stop') - responses.add(responses.POST, + url = preprocess_url('/snapshots/testString') + mock_response = '{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["service_tags"], "size": 1, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["user_tags"]}' + responses.add(responses.PATCH, url, - status=204) + body=mock_response, + content_type='application/json', + status=200) + + # Construct a dict representation of a SnapshotPatch model + snapshot_patch_model = {} + snapshot_patch_model['name'] = 'my-snapshot' + snapshot_patch_model['user_tags'] = ['testString'] # Set up parameter values id = 'testString' - type = 'hard' + snapshot_patch = snapshot_patch_model + + # Invoke method + response = _service.update_snapshot( + id, + snapshot_patch, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body == snapshot_patch + + def test_update_snapshot_required_params_with_retries(self): + # Enable retries and run test_update_snapshot_required_params. + _service.enable_retries() + self.test_update_snapshot_required_params() + + # Disable retries and run test_update_snapshot_required_params. + _service.disable_retries() + self.test_update_snapshot_required_params() + + @responses.activate + def test_update_snapshot_value_error(self): + """ + test_update_snapshot_value_error() + """ + # Set up mock + url = preprocess_url('/snapshots/testString') + mock_response = '{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["service_tags"], "size": 1, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["user_tags"]}' + responses.add(responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Construct a dict representation of a SnapshotPatch model + snapshot_patch_model = {} + snapshot_patch_model['name'] = 'my-snapshot' + snapshot_patch_model['user_tags'] = ['testString'] + + # Set up parameter values + id = 'testString' + snapshot_patch = snapshot_patch_model # Pass in all but one required param and check for a ValueError req_param_dict = { "id": id, - "type": type, + "snapshot_patch": snapshot_patch, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.stop_bare_metal_server(**req_copy) + _service.update_snapshot(**req_copy) - def test_stop_bare_metal_server_value_error_with_retries(self): - # Enable retries and run test_stop_bare_metal_server_value_error. + def test_update_snapshot_value_error_with_retries(self): + # Enable retries and run test_update_snapshot_value_error. _service.enable_retries() - self.test_stop_bare_metal_server_value_error() + self.test_update_snapshot_value_error() - # Disable retries and run test_stop_bare_metal_server_value_error. + # Disable retries and run test_update_snapshot_value_error. _service.disable_retries() - self.test_stop_bare_metal_server_value_error() + self.test_update_snapshot_value_error() # endregion ############################################################################## -# End of Service: BareMetalServers +# End of Service: Snapshots ############################################################################## ############################################################################## -# Start of Service: Volumes +# Start of Service: Geography ############################################################################## # region @@ -16372,47 +19118,115 @@ def test_new_instance(self): service_name='TEST_SERVICE', ) - assert service is not None - assert isinstance(service, VpcV1) + assert service is not None + assert isinstance(service, VpcV1) + + def test_new_instance_without_authenticator(self): + """ + new_instance_without_authenticator() + """ + with pytest.raises(ValueError, match='authenticator must be provided'): + service = VpcV1.new_instance( + version=version, + service_name='TEST_SERVICE_NOT_FOUND', + ) + + def test_new_instance_without_required_params(self): + """ + new_instance_without_required_params() + """ + with pytest.raises(TypeError, match='new_instance\\(\\) missing \\d required positional arguments?: \'.*\''): + service = VpcV1.new_instance() + + def test_new_instance_required_param_none(self): + """ + new_instance_required_param_none() + """ + with pytest.raises(ValueError, match='version must be provided'): + service = VpcV1.new_instance( + version=None, + ) +class TestListRegions(): + """ + Test Class for list_regions + """ + + @responses.activate + def test_list_regions_all_params(self): + """ + list_regions() + """ + # Set up mock + url = preprocess_url('/regions') + mock_response = '{"regions": [{"endpoint": "endpoint", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}]}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Invoke method + response = _service.list_regions() + + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_regions_all_params_with_retries(self): + # Enable retries and run test_list_regions_all_params. + _service.enable_retries() + self.test_list_regions_all_params() + + # Disable retries and run test_list_regions_all_params. + _service.disable_retries() + self.test_list_regions_all_params() + + @responses.activate + def test_list_regions_value_error(self): + """ + test_list_regions_value_error() + """ + # Set up mock + url = preprocess_url('/regions') + mock_response = '{"regions": [{"endpoint": "endpoint", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}]}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_regions(**req_copy) + - def test_new_instance_without_authenticator(self): - """ - new_instance_without_authenticator() - """ - with pytest.raises(ValueError, match='authenticator must be provided'): - service = VpcV1.new_instance( - version=version, - service_name='TEST_SERVICE_NOT_FOUND', - ) + def test_list_regions_value_error_with_retries(self): + # Enable retries and run test_list_regions_value_error. + _service.enable_retries() + self.test_list_regions_value_error() - def test_new_instance_without_required_params(self): - """ - new_instance_without_required_params() - """ - with pytest.raises(TypeError, match='new_instance\\(\\) missing \\d required positional arguments?: \'.*\''): - service = VpcV1.new_instance() + # Disable retries and run test_list_regions_value_error. + _service.disable_retries() + self.test_list_regions_value_error() - def test_new_instance_required_param_none(self): - """ - new_instance_required_param_none() - """ - with pytest.raises(ValueError, match='version must be provided'): - service = VpcV1.new_instance( - version=None, - ) -class TestListVolumeProfiles(): +class TestGetRegion(): """ - Test Class for list_volume_profiles + Test Class for get_region """ @responses.activate - def test_list_volume_profiles_all_params(self): + def test_get_region_all_params(self): """ - list_volume_profiles() + get_region() """ # Set up mock - url = preprocess_url('/volume/profiles') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}], "total_count": 132}' + url = preprocess_url('/regions/testString') + mock_response = '{"endpoint": "endpoint", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}' responses.add(responses.GET, url, body=mock_response, @@ -16420,110 +19234,153 @@ def test_list_volume_profiles_all_params(self): status=200) # Set up parameter values - start = 'testString' - limit = 1 + name = 'testString' # Invoke method - response = _service.list_volume_profiles( - start=start, - limit=limit, + response = _service.get_region( + name, headers={} ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 - # Validate query params - query_string = responses.calls[0].request.url.split('?',1)[1] - query_string = urllib.parse.unquote_plus(query_string) - assert 'start={}'.format(start) in query_string - assert 'limit={}'.format(limit) in query_string - def test_list_volume_profiles_all_params_with_retries(self): - # Enable retries and run test_list_volume_profiles_all_params. + def test_get_region_all_params_with_retries(self): + # Enable retries and run test_get_region_all_params. _service.enable_retries() - self.test_list_volume_profiles_all_params() + self.test_get_region_all_params() - # Disable retries and run test_list_volume_profiles_all_params. + # Disable retries and run test_get_region_all_params. _service.disable_retries() - self.test_list_volume_profiles_all_params() + self.test_get_region_all_params() @responses.activate - def test_list_volume_profiles_required_params(self): + def test_get_region_value_error(self): """ - test_list_volume_profiles_required_params() + test_get_region_value_error() """ # Set up mock - url = preprocess_url('/volume/profiles') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}], "total_count": 132}' + url = preprocess_url('/regions/testString') + mock_response = '{"endpoint": "endpoint", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}' responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) - # Invoke method - response = _service.list_volume_profiles() + # Set up parameter values + name = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "name": name, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_region(**req_copy) + + + def test_get_region_value_error_with_retries(self): + # Enable retries and run test_get_region_value_error. + _service.enable_retries() + self.test_get_region_value_error() + + # Disable retries and run test_get_region_value_error. + _service.disable_retries() + self.test_get_region_value_error() + +class TestListRegionZones(): + """ + Test Class for list_region_zones + """ + + @responses.activate + def test_list_region_zones_all_params(self): + """ + list_region_zones() + """ + # Set up mock + url = preprocess_url('/regions/testString/zones') + mock_response = '{"zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1", "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}, "status": "available"}]}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + region_name = 'testString' + # Invoke method + response = _service.list_region_zones( + region_name, + headers={} + ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 - def test_list_volume_profiles_required_params_with_retries(self): - # Enable retries and run test_list_volume_profiles_required_params. + def test_list_region_zones_all_params_with_retries(self): + # Enable retries and run test_list_region_zones_all_params. _service.enable_retries() - self.test_list_volume_profiles_required_params() + self.test_list_region_zones_all_params() - # Disable retries and run test_list_volume_profiles_required_params. + # Disable retries and run test_list_region_zones_all_params. _service.disable_retries() - self.test_list_volume_profiles_required_params() + self.test_list_region_zones_all_params() @responses.activate - def test_list_volume_profiles_value_error(self): + def test_list_region_zones_value_error(self): """ - test_list_volume_profiles_value_error() + test_list_region_zones_value_error() """ # Set up mock - url = preprocess_url('/volume/profiles') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}], "total_count": 132}' + url = preprocess_url('/regions/testString/zones') + mock_response = '{"zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1", "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}, "status": "available"}]}' responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) + # Set up parameter values + region_name = 'testString' + # Pass in all but one required param and check for a ValueError req_param_dict = { + "region_name": region_name, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_volume_profiles(**req_copy) + _service.list_region_zones(**req_copy) - def test_list_volume_profiles_value_error_with_retries(self): - # Enable retries and run test_list_volume_profiles_value_error. + def test_list_region_zones_value_error_with_retries(self): + # Enable retries and run test_list_region_zones_value_error. _service.enable_retries() - self.test_list_volume_profiles_value_error() + self.test_list_region_zones_value_error() - # Disable retries and run test_list_volume_profiles_value_error. + # Disable retries and run test_list_region_zones_value_error. _service.disable_retries() - self.test_list_volume_profiles_value_error() + self.test_list_region_zones_value_error() -class TestGetVolumeProfile(): +class TestGetRegionZone(): """ - Test Class for get_volume_profile + Test Class for get_region_zone """ @responses.activate - def test_get_volume_profile_all_params(self): + def test_get_region_zone_all_params(self): """ - get_volume_profile() + get_region_zone() """ # Set up mock - url = preprocess_url('/volume/profiles/testString') - mock_response = '{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}' + url = preprocess_url('/regions/testString/zones/testString') + mock_response = '{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1", "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}, "status": "available"}' responses.add(responses.GET, url, body=mock_response, @@ -16531,10 +19388,12 @@ def test_get_volume_profile_all_params(self): status=200) # Set up parameter values + region_name = 'testString' name = 'testString' # Invoke method - response = _service.get_volume_profile( + response = _service.get_region_zone( + region_name, name, headers={} ) @@ -16543,23 +19402,23 @@ def test_get_volume_profile_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 200 - def test_get_volume_profile_all_params_with_retries(self): - # Enable retries and run test_get_volume_profile_all_params. + def test_get_region_zone_all_params_with_retries(self): + # Enable retries and run test_get_region_zone_all_params. _service.enable_retries() - self.test_get_volume_profile_all_params() + self.test_get_region_zone_all_params() - # Disable retries and run test_get_volume_profile_all_params. + # Disable retries and run test_get_region_zone_all_params. _service.disable_retries() - self.test_get_volume_profile_all_params() + self.test_get_region_zone_all_params() @responses.activate - def test_get_volume_profile_value_error(self): + def test_get_region_zone_value_error(self): """ - test_get_volume_profile_value_error() + test_get_region_zone_value_error() """ # Set up mock - url = preprocess_url('/volume/profiles/testString') - mock_response = '{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}' + url = preprocess_url('/regions/testString/zones/testString') + mock_response = '{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1", "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}, "status": "available"}' responses.add(responses.GET, url, body=mock_response, @@ -16567,40 +19426,96 @@ def test_get_volume_profile_value_error(self): status=200) # Set up parameter values + region_name = 'testString' name = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { + "region_name": region_name, "name": name, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.get_volume_profile(**req_copy) + _service.get_region_zone(**req_copy) - def test_get_volume_profile_value_error_with_retries(self): - # Enable retries and run test_get_volume_profile_value_error. + def test_get_region_zone_value_error_with_retries(self): + # Enable retries and run test_get_region_zone_value_error. _service.enable_retries() - self.test_get_volume_profile_value_error() + self.test_get_region_zone_value_error() - # Disable retries and run test_get_volume_profile_value_error. + # Disable retries and run test_get_region_zone_value_error. _service.disable_retries() - self.test_get_volume_profile_value_error() + self.test_get_region_zone_value_error() -class TestListVolumes(): +# endregion +############################################################################## +# End of Service: Geography +############################################################################## + +############################################################################## +# Start of Service: PublicGateways +############################################################################## +# region + +class TestNewInstance(): """ - Test Class for list_volumes + Test Class for new_instance + """ + + def test_new_instance(self): + """ + new_instance() + """ + os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' + + service = VpcV1.new_instance( + version=version, + service_name='TEST_SERVICE', + ) + + assert service is not None + assert isinstance(service, VpcV1) + + def test_new_instance_without_authenticator(self): + """ + new_instance_without_authenticator() + """ + with pytest.raises(ValueError, match='authenticator must be provided'): + service = VpcV1.new_instance( + version=version, + service_name='TEST_SERVICE_NOT_FOUND', + ) + + def test_new_instance_without_required_params(self): + """ + new_instance_without_required_params() + """ + with pytest.raises(TypeError, match='new_instance\\(\\) missing \\d required positional arguments?: \'.*\''): + service = VpcV1.new_instance() + + def test_new_instance_required_param_none(self): + """ + new_instance_required_param_none() + """ + with pytest.raises(ValueError, match='version must be provided'): + service = VpcV1.new_instance( + version=None, + ) +class TestListPublicGateways(): + """ + Test Class for list_public_gateways """ @responses.activate - def test_list_volumes_all_params(self): + def test_list_public_gateways_all_params(self): """ - list_volumes() + list_public_gateways() """ # Set up mock - url = preprocess_url('/volumes') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volumes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volumes?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "volumes": [{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["user_tags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}' + url = preprocess_url('/public_gateways') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "public_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -16610,15 +19525,13 @@ def test_list_volumes_all_params(self): # Set up parameter values start = 'testString' limit = 1 - name = 'testString' - zone_name = 'testString' + resource_group_id = 'testString' # Invoke method - response = _service.list_volumes( + response = _service.list_public_gateways( start=start, limit=limit, - name=name, - zone_name=zone_name, + resource_group_id=resource_group_id, headers={} ) @@ -16630,26 +19543,25 @@ def test_list_volumes_all_params(self): query_string = urllib.parse.unquote_plus(query_string) assert 'start={}'.format(start) in query_string assert 'limit={}'.format(limit) in query_string - assert 'name={}'.format(name) in query_string - assert 'zone.name={}'.format(zone_name) in query_string + assert 'resource_group.id={}'.format(resource_group_id) in query_string - def test_list_volumes_all_params_with_retries(self): - # Enable retries and run test_list_volumes_all_params. + def test_list_public_gateways_all_params_with_retries(self): + # Enable retries and run test_list_public_gateways_all_params. _service.enable_retries() - self.test_list_volumes_all_params() + self.test_list_public_gateways_all_params() - # Disable retries and run test_list_volumes_all_params. + # Disable retries and run test_list_public_gateways_all_params. _service.disable_retries() - self.test_list_volumes_all_params() + self.test_list_public_gateways_all_params() @responses.activate - def test_list_volumes_required_params(self): + def test_list_public_gateways_required_params(self): """ - test_list_volumes_required_params() + test_list_public_gateways_required_params() """ # Set up mock - url = preprocess_url('/volumes') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volumes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volumes?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "volumes": [{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["user_tags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}' + url = preprocess_url('/public_gateways') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "public_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -16657,30 +19569,30 @@ def test_list_volumes_required_params(self): status=200) # Invoke method - response = _service.list_volumes() + response = _service.list_public_gateways() # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 - def test_list_volumes_required_params_with_retries(self): - # Enable retries and run test_list_volumes_required_params. + def test_list_public_gateways_required_params_with_retries(self): + # Enable retries and run test_list_public_gateways_required_params. _service.enable_retries() - self.test_list_volumes_required_params() + self.test_list_public_gateways_required_params() - # Disable retries and run test_list_volumes_required_params. + # Disable retries and run test_list_public_gateways_required_params. _service.disable_retries() - self.test_list_volumes_required_params() + self.test_list_public_gateways_required_params() @responses.activate - def test_list_volumes_value_error(self): + def test_list_public_gateways_value_error(self): """ - test_list_volumes_value_error() + test_list_public_gateways_value_error() """ # Set up mock - url = preprocess_url('/volumes') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volumes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volumes?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "volumes": [{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["user_tags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}' + url = preprocess_url('/public_gateways') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "public_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -16693,70 +19605,67 @@ def test_list_volumes_value_error(self): for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_volumes(**req_copy) + _service.list_public_gateways(**req_copy) - def test_list_volumes_value_error_with_retries(self): - # Enable retries and run test_list_volumes_value_error. + def test_list_public_gateways_value_error_with_retries(self): + # Enable retries and run test_list_public_gateways_value_error. _service.enable_retries() - self.test_list_volumes_value_error() + self.test_list_public_gateways_value_error() - # Disable retries and run test_list_volumes_value_error. + # Disable retries and run test_list_public_gateways_value_error. _service.disable_retries() - self.test_list_volumes_value_error() + self.test_list_public_gateways_value_error() -class TestCreateVolume(): +class TestCreatePublicGateway(): """ - Test Class for create_volume + Test Class for create_public_gateway """ @responses.activate - def test_create_volume_all_params(self): + def test_create_public_gateway_all_params(self): """ - create_volume() + create_public_gateway() """ # Set up mock - url = preprocess_url('/volumes') - mock_response = '{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["user_tags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + url = preprocess_url('/public_gateways') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) - # Construct a dict representation of a VolumeProfileIdentityByName model - volume_profile_identity_model = {} - volume_profile_identity_model['name'] = '5iops-tier' - - # Construct a dict representation of a ResourceGroupIdentityById model - resource_group_identity_model = {} - resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + # Construct a dict representation of a VPCIdentityById model + vpc_identity_model = {} + vpc_identity_model['id'] = '4727d842-f94f-4a2d-824a-9bc9b02c523b' # Construct a dict representation of a ZoneIdentityByName model zone_identity_model = {} zone_identity_model['name'] = 'us-south-1' - # Construct a dict representation of a EncryptionKeyIdentityByCRN model - encryption_key_identity_model = {} - encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179' + # Construct a dict representation of a PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityById model + public_gateway_floating_ip_prototype_model = {} + public_gateway_floating_ip_prototype_model['id'] = '39300233-9995-4806-89a5-3c1b6eb88689' - # Construct a dict representation of a VolumePrototypeVolumeByCapacity model - volume_prototype_model = {} - volume_prototype_model['iops'] = 10000 - volume_prototype_model['name'] = 'my-volume' - volume_prototype_model['profile'] = volume_profile_identity_model - volume_prototype_model['resource_group'] = resource_group_identity_model - volume_prototype_model['user_tags'] = ['testString'] - volume_prototype_model['zone'] = zone_identity_model - volume_prototype_model['capacity'] = 100 - volume_prototype_model['encryption_key'] = encryption_key_identity_model + # Construct a dict representation of a ResourceGroupIdentityById model + resource_group_identity_model = {} + resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' # Set up parameter values - volume_prototype = volume_prototype_model + vpc = vpc_identity_model + zone = zone_identity_model + floating_ip = public_gateway_floating_ip_prototype_model + name = 'my-public-gateway' + resource_group = resource_group_identity_model # Invoke method - response = _service.create_volume( - volume_prototype, + response = _service.create_public_gateway( + vpc, + zone, + floating_ip=floating_ip, + name=name, + resource_group=resource_group, headers={} ) @@ -16765,127 +19674,90 @@ def test_create_volume_all_params(self): assert response.status_code == 201 # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == volume_prototype + assert req_body['vpc'] == vpc_identity_model + assert req_body['zone'] == zone_identity_model + assert req_body['floating_ip'] == public_gateway_floating_ip_prototype_model + assert req_body['name'] == 'my-public-gateway' + assert req_body['resource_group'] == resource_group_identity_model - def test_create_volume_all_params_with_retries(self): - # Enable retries and run test_create_volume_all_params. + def test_create_public_gateway_all_params_with_retries(self): + # Enable retries and run test_create_public_gateway_all_params. _service.enable_retries() - self.test_create_volume_all_params() + self.test_create_public_gateway_all_params() - # Disable retries and run test_create_volume_all_params. + # Disable retries and run test_create_public_gateway_all_params. _service.disable_retries() - self.test_create_volume_all_params() + self.test_create_public_gateway_all_params() @responses.activate - def test_create_volume_value_error(self): + def test_create_public_gateway_value_error(self): """ - test_create_volume_value_error() + test_create_public_gateway_value_error() """ # Set up mock - url = preprocess_url('/volumes') - mock_response = '{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["user_tags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + url = preprocess_url('/public_gateways') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) - # Construct a dict representation of a VolumeProfileIdentityByName model - volume_profile_identity_model = {} - volume_profile_identity_model['name'] = '5iops-tier' - - # Construct a dict representation of a ResourceGroupIdentityById model - resource_group_identity_model = {} - resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + # Construct a dict representation of a VPCIdentityById model + vpc_identity_model = {} + vpc_identity_model['id'] = '4727d842-f94f-4a2d-824a-9bc9b02c523b' # Construct a dict representation of a ZoneIdentityByName model zone_identity_model = {} zone_identity_model['name'] = 'us-south-1' - # Construct a dict representation of a EncryptionKeyIdentityByCRN model - encryption_key_identity_model = {} - encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179' + # Construct a dict representation of a PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityById model + public_gateway_floating_ip_prototype_model = {} + public_gateway_floating_ip_prototype_model['id'] = '39300233-9995-4806-89a5-3c1b6eb88689' - # Construct a dict representation of a VolumePrototypeVolumeByCapacity model - volume_prototype_model = {} - volume_prototype_model['iops'] = 10000 - volume_prototype_model['name'] = 'my-volume' - volume_prototype_model['profile'] = volume_profile_identity_model - volume_prototype_model['resource_group'] = resource_group_identity_model - volume_prototype_model['user_tags'] = ['testString'] - volume_prototype_model['zone'] = zone_identity_model - volume_prototype_model['capacity'] = 100 - volume_prototype_model['encryption_key'] = encryption_key_identity_model + # Construct a dict representation of a ResourceGroupIdentityById model + resource_group_identity_model = {} + resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' # Set up parameter values - volume_prototype = volume_prototype_model + vpc = vpc_identity_model + zone = zone_identity_model + floating_ip = public_gateway_floating_ip_prototype_model + name = 'my-public-gateway' + resource_group = resource_group_identity_model # Pass in all but one required param and check for a ValueError req_param_dict = { - "volume_prototype": volume_prototype, + "vpc": vpc, + "zone": zone, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.create_volume(**req_copy) + _service.create_public_gateway(**req_copy) - def test_create_volume_value_error_with_retries(self): - # Enable retries and run test_create_volume_value_error. + def test_create_public_gateway_value_error_with_retries(self): + # Enable retries and run test_create_public_gateway_value_error. _service.enable_retries() - self.test_create_volume_value_error() + self.test_create_public_gateway_value_error() - # Disable retries and run test_create_volume_value_error. + # Disable retries and run test_create_public_gateway_value_error. _service.disable_retries() - self.test_create_volume_value_error() + self.test_create_public_gateway_value_error() -class TestDeleteVolume(): +class TestDeletePublicGateway(): """ - Test Class for delete_volume + Test Class for delete_public_gateway """ @responses.activate - def test_delete_volume_all_params(self): - """ - delete_volume() - """ - # Set up mock - url = preprocess_url('/volumes/testString') - responses.add(responses.DELETE, - url, - status=204) - - # Set up parameter values - id = 'testString' - if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"' - - # Invoke method - response = _service.delete_volume( - id, - if_match=if_match, - headers={} - ) - - # Check for correct operation - assert len(responses.calls) == 1 - assert response.status_code == 204 - - def test_delete_volume_all_params_with_retries(self): - # Enable retries and run test_delete_volume_all_params. - _service.enable_retries() - self.test_delete_volume_all_params() - - # Disable retries and run test_delete_volume_all_params. - _service.disable_retries() - self.test_delete_volume_all_params() - - @responses.activate - def test_delete_volume_required_params(self): + def test_delete_public_gateway_all_params(self): """ - test_delete_volume_required_params() + delete_public_gateway() """ # Set up mock - url = preprocess_url('/volumes/testString') + url = preprocess_url('/public_gateways/testString') responses.add(responses.DELETE, url, status=204) @@ -16894,7 +19766,7 @@ def test_delete_volume_required_params(self): id = 'testString' # Invoke method - response = _service.delete_volume( + response = _service.delete_public_gateway( id, headers={} ) @@ -16903,22 +19775,22 @@ def test_delete_volume_required_params(self): assert len(responses.calls) == 1 assert response.status_code == 204 - def test_delete_volume_required_params_with_retries(self): - # Enable retries and run test_delete_volume_required_params. + def test_delete_public_gateway_all_params_with_retries(self): + # Enable retries and run test_delete_public_gateway_all_params. _service.enable_retries() - self.test_delete_volume_required_params() + self.test_delete_public_gateway_all_params() - # Disable retries and run test_delete_volume_required_params. + # Disable retries and run test_delete_public_gateway_all_params. _service.disable_retries() - self.test_delete_volume_required_params() + self.test_delete_public_gateway_all_params() @responses.activate - def test_delete_volume_value_error(self): + def test_delete_public_gateway_value_error(self): """ - test_delete_volume_value_error() + test_delete_public_gateway_value_error() """ # Set up mock - url = preprocess_url('/volumes/testString') + url = preprocess_url('/public_gateways/testString') responses.add(responses.DELETE, url, status=204) @@ -16933,31 +19805,31 @@ def test_delete_volume_value_error(self): for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.delete_volume(**req_copy) + _service.delete_public_gateway(**req_copy) - def test_delete_volume_value_error_with_retries(self): - # Enable retries and run test_delete_volume_value_error. + def test_delete_public_gateway_value_error_with_retries(self): + # Enable retries and run test_delete_public_gateway_value_error. _service.enable_retries() - self.test_delete_volume_value_error() + self.test_delete_public_gateway_value_error() - # Disable retries and run test_delete_volume_value_error. + # Disable retries and run test_delete_public_gateway_value_error. _service.disable_retries() - self.test_delete_volume_value_error() + self.test_delete_public_gateway_value_error() -class TestGetVolume(): +class TestGetPublicGateway(): """ - Test Class for get_volume + Test Class for get_public_gateway """ @responses.activate - def test_get_volume_all_params(self): + def test_get_public_gateway_all_params(self): """ - get_volume() + get_public_gateway() """ # Set up mock - url = preprocess_url('/volumes/testString') - mock_response = '{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["user_tags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + url = preprocess_url('/public_gateways/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' responses.add(responses.GET, url, body=mock_response, @@ -16968,7 +19840,7 @@ def test_get_volume_all_params(self): id = 'testString' # Invoke method - response = _service.get_volume( + response = _service.get_public_gateway( id, headers={} ) @@ -16977,23 +19849,23 @@ def test_get_volume_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 200 - def test_get_volume_all_params_with_retries(self): - # Enable retries and run test_get_volume_all_params. + def test_get_public_gateway_all_params_with_retries(self): + # Enable retries and run test_get_public_gateway_all_params. _service.enable_retries() - self.test_get_volume_all_params() + self.test_get_public_gateway_all_params() - # Disable retries and run test_get_volume_all_params. + # Disable retries and run test_get_public_gateway_all_params. _service.disable_retries() - self.test_get_volume_all_params() + self.test_get_public_gateway_all_params() @responses.activate - def test_get_volume_value_error(self): + def test_get_public_gateway_value_error(self): """ - test_get_volume_value_error() + test_get_public_gateway_value_error() """ # Set up mock - url = preprocess_url('/volumes/testString') - mock_response = '{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["user_tags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + url = preprocess_url('/public_gateways/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' responses.add(responses.GET, url, body=mock_response, @@ -17010,112 +19882,49 @@ def test_get_volume_value_error(self): for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.get_volume(**req_copy) + _service.get_public_gateway(**req_copy) - def test_get_volume_value_error_with_retries(self): - # Enable retries and run test_get_volume_value_error. + def test_get_public_gateway_value_error_with_retries(self): + # Enable retries and run test_get_public_gateway_value_error. _service.enable_retries() - self.test_get_volume_value_error() + self.test_get_public_gateway_value_error() - # Disable retries and run test_get_volume_value_error. + # Disable retries and run test_get_public_gateway_value_error. _service.disable_retries() - self.test_get_volume_value_error() + self.test_get_public_gateway_value_error() -class TestUpdateVolume(): +class TestUpdatePublicGateway(): """ - Test Class for update_volume + Test Class for update_public_gateway """ @responses.activate - def test_update_volume_all_params(self): - """ - update_volume() - """ - # Set up mock - url = preprocess_url('/volumes/testString') - mock_response = '{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["user_tags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' - responses.add(responses.PATCH, - url, - body=mock_response, - content_type='application/json', - status=200) - - # Construct a dict representation of a VolumeProfileIdentityByName model - volume_profile_identity_model = {} - volume_profile_identity_model['name'] = 'general-purpose' - - # Construct a dict representation of a VolumePatch model - volume_patch_model = {} - volume_patch_model['capacity'] = 100 - volume_patch_model['iops'] = 10000 - volume_patch_model['name'] = 'my-volume' - volume_patch_model['profile'] = volume_profile_identity_model - volume_patch_model['user_tags'] = ['testString'] - - # Set up parameter values - id = 'testString' - volume_patch = volume_patch_model - if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"' - - # Invoke method - response = _service.update_volume( - id, - volume_patch, - if_match=if_match, - headers={} - ) - - # Check for correct operation - assert len(responses.calls) == 1 - assert response.status_code == 200 - # Validate body params - req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == volume_patch - - def test_update_volume_all_params_with_retries(self): - # Enable retries and run test_update_volume_all_params. - _service.enable_retries() - self.test_update_volume_all_params() - - # Disable retries and run test_update_volume_all_params. - _service.disable_retries() - self.test_update_volume_all_params() - - @responses.activate - def test_update_volume_required_params(self): + def test_update_public_gateway_all_params(self): """ - test_update_volume_required_params() + update_public_gateway() """ # Set up mock - url = preprocess_url('/volumes/testString') - mock_response = '{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["user_tags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + url = preprocess_url('/public_gateways/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) - # Construct a dict representation of a VolumeProfileIdentityByName model - volume_profile_identity_model = {} - volume_profile_identity_model['name'] = 'general-purpose' - - # Construct a dict representation of a VolumePatch model - volume_patch_model = {} - volume_patch_model['capacity'] = 100 - volume_patch_model['iops'] = 10000 - volume_patch_model['name'] = 'my-volume' - volume_patch_model['profile'] = volume_profile_identity_model - volume_patch_model['user_tags'] = ['testString'] + # Construct a dict representation of a PublicGatewayPatch model + public_gateway_patch_model = {} + public_gateway_patch_model['name'] = 'my-public-gateway' # Set up parameter values id = 'testString' - volume_patch = volume_patch_model + public_gateway_patch = public_gateway_patch_model # Invoke method - response = _service.update_volume( + response = _service.update_public_gateway( id, - volume_patch, + public_gateway_patch, headers={} ) @@ -17124,74 +19933,66 @@ def test_update_volume_required_params(self): assert response.status_code == 200 # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == volume_patch + assert req_body == public_gateway_patch - def test_update_volume_required_params_with_retries(self): - # Enable retries and run test_update_volume_required_params. + def test_update_public_gateway_all_params_with_retries(self): + # Enable retries and run test_update_public_gateway_all_params. _service.enable_retries() - self.test_update_volume_required_params() + self.test_update_public_gateway_all_params() - # Disable retries and run test_update_volume_required_params. + # Disable retries and run test_update_public_gateway_all_params. _service.disable_retries() - self.test_update_volume_required_params() + self.test_update_public_gateway_all_params() @responses.activate - def test_update_volume_value_error(self): + def test_update_public_gateway_value_error(self): """ - test_update_volume_value_error() + test_update_public_gateway_value_error() """ # Set up mock - url = preprocess_url('/volumes/testString') - mock_response = '{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["user_tags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + url = preprocess_url('/public_gateways/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) - # Construct a dict representation of a VolumeProfileIdentityByName model - volume_profile_identity_model = {} - volume_profile_identity_model['name'] = 'general-purpose' - - # Construct a dict representation of a VolumePatch model - volume_patch_model = {} - volume_patch_model['capacity'] = 100 - volume_patch_model['iops'] = 10000 - volume_patch_model['name'] = 'my-volume' - volume_patch_model['profile'] = volume_profile_identity_model - volume_patch_model['user_tags'] = ['testString'] + # Construct a dict representation of a PublicGatewayPatch model + public_gateway_patch_model = {} + public_gateway_patch_model['name'] = 'my-public-gateway' # Set up parameter values id = 'testString' - volume_patch = volume_patch_model + public_gateway_patch = public_gateway_patch_model # Pass in all but one required param and check for a ValueError req_param_dict = { "id": id, - "volume_patch": volume_patch, + "public_gateway_patch": public_gateway_patch, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.update_volume(**req_copy) + _service.update_public_gateway(**req_copy) - def test_update_volume_value_error_with_retries(self): - # Enable retries and run test_update_volume_value_error. + def test_update_public_gateway_value_error_with_retries(self): + # Enable retries and run test_update_public_gateway_value_error. _service.enable_retries() - self.test_update_volume_value_error() + self.test_update_public_gateway_value_error() - # Disable retries and run test_update_volume_value_error. + # Disable retries and run test_update_public_gateway_value_error. _service.disable_retries() - self.test_update_volume_value_error() + self.test_update_public_gateway_value_error() # endregion ############################################################################## -# End of Service: Volumes +# End of Service: PublicGateways ############################################################################## ############################################################################## -# Start of Service: Snapshots +# Start of Service: FloatingIPs ############################################################################## # region @@ -17239,94 +20040,19 @@ def test_new_instance_required_param_none(self): service = VpcV1.new_instance( version=None, ) -class TestDeleteSnapshots(): - """ - Test Class for delete_snapshots - """ - - @responses.activate - def test_delete_snapshots_all_params(self): - """ - delete_snapshots() - """ - # Set up mock - url = preprocess_url('/snapshots') - responses.add(responses.DELETE, - url, - status=204) - - # Set up parameter values - source_volume_id = 'testString' - - # Invoke method - response = _service.delete_snapshots( - source_volume_id, - headers={} - ) - - # Check for correct operation - assert len(responses.calls) == 1 - assert response.status_code == 204 - # Validate query params - query_string = responses.calls[0].request.url.split('?',1)[1] - query_string = urllib.parse.unquote_plus(query_string) - assert 'source_volume.id={}'.format(source_volume_id) in query_string - - def test_delete_snapshots_all_params_with_retries(self): - # Enable retries and run test_delete_snapshots_all_params. - _service.enable_retries() - self.test_delete_snapshots_all_params() - - # Disable retries and run test_delete_snapshots_all_params. - _service.disable_retries() - self.test_delete_snapshots_all_params() - - @responses.activate - def test_delete_snapshots_value_error(self): - """ - test_delete_snapshots_value_error() - """ - # Set up mock - url = preprocess_url('/snapshots') - responses.add(responses.DELETE, - url, - status=204) - - # Set up parameter values - source_volume_id = 'testString' - - # Pass in all but one required param and check for a ValueError - req_param_dict = { - "source_volume_id": source_volume_id, - } - for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} - with pytest.raises(ValueError): - _service.delete_snapshots(**req_copy) - - - def test_delete_snapshots_value_error_with_retries(self): - # Enable retries and run test_delete_snapshots_value_error. - _service.enable_retries() - self.test_delete_snapshots_value_error() - - # Disable retries and run test_delete_snapshots_value_error. - _service.disable_retries() - self.test_delete_snapshots_value_error() - -class TestListSnapshots(): +class TestListFloatingIps(): """ - Test Class for list_snapshots + Test Class for list_floating_ips """ @responses.activate - def test_list_snapshots_all_params(self): + def test_list_floating_ips_all_params(self): """ - list_snapshots() + list_floating_ips() """ # Set up mock - url = preprocess_url('/snapshots') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "snapshots": [{"bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["service_tags"], "size": 1, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["user_tags"]}], "total_count": 132}' + url = preprocess_url('/floating_ips') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips?limit=20"}, "floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -17336,26 +20062,14 @@ def test_list_snapshots_all_params(self): # Set up parameter values start = 'testString' limit = 1 - tag = 'testString' resource_group_id = 'testString' - name = 'testString' - source_volume_id = 'testString' - source_volume_crn = 'testString' - source_image_id = 'testString' - source_image_crn = 'testString' sort = 'name' # Invoke method - response = _service.list_snapshots( + response = _service.list_floating_ips( start=start, limit=limit, - tag=tag, resource_group_id=resource_group_id, - name=name, - source_volume_id=source_volume_id, - source_volume_crn=source_volume_crn, - source_image_id=source_image_id, - source_image_crn=source_image_crn, sort=sort, headers={} ) @@ -17368,32 +20082,26 @@ def test_list_snapshots_all_params(self): query_string = urllib.parse.unquote_plus(query_string) assert 'start={}'.format(start) in query_string assert 'limit={}'.format(limit) in query_string - assert 'tag={}'.format(tag) in query_string assert 'resource_group.id={}'.format(resource_group_id) in query_string - assert 'name={}'.format(name) in query_string - assert 'source_volume.id={}'.format(source_volume_id) in query_string - assert 'source_volume.crn={}'.format(source_volume_crn) in query_string - assert 'source_image.id={}'.format(source_image_id) in query_string - assert 'source_image.crn={}'.format(source_image_crn) in query_string assert 'sort={}'.format(sort) in query_string - def test_list_snapshots_all_params_with_retries(self): - # Enable retries and run test_list_snapshots_all_params. + def test_list_floating_ips_all_params_with_retries(self): + # Enable retries and run test_list_floating_ips_all_params. _service.enable_retries() - self.test_list_snapshots_all_params() + self.test_list_floating_ips_all_params() - # Disable retries and run test_list_snapshots_all_params. + # Disable retries and run test_list_floating_ips_all_params. _service.disable_retries() - self.test_list_snapshots_all_params() + self.test_list_floating_ips_all_params() @responses.activate - def test_list_snapshots_required_params(self): + def test_list_floating_ips_required_params(self): """ - test_list_snapshots_required_params() + test_list_floating_ips_required_params() """ # Set up mock - url = preprocess_url('/snapshots') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "snapshots": [{"bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["service_tags"], "size": 1, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["user_tags"]}], "total_count": 132}' + url = preprocess_url('/floating_ips') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips?limit=20"}, "floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -17401,30 +20109,30 @@ def test_list_snapshots_required_params(self): status=200) # Invoke method - response = _service.list_snapshots() + response = _service.list_floating_ips() # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 - def test_list_snapshots_required_params_with_retries(self): - # Enable retries and run test_list_snapshots_required_params. + def test_list_floating_ips_required_params_with_retries(self): + # Enable retries and run test_list_floating_ips_required_params. _service.enable_retries() - self.test_list_snapshots_required_params() + self.test_list_floating_ips_required_params() - # Disable retries and run test_list_snapshots_required_params. + # Disable retries and run test_list_floating_ips_required_params. _service.disable_retries() - self.test_list_snapshots_required_params() + self.test_list_floating_ips_required_params() @responses.activate - def test_list_snapshots_value_error(self): + def test_list_floating_ips_value_error(self): """ - test_list_snapshots_value_error() + test_list_floating_ips_value_error() """ # Set up mock - url = preprocess_url('/snapshots') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "snapshots": [{"bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["service_tags"], "size": 1, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["user_tags"]}], "total_count": 132}' + url = preprocess_url('/floating_ips') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips?limit=20"}, "floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -17437,31 +20145,31 @@ def test_list_snapshots_value_error(self): for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_snapshots(**req_copy) + _service.list_floating_ips(**req_copy) - def test_list_snapshots_value_error_with_retries(self): - # Enable retries and run test_list_snapshots_value_error. + def test_list_floating_ips_value_error_with_retries(self): + # Enable retries and run test_list_floating_ips_value_error. _service.enable_retries() - self.test_list_snapshots_value_error() + self.test_list_floating_ips_value_error() - # Disable retries and run test_list_snapshots_value_error. + # Disable retries and run test_list_floating_ips_value_error. _service.disable_retries() - self.test_list_snapshots_value_error() + self.test_list_floating_ips_value_error() -class TestCreateSnapshot(): +class TestCreateFloatingIp(): """ - Test Class for create_snapshot + Test Class for create_floating_ip """ @responses.activate - def test_create_snapshot_all_params(self): + def test_create_floating_ip_all_params(self): """ - create_snapshot() + create_floating_ip() """ # Set up mock - url = preprocess_url('/snapshots') - mock_response = '{"bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["service_tags"], "size": 1, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["user_tags"]}' + url = preprocess_url('/floating_ips') + mock_response = '{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' responses.add(responses.POST, url, body=mock_response, @@ -17472,23 +20180,22 @@ def test_create_snapshot_all_params(self): resource_group_identity_model = {} resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' - # Construct a dict representation of a VolumeIdentityById model - volume_identity_model = {} - volume_identity_model['id'] = '1a6b7274-678d-4dfb-8981-c71dd9d4daa5' + # Construct a dict representation of a ZoneIdentityByName model + zone_identity_model = {} + zone_identity_model['name'] = 'us-south-1' - # Construct a dict representation of a SnapshotPrototypeSnapshotBySourceVolume model - snapshot_prototype_model = {} - snapshot_prototype_model['name'] = 'my-snapshot' - snapshot_prototype_model['resource_group'] = resource_group_identity_model - snapshot_prototype_model['user_tags'] = ['testString'] - snapshot_prototype_model['source_volume'] = volume_identity_model + # Construct a dict representation of a FloatingIPPrototypeFloatingIPByZone model + floating_ip_prototype_model = {} + floating_ip_prototype_model['name'] = 'my-floating-ip' + floating_ip_prototype_model['resource_group'] = resource_group_identity_model + floating_ip_prototype_model['zone'] = zone_identity_model # Set up parameter values - snapshot_prototype = snapshot_prototype_model + floating_ip_prototype = floating_ip_prototype_model # Invoke method - response = _service.create_snapshot( - snapshot_prototype, + response = _service.create_floating_ip( + floating_ip_prototype, headers={} ) @@ -17497,25 +20204,25 @@ def test_create_snapshot_all_params(self): assert response.status_code == 201 # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == snapshot_prototype + assert req_body == floating_ip_prototype - def test_create_snapshot_all_params_with_retries(self): - # Enable retries and run test_create_snapshot_all_params. + def test_create_floating_ip_all_params_with_retries(self): + # Enable retries and run test_create_floating_ip_all_params. _service.enable_retries() - self.test_create_snapshot_all_params() + self.test_create_floating_ip_all_params() - # Disable retries and run test_create_snapshot_all_params. + # Disable retries and run test_create_floating_ip_all_params. _service.disable_retries() - self.test_create_snapshot_all_params() + self.test_create_floating_ip_all_params() @responses.activate - def test_create_snapshot_value_error(self): + def test_create_floating_ip_value_error(self): """ - test_create_snapshot_value_error() + test_create_floating_ip_value_error() """ # Set up mock - url = preprocess_url('/snapshots') - mock_response = '{"bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["service_tags"], "size": 1, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["user_tags"]}' + url = preprocess_url('/floating_ips') + mock_response = '{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' responses.add(responses.POST, url, body=mock_response, @@ -17526,86 +20233,50 @@ def test_create_snapshot_value_error(self): resource_group_identity_model = {} resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' - # Construct a dict representation of a VolumeIdentityById model - volume_identity_model = {} - volume_identity_model['id'] = '1a6b7274-678d-4dfb-8981-c71dd9d4daa5' + # Construct a dict representation of a ZoneIdentityByName model + zone_identity_model = {} + zone_identity_model['name'] = 'us-south-1' - # Construct a dict representation of a SnapshotPrototypeSnapshotBySourceVolume model - snapshot_prototype_model = {} - snapshot_prototype_model['name'] = 'my-snapshot' - snapshot_prototype_model['resource_group'] = resource_group_identity_model - snapshot_prototype_model['user_tags'] = ['testString'] - snapshot_prototype_model['source_volume'] = volume_identity_model + # Construct a dict representation of a FloatingIPPrototypeFloatingIPByZone model + floating_ip_prototype_model = {} + floating_ip_prototype_model['name'] = 'my-floating-ip' + floating_ip_prototype_model['resource_group'] = resource_group_identity_model + floating_ip_prototype_model['zone'] = zone_identity_model # Set up parameter values - snapshot_prototype = snapshot_prototype_model + floating_ip_prototype = floating_ip_prototype_model # Pass in all but one required param and check for a ValueError req_param_dict = { - "snapshot_prototype": snapshot_prototype, + "floating_ip_prototype": floating_ip_prototype, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.create_snapshot(**req_copy) + _service.create_floating_ip(**req_copy) - def test_create_snapshot_value_error_with_retries(self): - # Enable retries and run test_create_snapshot_value_error. + def test_create_floating_ip_value_error_with_retries(self): + # Enable retries and run test_create_floating_ip_value_error. _service.enable_retries() - self.test_create_snapshot_value_error() + self.test_create_floating_ip_value_error() - # Disable retries and run test_create_snapshot_value_error. + # Disable retries and run test_create_floating_ip_value_error. _service.disable_retries() - self.test_create_snapshot_value_error() + self.test_create_floating_ip_value_error() -class TestDeleteSnapshot(): +class TestDeleteFloatingIp(): """ - Test Class for delete_snapshot + Test Class for delete_floating_ip """ @responses.activate - def test_delete_snapshot_all_params(self): - """ - delete_snapshot() - """ - # Set up mock - url = preprocess_url('/snapshots/testString') - responses.add(responses.DELETE, - url, - status=204) - - # Set up parameter values - id = 'testString' - if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"' - - # Invoke method - response = _service.delete_snapshot( - id, - if_match=if_match, - headers={} - ) - - # Check for correct operation - assert len(responses.calls) == 1 - assert response.status_code == 204 - - def test_delete_snapshot_all_params_with_retries(self): - # Enable retries and run test_delete_snapshot_all_params. - _service.enable_retries() - self.test_delete_snapshot_all_params() - - # Disable retries and run test_delete_snapshot_all_params. - _service.disable_retries() - self.test_delete_snapshot_all_params() - - @responses.activate - def test_delete_snapshot_required_params(self): + def test_delete_floating_ip_all_params(self): """ - test_delete_snapshot_required_params() + delete_floating_ip() """ # Set up mock - url = preprocess_url('/snapshots/testString') + url = preprocess_url('/floating_ips/testString') responses.add(responses.DELETE, url, status=204) @@ -17614,7 +20285,7 @@ def test_delete_snapshot_required_params(self): id = 'testString' # Invoke method - response = _service.delete_snapshot( + response = _service.delete_floating_ip( id, headers={} ) @@ -17623,22 +20294,22 @@ def test_delete_snapshot_required_params(self): assert len(responses.calls) == 1 assert response.status_code == 204 - def test_delete_snapshot_required_params_with_retries(self): - # Enable retries and run test_delete_snapshot_required_params. + def test_delete_floating_ip_all_params_with_retries(self): + # Enable retries and run test_delete_floating_ip_all_params. _service.enable_retries() - self.test_delete_snapshot_required_params() + self.test_delete_floating_ip_all_params() - # Disable retries and run test_delete_snapshot_required_params. + # Disable retries and run test_delete_floating_ip_all_params. _service.disable_retries() - self.test_delete_snapshot_required_params() + self.test_delete_floating_ip_all_params() @responses.activate - def test_delete_snapshot_value_error(self): + def test_delete_floating_ip_value_error(self): """ - test_delete_snapshot_value_error() + test_delete_floating_ip_value_error() """ # Set up mock - url = preprocess_url('/snapshots/testString') + url = preprocess_url('/floating_ips/testString') responses.add(responses.DELETE, url, status=204) @@ -17653,31 +20324,31 @@ def test_delete_snapshot_value_error(self): for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.delete_snapshot(**req_copy) + _service.delete_floating_ip(**req_copy) - def test_delete_snapshot_value_error_with_retries(self): - # Enable retries and run test_delete_snapshot_value_error. + def test_delete_floating_ip_value_error_with_retries(self): + # Enable retries and run test_delete_floating_ip_value_error. _service.enable_retries() - self.test_delete_snapshot_value_error() + self.test_delete_floating_ip_value_error() - # Disable retries and run test_delete_snapshot_value_error. + # Disable retries and run test_delete_floating_ip_value_error. _service.disable_retries() - self.test_delete_snapshot_value_error() + self.test_delete_floating_ip_value_error() -class TestGetSnapshot(): +class TestGetFloatingIp(): """ - Test Class for get_snapshot + Test Class for get_floating_ip """ @responses.activate - def test_get_snapshot_all_params(self): + def test_get_floating_ip_all_params(self): """ - get_snapshot() + get_floating_ip() """ # Set up mock - url = preprocess_url('/snapshots/testString') - mock_response = '{"bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["service_tags"], "size": 1, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["user_tags"]}' + url = preprocess_url('/floating_ips/testString') + mock_response = '{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' responses.add(responses.GET, url, body=mock_response, @@ -17688,7 +20359,7 @@ def test_get_snapshot_all_params(self): id = 'testString' # Invoke method - response = _service.get_snapshot( + response = _service.get_floating_ip( id, headers={} ) @@ -17697,23 +20368,23 @@ def test_get_snapshot_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 200 - def test_get_snapshot_all_params_with_retries(self): - # Enable retries and run test_get_snapshot_all_params. + def test_get_floating_ip_all_params_with_retries(self): + # Enable retries and run test_get_floating_ip_all_params. _service.enable_retries() - self.test_get_snapshot_all_params() + self.test_get_floating_ip_all_params() - # Disable retries and run test_get_snapshot_all_params. + # Disable retries and run test_get_floating_ip_all_params. _service.disable_retries() - self.test_get_snapshot_all_params() + self.test_get_floating_ip_all_params() @responses.activate - def test_get_snapshot_value_error(self): + def test_get_floating_ip_value_error(self): """ - test_get_snapshot_value_error() + test_get_floating_ip_value_error() """ # Set up mock - url = preprocess_url('/snapshots/testString') - mock_response = '{"bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["service_tags"], "size": 1, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["user_tags"]}' + url = preprocess_url('/floating_ips/testString') + mock_response = '{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' responses.add(responses.GET, url, body=mock_response, @@ -17730,98 +20401,54 @@ def test_get_snapshot_value_error(self): for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.get_snapshot(**req_copy) + _service.get_floating_ip(**req_copy) - def test_get_snapshot_value_error_with_retries(self): - # Enable retries and run test_get_snapshot_value_error. + def test_get_floating_ip_value_error_with_retries(self): + # Enable retries and run test_get_floating_ip_value_error. _service.enable_retries() - self.test_get_snapshot_value_error() + self.test_get_floating_ip_value_error() - # Disable retries and run test_get_snapshot_value_error. + # Disable retries and run test_get_floating_ip_value_error. _service.disable_retries() - self.test_get_snapshot_value_error() + self.test_get_floating_ip_value_error() -class TestUpdateSnapshot(): +class TestUpdateFloatingIp(): """ - Test Class for update_snapshot + Test Class for update_floating_ip """ @responses.activate - def test_update_snapshot_all_params(self): + def test_update_floating_ip_all_params(self): """ - update_snapshot() + update_floating_ip() """ # Set up mock - url = preprocess_url('/snapshots/testString') - mock_response = '{"bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["service_tags"], "size": 1, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["user_tags"]}' + url = preprocess_url('/floating_ips/testString') + mock_response = '{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) - # Construct a dict representation of a SnapshotPatch model - snapshot_patch_model = {} - snapshot_patch_model['name'] = 'my-snapshot' - snapshot_patch_model['user_tags'] = ['testString'] - - # Set up parameter values - id = 'testString' - snapshot_patch = snapshot_patch_model - if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"' - - # Invoke method - response = _service.update_snapshot( - id, - snapshot_patch, - if_match=if_match, - headers={} - ) - - # Check for correct operation - assert len(responses.calls) == 1 - assert response.status_code == 200 - # Validate body params - req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == snapshot_patch - - def test_update_snapshot_all_params_with_retries(self): - # Enable retries and run test_update_snapshot_all_params. - _service.enable_retries() - self.test_update_snapshot_all_params() - - # Disable retries and run test_update_snapshot_all_params. - _service.disable_retries() - self.test_update_snapshot_all_params() - - @responses.activate - def test_update_snapshot_required_params(self): - """ - test_update_snapshot_required_params() - """ - # Set up mock - url = preprocess_url('/snapshots/testString') - mock_response = '{"bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["service_tags"], "size": 1, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["user_tags"]}' - responses.add(responses.PATCH, - url, - body=mock_response, - content_type='application/json', - status=200) + # Construct a dict representation of a FloatingIPTargetPatchNetworkInterfaceIdentityById model + floating_ip_target_patch_model = {} + floating_ip_target_patch_model['id'] = '10c02d81-0ecb-4dc5-897d-28392913b81e' - # Construct a dict representation of a SnapshotPatch model - snapshot_patch_model = {} - snapshot_patch_model['name'] = 'my-snapshot' - snapshot_patch_model['user_tags'] = ['testString'] + # Construct a dict representation of a FloatingIPPatch model + floating_ip_patch_model = {} + floating_ip_patch_model['name'] = 'my-floating-ip' + floating_ip_patch_model['target'] = floating_ip_target_patch_model # Set up parameter values id = 'testString' - snapshot_patch = snapshot_patch_model + floating_ip_patch = floating_ip_patch_model # Invoke method - response = _service.update_snapshot( + response = _service.update_floating_ip( id, - snapshot_patch, + floating_ip_patch, headers={} ) @@ -17830,67 +20457,71 @@ def test_update_snapshot_required_params(self): assert response.status_code == 200 # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == snapshot_patch + assert req_body == floating_ip_patch - def test_update_snapshot_required_params_with_retries(self): - # Enable retries and run test_update_snapshot_required_params. + def test_update_floating_ip_all_params_with_retries(self): + # Enable retries and run test_update_floating_ip_all_params. _service.enable_retries() - self.test_update_snapshot_required_params() + self.test_update_floating_ip_all_params() - # Disable retries and run test_update_snapshot_required_params. + # Disable retries and run test_update_floating_ip_all_params. _service.disable_retries() - self.test_update_snapshot_required_params() + self.test_update_floating_ip_all_params() @responses.activate - def test_update_snapshot_value_error(self): + def test_update_floating_ip_value_error(self): """ - test_update_snapshot_value_error() + test_update_floating_ip_value_error() """ # Set up mock - url = preprocess_url('/snapshots/testString') - mock_response = '{"bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["service_tags"], "size": 1, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["user_tags"]}' + url = preprocess_url('/floating_ips/testString') + mock_response = '{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) - # Construct a dict representation of a SnapshotPatch model - snapshot_patch_model = {} - snapshot_patch_model['name'] = 'my-snapshot' - snapshot_patch_model['user_tags'] = ['testString'] + # Construct a dict representation of a FloatingIPTargetPatchNetworkInterfaceIdentityById model + floating_ip_target_patch_model = {} + floating_ip_target_patch_model['id'] = '10c02d81-0ecb-4dc5-897d-28392913b81e' + + # Construct a dict representation of a FloatingIPPatch model + floating_ip_patch_model = {} + floating_ip_patch_model['name'] = 'my-floating-ip' + floating_ip_patch_model['target'] = floating_ip_target_patch_model # Set up parameter values id = 'testString' - snapshot_patch = snapshot_patch_model + floating_ip_patch = floating_ip_patch_model # Pass in all but one required param and check for a ValueError req_param_dict = { "id": id, - "snapshot_patch": snapshot_patch, + "floating_ip_patch": floating_ip_patch, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.update_snapshot(**req_copy) + _service.update_floating_ip(**req_copy) - def test_update_snapshot_value_error_with_retries(self): - # Enable retries and run test_update_snapshot_value_error. + def test_update_floating_ip_value_error_with_retries(self): + # Enable retries and run test_update_floating_ip_value_error. _service.enable_retries() - self.test_update_snapshot_value_error() + self.test_update_floating_ip_value_error() - # Disable retries and run test_update_snapshot_value_error. + # Disable retries and run test_update_floating_ip_value_error. _service.disable_retries() - self.test_update_snapshot_value_error() + self.test_update_floating_ip_value_error() # endregion ############################################################################## -# End of Service: Snapshots +# End of Service: FloatingIPs ############################################################################## ############################################################################## -# Start of Service: Geography +# Start of Service: NetworkACLs ############################################################################## # region @@ -17938,50 +20569,96 @@ def test_new_instance_required_param_none(self): service = VpcV1.new_instance( version=None, ) -class TestListRegions(): +class TestListNetworkAcls(): """ - Test Class for list_regions + Test Class for list_network_acls """ @responses.activate - def test_list_regions_all_params(self): + def test_list_network_acls_all_params(self): """ - list_regions() + list_network_acls() """ # Set up mock - url = preprocess_url('/regions') - mock_response = '{"regions": [{"endpoint": "endpoint", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}]}' + url = preprocess_url('/network_acls') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls?limit=20"}, "limit": 20, "network_acls": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}' responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) + # Set up parameter values + start = 'testString' + limit = 1 + resource_group_id = 'testString' + # Invoke method - response = _service.list_regions() + response = _service.list_network_acls( + start=start, + limit=limit, + resource_group_id=resource_group_id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?',1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'start={}'.format(start) in query_string + assert 'limit={}'.format(limit) in query_string + assert 'resource_group.id={}'.format(resource_group_id) in query_string + + def test_list_network_acls_all_params_with_retries(self): + # Enable retries and run test_list_network_acls_all_params. + _service.enable_retries() + self.test_list_network_acls_all_params() + + # Disable retries and run test_list_network_acls_all_params. + _service.disable_retries() + self.test_list_network_acls_all_params() + + @responses.activate + def test_list_network_acls_required_params(self): + """ + test_list_network_acls_required_params() + """ + # Set up mock + url = preprocess_url('/network_acls') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls?limit=20"}, "limit": 20, "network_acls": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Invoke method + response = _service.list_network_acls() # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 - def test_list_regions_all_params_with_retries(self): - # Enable retries and run test_list_regions_all_params. + def test_list_network_acls_required_params_with_retries(self): + # Enable retries and run test_list_network_acls_required_params. _service.enable_retries() - self.test_list_regions_all_params() + self.test_list_network_acls_required_params() - # Disable retries and run test_list_regions_all_params. + # Disable retries and run test_list_network_acls_required_params. _service.disable_retries() - self.test_list_regions_all_params() + self.test_list_network_acls_required_params() @responses.activate - def test_list_regions_value_error(self): + def test_list_network_acls_value_error(self): """ - test_list_regions_value_error() + test_list_network_acls_value_error() """ # Set up mock - url = preprocess_url('/regions') - mock_response = '{"regions": [{"endpoint": "endpoint", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}]}' + url = preprocess_url('/network_acls') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls?limit=20"}, "limit": 20, "network_acls": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -17994,108 +20671,237 @@ def test_list_regions_value_error(self): for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_regions(**req_copy) + _service.list_network_acls(**req_copy) - def test_list_regions_value_error_with_retries(self): - # Enable retries and run test_list_regions_value_error. + def test_list_network_acls_value_error_with_retries(self): + # Enable retries and run test_list_network_acls_value_error. _service.enable_retries() - self.test_list_regions_value_error() + self.test_list_network_acls_value_error() - # Disable retries and run test_list_regions_value_error. + # Disable retries and run test_list_network_acls_value_error. _service.disable_retries() - self.test_list_regions_value_error() + self.test_list_network_acls_value_error() -class TestGetRegion(): +class TestCreateNetworkAcl(): """ - Test Class for get_region + Test Class for create_network_acl """ @responses.activate - def test_get_region_all_params(self): + def test_create_network_acl_all_params(self): """ - get_region() + create_network_acl() """ # Set up mock - url = preprocess_url('/regions/testString') - mock_response = '{"endpoint": "endpoint", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}' - responses.add(responses.GET, + url = preprocess_url('/network_acls') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' + responses.add(responses.POST, url, body=mock_response, content_type='application/json', - status=200) + status=201) + + # Construct a dict representation of a ResourceGroupIdentityById model + resource_group_identity_model = {} + resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + + # Construct a dict representation of a VPCIdentityById model + vpc_identity_model = {} + vpc_identity_model['id'] = 'f0aae929-7047-46d1-92e1-9102b07a7f6f' + + # Construct a dict representation of a NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTCPUDP model + network_acl_rule_prototype_network_acl_context_model = {} + network_acl_rule_prototype_network_acl_context_model['action'] = 'allow' + network_acl_rule_prototype_network_acl_context_model['destination'] = '192.168.3.2/32' + network_acl_rule_prototype_network_acl_context_model['direction'] = 'inbound' + network_acl_rule_prototype_network_acl_context_model['name'] = 'my-rule-2' + network_acl_rule_prototype_network_acl_context_model['source'] = '192.168.3.2/32' + network_acl_rule_prototype_network_acl_context_model['destination_port_max'] = 22 + network_acl_rule_prototype_network_acl_context_model['destination_port_min'] = 22 + network_acl_rule_prototype_network_acl_context_model['protocol'] = 'udp' + network_acl_rule_prototype_network_acl_context_model['source_port_max'] = 65535 + network_acl_rule_prototype_network_acl_context_model['source_port_min'] = 49152 + + # Construct a dict representation of a NetworkACLPrototypeNetworkACLByRules model + network_acl_prototype_model = {} + network_acl_prototype_model['name'] = 'my-network-acl' + network_acl_prototype_model['resource_group'] = resource_group_identity_model + network_acl_prototype_model['vpc'] = vpc_identity_model + network_acl_prototype_model['rules'] = [network_acl_rule_prototype_network_acl_context_model] # Set up parameter values - name = 'testString' + network_acl_prototype = network_acl_prototype_model # Invoke method - response = _service.get_region( - name, + response = _service.create_network_acl( + network_acl_prototype=network_acl_prototype, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 200 + assert response.status_code == 201 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body == network_acl_prototype - def test_get_region_all_params_with_retries(self): - # Enable retries and run test_get_region_all_params. + def test_create_network_acl_all_params_with_retries(self): + # Enable retries and run test_create_network_acl_all_params. _service.enable_retries() - self.test_get_region_all_params() + self.test_create_network_acl_all_params() - # Disable retries and run test_get_region_all_params. + # Disable retries and run test_create_network_acl_all_params. _service.disable_retries() - self.test_get_region_all_params() + self.test_create_network_acl_all_params() @responses.activate - def test_get_region_value_error(self): + def test_create_network_acl_required_params(self): """ - test_get_region_value_error() + test_create_network_acl_required_params() """ # Set up mock - url = preprocess_url('/regions/testString') - mock_response = '{"endpoint": "endpoint", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}' - responses.add(responses.GET, + url = preprocess_url('/network_acls') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' + responses.add(responses.POST, url, body=mock_response, content_type='application/json', - status=200) + status=201) + + # Invoke method + response = _service.create_network_acl() + + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 201 + + def test_create_network_acl_required_params_with_retries(self): + # Enable retries and run test_create_network_acl_required_params. + _service.enable_retries() + self.test_create_network_acl_required_params() + + # Disable retries and run test_create_network_acl_required_params. + _service.disable_retries() + self.test_create_network_acl_required_params() + + @responses.activate + def test_create_network_acl_value_error(self): + """ + test_create_network_acl_value_error() + """ + # Set up mock + url = preprocess_url('/network_acls') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' + responses.add(responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201) + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.create_network_acl(**req_copy) + + + def test_create_network_acl_value_error_with_retries(self): + # Enable retries and run test_create_network_acl_value_error. + _service.enable_retries() + self.test_create_network_acl_value_error() + + # Disable retries and run test_create_network_acl_value_error. + _service.disable_retries() + self.test_create_network_acl_value_error() + +class TestDeleteNetworkAcl(): + """ + Test Class for delete_network_acl + """ + + @responses.activate + def test_delete_network_acl_all_params(self): + """ + delete_network_acl() + """ + # Set up mock + url = preprocess_url('/network_acls/testString') + responses.add(responses.DELETE, + url, + status=204) # Set up parameter values - name = 'testString' + id = 'testString' + + # Invoke method + response = _service.delete_network_acl( + id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 204 + + def test_delete_network_acl_all_params_with_retries(self): + # Enable retries and run test_delete_network_acl_all_params. + _service.enable_retries() + self.test_delete_network_acl_all_params() + + # Disable retries and run test_delete_network_acl_all_params. + _service.disable_retries() + self.test_delete_network_acl_all_params() + + @responses.activate + def test_delete_network_acl_value_error(self): + """ + test_delete_network_acl_value_error() + """ + # Set up mock + url = preprocess_url('/network_acls/testString') + responses.add(responses.DELETE, + url, + status=204) + + # Set up parameter values + id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "name": name, + "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.get_region(**req_copy) + _service.delete_network_acl(**req_copy) - def test_get_region_value_error_with_retries(self): - # Enable retries and run test_get_region_value_error. + def test_delete_network_acl_value_error_with_retries(self): + # Enable retries and run test_delete_network_acl_value_error. _service.enable_retries() - self.test_get_region_value_error() + self.test_delete_network_acl_value_error() - # Disable retries and run test_get_region_value_error. + # Disable retries and run test_delete_network_acl_value_error. _service.disable_retries() - self.test_get_region_value_error() + self.test_delete_network_acl_value_error() -class TestListRegionZones(): +class TestGetNetworkAcl(): """ - Test Class for list_region_zones + Test Class for get_network_acl """ @responses.activate - def test_list_region_zones_all_params(self): + def test_get_network_acl_all_params(self): """ - list_region_zones() + get_network_acl() """ # Set up mock - url = preprocess_url('/regions/testString/zones') - mock_response = '{"zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1", "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}, "status": "available"}]}' + url = preprocess_url('/network_acls/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' responses.add(responses.GET, url, body=mock_response, @@ -18103,11 +20909,11 @@ def test_list_region_zones_all_params(self): status=200) # Set up parameter values - region_name = 'testString' + id = 'testString' # Invoke method - response = _service.list_region_zones( - region_name, + response = _service.get_network_acl( + id, headers={} ) @@ -18115,23 +20921,23 @@ def test_list_region_zones_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 200 - def test_list_region_zones_all_params_with_retries(self): - # Enable retries and run test_list_region_zones_all_params. + def test_get_network_acl_all_params_with_retries(self): + # Enable retries and run test_get_network_acl_all_params. _service.enable_retries() - self.test_list_region_zones_all_params() + self.test_get_network_acl_all_params() - # Disable retries and run test_list_region_zones_all_params. + # Disable retries and run test_get_network_acl_all_params. _service.disable_retries() - self.test_list_region_zones_all_params() + self.test_get_network_acl_all_params() @responses.activate - def test_list_region_zones_value_error(self): + def test_get_network_acl_value_error(self): """ - test_list_region_zones_value_error() + test_get_network_acl_value_error() """ # Set up mock - url = preprocess_url('/regions/testString/zones') - mock_response = '{"zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1", "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}, "status": "available"}]}' + url = preprocess_url('/network_acls/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' responses.add(responses.GET, url, body=mock_response, @@ -18139,175 +20945,132 @@ def test_list_region_zones_value_error(self): status=200) # Set up parameter values - region_name = 'testString' + id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "region_name": region_name, + "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_region_zones(**req_copy) + _service.get_network_acl(**req_copy) - def test_list_region_zones_value_error_with_retries(self): - # Enable retries and run test_list_region_zones_value_error. + def test_get_network_acl_value_error_with_retries(self): + # Enable retries and run test_get_network_acl_value_error. _service.enable_retries() - self.test_list_region_zones_value_error() + self.test_get_network_acl_value_error() - # Disable retries and run test_list_region_zones_value_error. + # Disable retries and run test_get_network_acl_value_error. _service.disable_retries() - self.test_list_region_zones_value_error() + self.test_get_network_acl_value_error() -class TestGetRegionZone(): +class TestUpdateNetworkAcl(): """ - Test Class for get_region_zone + Test Class for update_network_acl """ @responses.activate - def test_get_region_zone_all_params(self): + def test_update_network_acl_all_params(self): """ - get_region_zone() + update_network_acl() """ # Set up mock - url = preprocess_url('/regions/testString/zones/testString') - mock_response = '{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1", "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}, "status": "available"}' - responses.add(responses.GET, + url = preprocess_url('/network_acls/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' + responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) + # Construct a dict representation of a NetworkACLPatch model + network_acl_patch_model = {} + network_acl_patch_model['name'] = 'my-network-acl' + # Set up parameter values - region_name = 'testString' - name = 'testString' + id = 'testString' + network_acl_patch = network_acl_patch_model # Invoke method - response = _service.get_region_zone( - region_name, - name, + response = _service.update_network_acl( + id, + network_acl_patch, headers={} ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body == network_acl_patch - def test_get_region_zone_all_params_with_retries(self): - # Enable retries and run test_get_region_zone_all_params. + def test_update_network_acl_all_params_with_retries(self): + # Enable retries and run test_update_network_acl_all_params. _service.enable_retries() - self.test_get_region_zone_all_params() + self.test_update_network_acl_all_params() - # Disable retries and run test_get_region_zone_all_params. + # Disable retries and run test_update_network_acl_all_params. _service.disable_retries() - self.test_get_region_zone_all_params() + self.test_update_network_acl_all_params() @responses.activate - def test_get_region_zone_value_error(self): + def test_update_network_acl_value_error(self): """ - test_get_region_zone_value_error() + test_update_network_acl_value_error() """ # Set up mock - url = preprocess_url('/regions/testString/zones/testString') - mock_response = '{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1", "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}, "status": "available"}' - responses.add(responses.GET, + url = preprocess_url('/network_acls/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' + responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) + # Construct a dict representation of a NetworkACLPatch model + network_acl_patch_model = {} + network_acl_patch_model['name'] = 'my-network-acl' + # Set up parameter values - region_name = 'testString' - name = 'testString' + id = 'testString' + network_acl_patch = network_acl_patch_model # Pass in all but one required param and check for a ValueError req_param_dict = { - "region_name": region_name, - "name": name, + "id": id, + "network_acl_patch": network_acl_patch, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.get_region_zone(**req_copy) + _service.update_network_acl(**req_copy) - def test_get_region_zone_value_error_with_retries(self): - # Enable retries and run test_get_region_zone_value_error. + def test_update_network_acl_value_error_with_retries(self): + # Enable retries and run test_update_network_acl_value_error. _service.enable_retries() - self.test_get_region_zone_value_error() + self.test_update_network_acl_value_error() - # Disable retries and run test_get_region_zone_value_error. + # Disable retries and run test_update_network_acl_value_error. _service.disable_retries() - self.test_get_region_zone_value_error() - -# endregion -############################################################################## -# End of Service: Geography -############################################################################## - -############################################################################## -# Start of Service: PublicGateways -############################################################################## -# region - -class TestNewInstance(): - """ - Test Class for new_instance - """ - - def test_new_instance(self): - """ - new_instance() - """ - os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' - - service = VpcV1.new_instance( - version=version, - service_name='TEST_SERVICE', - ) - - assert service is not None - assert isinstance(service, VpcV1) - - def test_new_instance_without_authenticator(self): - """ - new_instance_without_authenticator() - """ - with pytest.raises(ValueError, match='authenticator must be provided'): - service = VpcV1.new_instance( - version=version, - service_name='TEST_SERVICE_NOT_FOUND', - ) - - def test_new_instance_without_required_params(self): - """ - new_instance_without_required_params() - """ - with pytest.raises(TypeError, match='new_instance\\(\\) missing \\d required positional arguments?: \'.*\''): - service = VpcV1.new_instance() + self.test_update_network_acl_value_error() - def test_new_instance_required_param_none(self): - """ - new_instance_required_param_none() - """ - with pytest.raises(ValueError, match='version must be provided'): - service = VpcV1.new_instance( - version=None, - ) -class TestListPublicGateways(): +class TestListNetworkAclRules(): """ - Test Class for list_public_gateways + Test Class for list_network_acl_rules """ @responses.activate - def test_list_public_gateways_all_params(self): + def test_list_network_acl_rules_all_params(self): """ - list_public_gateways() + list_network_acl_rules() """ # Set up mock - url = preprocess_url('/public_gateways') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "public_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}' + url = preprocess_url('/network_acls/testString/rules') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -18315,15 +21078,17 @@ def test_list_public_gateways_all_params(self): status=200) # Set up parameter values + network_acl_id = 'testString' start = 'testString' limit = 1 - resource_group_id = 'testString' + direction = 'inbound' # Invoke method - response = _service.list_public_gateways( + response = _service.list_network_acl_rules( + network_acl_id, start=start, limit=limit, - resource_group_id=resource_group_id, + direction=direction, headers={} ) @@ -18335,129 +21100,132 @@ def test_list_public_gateways_all_params(self): query_string = urllib.parse.unquote_plus(query_string) assert 'start={}'.format(start) in query_string assert 'limit={}'.format(limit) in query_string - assert 'resource_group.id={}'.format(resource_group_id) in query_string + assert 'direction={}'.format(direction) in query_string - def test_list_public_gateways_all_params_with_retries(self): - # Enable retries and run test_list_public_gateways_all_params. + def test_list_network_acl_rules_all_params_with_retries(self): + # Enable retries and run test_list_network_acl_rules_all_params. _service.enable_retries() - self.test_list_public_gateways_all_params() + self.test_list_network_acl_rules_all_params() - # Disable retries and run test_list_public_gateways_all_params. + # Disable retries and run test_list_network_acl_rules_all_params. _service.disable_retries() - self.test_list_public_gateways_all_params() + self.test_list_network_acl_rules_all_params() @responses.activate - def test_list_public_gateways_required_params(self): + def test_list_network_acl_rules_required_params(self): """ - test_list_public_gateways_required_params() + test_list_network_acl_rules_required_params() """ # Set up mock - url = preprocess_url('/public_gateways') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "public_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}' + url = preprocess_url('/network_acls/testString/rules') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) - # Invoke method - response = _service.list_public_gateways() + # Set up parameter values + network_acl_id = 'testString' + # Invoke method + response = _service.list_network_acl_rules( + network_acl_id, + headers={} + ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 - def test_list_public_gateways_required_params_with_retries(self): - # Enable retries and run test_list_public_gateways_required_params. + def test_list_network_acl_rules_required_params_with_retries(self): + # Enable retries and run test_list_network_acl_rules_required_params. _service.enable_retries() - self.test_list_public_gateways_required_params() + self.test_list_network_acl_rules_required_params() - # Disable retries and run test_list_public_gateways_required_params. + # Disable retries and run test_list_network_acl_rules_required_params. _service.disable_retries() - self.test_list_public_gateways_required_params() + self.test_list_network_acl_rules_required_params() @responses.activate - def test_list_public_gateways_value_error(self): + def test_list_network_acl_rules_value_error(self): """ - test_list_public_gateways_value_error() + test_list_network_acl_rules_value_error() """ # Set up mock - url = preprocess_url('/public_gateways') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "public_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}' + url = preprocess_url('/network_acls/testString/rules') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) + # Set up parameter values + network_acl_id = 'testString' + # Pass in all but one required param and check for a ValueError req_param_dict = { + "network_acl_id": network_acl_id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_public_gateways(**req_copy) + _service.list_network_acl_rules(**req_copy) - def test_list_public_gateways_value_error_with_retries(self): - # Enable retries and run test_list_public_gateways_value_error. + def test_list_network_acl_rules_value_error_with_retries(self): + # Enable retries and run test_list_network_acl_rules_value_error. _service.enable_retries() - self.test_list_public_gateways_value_error() + self.test_list_network_acl_rules_value_error() - # Disable retries and run test_list_public_gateways_value_error. + # Disable retries and run test_list_network_acl_rules_value_error. _service.disable_retries() - self.test_list_public_gateways_value_error() + self.test_list_network_acl_rules_value_error() -class TestCreatePublicGateway(): +class TestCreateNetworkAclRule(): """ - Test Class for create_public_gateway + Test Class for create_network_acl_rule """ @responses.activate - def test_create_public_gateway_all_params(self): + def test_create_network_acl_rule_all_params(self): """ - create_public_gateway() + create_network_acl_rule() """ # Set up mock - url = preprocess_url('/public_gateways') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + url = preprocess_url('/network_acls/testString/rules') + mock_response = '{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) - # Construct a dict representation of a VPCIdentityById model - vpc_identity_model = {} - vpc_identity_model['id'] = '4727d842-f94f-4a2d-824a-9bc9b02c523b' - - # Construct a dict representation of a ZoneIdentityByName model - zone_identity_model = {} - zone_identity_model['name'] = 'us-south-1' - - # Construct a dict representation of a PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityById model - public_gateway_floating_ip_prototype_model = {} - public_gateway_floating_ip_prototype_model['id'] = '39300233-9995-4806-89a5-3c1b6eb88689' + # Construct a dict representation of a NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityById model + network_acl_rule_before_prototype_model = {} + network_acl_rule_before_prototype_model['id'] = '8daca77a-4980-4d33-8f3e-7038797be8f9' - # Construct a dict representation of a ResourceGroupIdentityById model - resource_group_identity_model = {} - resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + # Construct a dict representation of a NetworkACLRulePrototypeNetworkACLRuleProtocolICMP model + network_acl_rule_prototype_model = {} + network_acl_rule_prototype_model['action'] = 'allow' + network_acl_rule_prototype_model['before'] = network_acl_rule_before_prototype_model + network_acl_rule_prototype_model['destination'] = '192.168.3.2/32' + network_acl_rule_prototype_model['direction'] = 'inbound' + network_acl_rule_prototype_model['name'] = 'my-rule-2' + network_acl_rule_prototype_model['source'] = '192.168.3.2/32' + network_acl_rule_prototype_model['code'] = 0 + network_acl_rule_prototype_model['protocol'] = 'icmp' + network_acl_rule_prototype_model['type'] = 8 # Set up parameter values - vpc = vpc_identity_model - zone = zone_identity_model - floating_ip = public_gateway_floating_ip_prototype_model - name = 'my-public-gateway' - resource_group = resource_group_identity_model + network_acl_id = 'testString' + network_acl_rule_prototype = network_acl_rule_prototype_model # Invoke method - response = _service.create_public_gateway( - vpc, - zone, - floating_ip=floating_ip, - name=name, - resource_group=resource_group, + response = _service.create_network_acl_rule( + network_acl_id, + network_acl_rule_prototype, headers={} ) @@ -18466,99 +21234,94 @@ def test_create_public_gateway_all_params(self): assert response.status_code == 201 # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body['vpc'] == vpc_identity_model - assert req_body['zone'] == zone_identity_model - assert req_body['floating_ip'] == public_gateway_floating_ip_prototype_model - assert req_body['name'] == 'my-public-gateway' - assert req_body['resource_group'] == resource_group_identity_model + assert req_body == network_acl_rule_prototype - def test_create_public_gateway_all_params_with_retries(self): - # Enable retries and run test_create_public_gateway_all_params. + def test_create_network_acl_rule_all_params_with_retries(self): + # Enable retries and run test_create_network_acl_rule_all_params. _service.enable_retries() - self.test_create_public_gateway_all_params() + self.test_create_network_acl_rule_all_params() - # Disable retries and run test_create_public_gateway_all_params. + # Disable retries and run test_create_network_acl_rule_all_params. _service.disable_retries() - self.test_create_public_gateway_all_params() + self.test_create_network_acl_rule_all_params() @responses.activate - def test_create_public_gateway_value_error(self): + def test_create_network_acl_rule_value_error(self): """ - test_create_public_gateway_value_error() + test_create_network_acl_rule_value_error() """ # Set up mock - url = preprocess_url('/public_gateways') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + url = preprocess_url('/network_acls/testString/rules') + mock_response = '{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) - # Construct a dict representation of a VPCIdentityById model - vpc_identity_model = {} - vpc_identity_model['id'] = '4727d842-f94f-4a2d-824a-9bc9b02c523b' - - # Construct a dict representation of a ZoneIdentityByName model - zone_identity_model = {} - zone_identity_model['name'] = 'us-south-1' - - # Construct a dict representation of a PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityById model - public_gateway_floating_ip_prototype_model = {} - public_gateway_floating_ip_prototype_model['id'] = '39300233-9995-4806-89a5-3c1b6eb88689' + # Construct a dict representation of a NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityById model + network_acl_rule_before_prototype_model = {} + network_acl_rule_before_prototype_model['id'] = '8daca77a-4980-4d33-8f3e-7038797be8f9' - # Construct a dict representation of a ResourceGroupIdentityById model - resource_group_identity_model = {} - resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + # Construct a dict representation of a NetworkACLRulePrototypeNetworkACLRuleProtocolICMP model + network_acl_rule_prototype_model = {} + network_acl_rule_prototype_model['action'] = 'allow' + network_acl_rule_prototype_model['before'] = network_acl_rule_before_prototype_model + network_acl_rule_prototype_model['destination'] = '192.168.3.2/32' + network_acl_rule_prototype_model['direction'] = 'inbound' + network_acl_rule_prototype_model['name'] = 'my-rule-2' + network_acl_rule_prototype_model['source'] = '192.168.3.2/32' + network_acl_rule_prototype_model['code'] = 0 + network_acl_rule_prototype_model['protocol'] = 'icmp' + network_acl_rule_prototype_model['type'] = 8 # Set up parameter values - vpc = vpc_identity_model - zone = zone_identity_model - floating_ip = public_gateway_floating_ip_prototype_model - name = 'my-public-gateway' - resource_group = resource_group_identity_model + network_acl_id = 'testString' + network_acl_rule_prototype = network_acl_rule_prototype_model # Pass in all but one required param and check for a ValueError req_param_dict = { - "vpc": vpc, - "zone": zone, + "network_acl_id": network_acl_id, + "network_acl_rule_prototype": network_acl_rule_prototype, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.create_public_gateway(**req_copy) + _service.create_network_acl_rule(**req_copy) - def test_create_public_gateway_value_error_with_retries(self): - # Enable retries and run test_create_public_gateway_value_error. + def test_create_network_acl_rule_value_error_with_retries(self): + # Enable retries and run test_create_network_acl_rule_value_error. _service.enable_retries() - self.test_create_public_gateway_value_error() + self.test_create_network_acl_rule_value_error() - # Disable retries and run test_create_public_gateway_value_error. + # Disable retries and run test_create_network_acl_rule_value_error. _service.disable_retries() - self.test_create_public_gateway_value_error() + self.test_create_network_acl_rule_value_error() -class TestDeletePublicGateway(): +class TestDeleteNetworkAclRule(): """ - Test Class for delete_public_gateway + Test Class for delete_network_acl_rule """ @responses.activate - def test_delete_public_gateway_all_params(self): + def test_delete_network_acl_rule_all_params(self): """ - delete_public_gateway() + delete_network_acl_rule() """ # Set up mock - url = preprocess_url('/public_gateways/testString') + url = preprocess_url('/network_acls/testString/rules/testString') responses.add(responses.DELETE, url, status=204) # Set up parameter values + network_acl_id = 'testString' id = 'testString' # Invoke method - response = _service.delete_public_gateway( + response = _service.delete_network_acl_rule( + network_acl_id, id, headers={} ) @@ -18567,61 +21330,63 @@ def test_delete_public_gateway_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 204 - def test_delete_public_gateway_all_params_with_retries(self): - # Enable retries and run test_delete_public_gateway_all_params. + def test_delete_network_acl_rule_all_params_with_retries(self): + # Enable retries and run test_delete_network_acl_rule_all_params. _service.enable_retries() - self.test_delete_public_gateway_all_params() + self.test_delete_network_acl_rule_all_params() - # Disable retries and run test_delete_public_gateway_all_params. + # Disable retries and run test_delete_network_acl_rule_all_params. _service.disable_retries() - self.test_delete_public_gateway_all_params() + self.test_delete_network_acl_rule_all_params() @responses.activate - def test_delete_public_gateway_value_error(self): + def test_delete_network_acl_rule_value_error(self): """ - test_delete_public_gateway_value_error() + test_delete_network_acl_rule_value_error() """ # Set up mock - url = preprocess_url('/public_gateways/testString') + url = preprocess_url('/network_acls/testString/rules/testString') responses.add(responses.DELETE, url, status=204) # Set up parameter values + network_acl_id = 'testString' id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { + "network_acl_id": network_acl_id, "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.delete_public_gateway(**req_copy) + _service.delete_network_acl_rule(**req_copy) - def test_delete_public_gateway_value_error_with_retries(self): - # Enable retries and run test_delete_public_gateway_value_error. + def test_delete_network_acl_rule_value_error_with_retries(self): + # Enable retries and run test_delete_network_acl_rule_value_error. _service.enable_retries() - self.test_delete_public_gateway_value_error() + self.test_delete_network_acl_rule_value_error() - # Disable retries and run test_delete_public_gateway_value_error. + # Disable retries and run test_delete_network_acl_rule_value_error. _service.disable_retries() - self.test_delete_public_gateway_value_error() + self.test_delete_network_acl_rule_value_error() -class TestGetPublicGateway(): +class TestGetNetworkAclRule(): """ - Test Class for get_public_gateway + Test Class for get_network_acl_rule """ @responses.activate - def test_get_public_gateway_all_params(self): + def test_get_network_acl_rule_all_params(self): """ - get_public_gateway() + get_network_acl_rule() """ # Set up mock - url = preprocess_url('/public_gateways/testString') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + url = preprocess_url('/network_acls/testString/rules/testString') + mock_response = '{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}' responses.add(responses.GET, url, body=mock_response, @@ -18629,10 +21394,12 @@ def test_get_public_gateway_all_params(self): status=200) # Set up parameter values + network_acl_id = 'testString' id = 'testString' # Invoke method - response = _service.get_public_gateway( + response = _service.get_network_acl_rule( + network_acl_id, id, headers={} ) @@ -18641,23 +21408,23 @@ def test_get_public_gateway_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 200 - def test_get_public_gateway_all_params_with_retries(self): - # Enable retries and run test_get_public_gateway_all_params. + def test_get_network_acl_rule_all_params_with_retries(self): + # Enable retries and run test_get_network_acl_rule_all_params. _service.enable_retries() - self.test_get_public_gateway_all_params() + self.test_get_network_acl_rule_all_params() - # Disable retries and run test_get_public_gateway_all_params. + # Disable retries and run test_get_network_acl_rule_all_params. _service.disable_retries() - self.test_get_public_gateway_all_params() + self.test_get_network_acl_rule_all_params() @responses.activate - def test_get_public_gateway_value_error(self): + def test_get_network_acl_rule_value_error(self): """ - test_get_public_gateway_value_error() + test_get_network_acl_rule_value_error() """ # Set up mock - url = preprocess_url('/public_gateways/testString') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + url = preprocess_url('/network_acls/testString/rules/testString') + mock_response = '{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}' responses.add(responses.GET, url, body=mock_response, @@ -18665,58 +21432,77 @@ def test_get_public_gateway_value_error(self): status=200) # Set up parameter values + network_acl_id = 'testString' id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { + "network_acl_id": network_acl_id, "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.get_public_gateway(**req_copy) + _service.get_network_acl_rule(**req_copy) - def test_get_public_gateway_value_error_with_retries(self): - # Enable retries and run test_get_public_gateway_value_error. + def test_get_network_acl_rule_value_error_with_retries(self): + # Enable retries and run test_get_network_acl_rule_value_error. _service.enable_retries() - self.test_get_public_gateway_value_error() + self.test_get_network_acl_rule_value_error() - # Disable retries and run test_get_public_gateway_value_error. + # Disable retries and run test_get_network_acl_rule_value_error. _service.disable_retries() - self.test_get_public_gateway_value_error() + self.test_get_network_acl_rule_value_error() -class TestUpdatePublicGateway(): +class TestUpdateNetworkAclRule(): """ - Test Class for update_public_gateway + Test Class for update_network_acl_rule """ @responses.activate - def test_update_public_gateway_all_params(self): + def test_update_network_acl_rule_all_params(self): """ - update_public_gateway() + update_network_acl_rule() """ # Set up mock - url = preprocess_url('/public_gateways/testString') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + url = preprocess_url('/network_acls/testString/rules/testString') + mock_response = '{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}' responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) - # Construct a dict representation of a PublicGatewayPatch model - public_gateway_patch_model = {} - public_gateway_patch_model['name'] = 'my-public-gateway' + # Construct a dict representation of a NetworkACLRuleBeforePatchNetworkACLRuleIdentityById model + network_acl_rule_before_patch_model = {} + network_acl_rule_before_patch_model['id'] = '8daca77a-4980-4d33-8f3e-7038797be8f9' + + # Construct a dict representation of a NetworkACLRulePatch model + network_acl_rule_patch_model = {} + network_acl_rule_patch_model['action'] = 'allow' + network_acl_rule_patch_model['before'] = network_acl_rule_before_patch_model + network_acl_rule_patch_model['code'] = 0 + network_acl_rule_patch_model['destination'] = '192.168.3.2/32' + network_acl_rule_patch_model['destination_port_max'] = 22 + network_acl_rule_patch_model['destination_port_min'] = 22 + network_acl_rule_patch_model['direction'] = 'inbound' + network_acl_rule_patch_model['name'] = 'my-rule-2' + network_acl_rule_patch_model['source'] = '192.168.3.2/32' + network_acl_rule_patch_model['source_port_max'] = 65535 + network_acl_rule_patch_model['source_port_min'] = 49152 + network_acl_rule_patch_model['type'] = 8 # Set up parameter values + network_acl_id = 'testString' id = 'testString' - public_gateway_patch = public_gateway_patch_model + network_acl_rule_patch = network_acl_rule_patch_model # Invoke method - response = _service.update_public_gateway( + response = _service.update_network_acl_rule( + network_acl_id, id, - public_gateway_patch, + network_acl_rule_patch, headers={} ) @@ -18725,66 +21511,83 @@ def test_update_public_gateway_all_params(self): assert response.status_code == 200 # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == public_gateway_patch + assert req_body == network_acl_rule_patch - def test_update_public_gateway_all_params_with_retries(self): - # Enable retries and run test_update_public_gateway_all_params. + def test_update_network_acl_rule_all_params_with_retries(self): + # Enable retries and run test_update_network_acl_rule_all_params. _service.enable_retries() - self.test_update_public_gateway_all_params() + self.test_update_network_acl_rule_all_params() - # Disable retries and run test_update_public_gateway_all_params. + # Disable retries and run test_update_network_acl_rule_all_params. _service.disable_retries() - self.test_update_public_gateway_all_params() + self.test_update_network_acl_rule_all_params() @responses.activate - def test_update_public_gateway_value_error(self): + def test_update_network_acl_rule_value_error(self): """ - test_update_public_gateway_value_error() + test_update_network_acl_rule_value_error() """ # Set up mock - url = preprocess_url('/public_gateways/testString') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241", "id": "dc5431ef-1fc6-4861-adc9-a59d077d1241", "name": "my-public-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "public_gateway", "status": "available", "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + url = preprocess_url('/network_acls/testString/rules/testString') + mock_response = '{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}' responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) - # Construct a dict representation of a PublicGatewayPatch model - public_gateway_patch_model = {} - public_gateway_patch_model['name'] = 'my-public-gateway' + # Construct a dict representation of a NetworkACLRuleBeforePatchNetworkACLRuleIdentityById model + network_acl_rule_before_patch_model = {} + network_acl_rule_before_patch_model['id'] = '8daca77a-4980-4d33-8f3e-7038797be8f9' + + # Construct a dict representation of a NetworkACLRulePatch model + network_acl_rule_patch_model = {} + network_acl_rule_patch_model['action'] = 'allow' + network_acl_rule_patch_model['before'] = network_acl_rule_before_patch_model + network_acl_rule_patch_model['code'] = 0 + network_acl_rule_patch_model['destination'] = '192.168.3.2/32' + network_acl_rule_patch_model['destination_port_max'] = 22 + network_acl_rule_patch_model['destination_port_min'] = 22 + network_acl_rule_patch_model['direction'] = 'inbound' + network_acl_rule_patch_model['name'] = 'my-rule-2' + network_acl_rule_patch_model['source'] = '192.168.3.2/32' + network_acl_rule_patch_model['source_port_max'] = 65535 + network_acl_rule_patch_model['source_port_min'] = 49152 + network_acl_rule_patch_model['type'] = 8 # Set up parameter values + network_acl_id = 'testString' id = 'testString' - public_gateway_patch = public_gateway_patch_model + network_acl_rule_patch = network_acl_rule_patch_model # Pass in all but one required param and check for a ValueError req_param_dict = { + "network_acl_id": network_acl_id, "id": id, - "public_gateway_patch": public_gateway_patch, + "network_acl_rule_patch": network_acl_rule_patch, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.update_public_gateway(**req_copy) + _service.update_network_acl_rule(**req_copy) - def test_update_public_gateway_value_error_with_retries(self): - # Enable retries and run test_update_public_gateway_value_error. + def test_update_network_acl_rule_value_error_with_retries(self): + # Enable retries and run test_update_network_acl_rule_value_error. _service.enable_retries() - self.test_update_public_gateway_value_error() + self.test_update_network_acl_rule_value_error() - # Disable retries and run test_update_public_gateway_value_error. + # Disable retries and run test_update_network_acl_rule_value_error. _service.disable_retries() - self.test_update_public_gateway_value_error() + self.test_update_network_acl_rule_value_error() # endregion ############################################################################## -# End of Service: PublicGateways +# End of Service: NetworkACLs ############################################################################## ############################################################################## -# Start of Service: FloatingIPs +# Start of Service: SecurityGroups ############################################################################## # region @@ -18832,19 +21635,19 @@ def test_new_instance_required_param_none(self): service = VpcV1.new_instance( version=None, ) -class TestListFloatingIps(): +class TestListSecurityGroups(): """ - Test Class for list_floating_ips + Test Class for list_security_groups """ @responses.activate - def test_list_floating_ips_all_params(self): + def test_list_security_groups_all_params(self): """ - list_floating_ips() + list_security_groups() """ # Set up mock - url = preprocess_url('/floating_ips') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips?limit=20"}, "floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}' + url = preprocess_url('/security_groups') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "security_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -18855,14 +21658,18 @@ def test_list_floating_ips_all_params(self): start = 'testString' limit = 1 resource_group_id = 'testString' - sort = 'name' + vpc_id = 'testString' + vpc_crn = 'testString' + vpc_name = 'testString' # Invoke method - response = _service.list_floating_ips( + response = _service.list_security_groups( start=start, limit=limit, resource_group_id=resource_group_id, - sort=sort, + vpc_id=vpc_id, + vpc_crn=vpc_crn, + vpc_name=vpc_name, headers={} ) @@ -18875,25 +21682,27 @@ def test_list_floating_ips_all_params(self): assert 'start={}'.format(start) in query_string assert 'limit={}'.format(limit) in query_string assert 'resource_group.id={}'.format(resource_group_id) in query_string - assert 'sort={}'.format(sort) in query_string + assert 'vpc.id={}'.format(vpc_id) in query_string + assert 'vpc.crn={}'.format(vpc_crn) in query_string + assert 'vpc.name={}'.format(vpc_name) in query_string - def test_list_floating_ips_all_params_with_retries(self): - # Enable retries and run test_list_floating_ips_all_params. + def test_list_security_groups_all_params_with_retries(self): + # Enable retries and run test_list_security_groups_all_params. _service.enable_retries() - self.test_list_floating_ips_all_params() + self.test_list_security_groups_all_params() - # Disable retries and run test_list_floating_ips_all_params. + # Disable retries and run test_list_security_groups_all_params. _service.disable_retries() - self.test_list_floating_ips_all_params() + self.test_list_security_groups_all_params() @responses.activate - def test_list_floating_ips_required_params(self): + def test_list_security_groups_required_params(self): """ - test_list_floating_ips_required_params() + test_list_security_groups_required_params() """ # Set up mock - url = preprocess_url('/floating_ips') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips?limit=20"}, "floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}' + url = preprocess_url('/security_groups') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "security_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -18901,30 +21710,30 @@ def test_list_floating_ips_required_params(self): status=200) # Invoke method - response = _service.list_floating_ips() + response = _service.list_security_groups() # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 - def test_list_floating_ips_required_params_with_retries(self): - # Enable retries and run test_list_floating_ips_required_params. + def test_list_security_groups_required_params_with_retries(self): + # Enable retries and run test_list_security_groups_required_params. _service.enable_retries() - self.test_list_floating_ips_required_params() + self.test_list_security_groups_required_params() - # Disable retries and run test_list_floating_ips_required_params. + # Disable retries and run test_list_security_groups_required_params. _service.disable_retries() - self.test_list_floating_ips_required_params() + self.test_list_security_groups_required_params() @responses.activate - def test_list_floating_ips_value_error(self): + def test_list_security_groups_value_error(self): """ - test_list_floating_ips_value_error() + test_list_security_groups_value_error() """ # Set up mock - url = preprocess_url('/floating_ips') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips?limit=20"}, "floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}' + url = preprocess_url('/security_groups') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "security_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -18937,57 +21746,70 @@ def test_list_floating_ips_value_error(self): for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_floating_ips(**req_copy) + _service.list_security_groups(**req_copy) - def test_list_floating_ips_value_error_with_retries(self): - # Enable retries and run test_list_floating_ips_value_error. + def test_list_security_groups_value_error_with_retries(self): + # Enable retries and run test_list_security_groups_value_error. _service.enable_retries() - self.test_list_floating_ips_value_error() + self.test_list_security_groups_value_error() - # Disable retries and run test_list_floating_ips_value_error. + # Disable retries and run test_list_security_groups_value_error. _service.disable_retries() - self.test_list_floating_ips_value_error() + self.test_list_security_groups_value_error() -class TestCreateFloatingIp(): +class TestCreateSecurityGroup(): """ - Test Class for create_floating_ip + Test Class for create_security_group """ @responses.activate - def test_create_floating_ip_all_params(self): + def test_create_security_group_all_params(self): """ - create_floating_ip() + create_security_group() """ # Set up mock - url = preprocess_url('/floating_ips') - mock_response = '{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + url = preprocess_url('/security_groups') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) + # Construct a dict representation of a VPCIdentityById model + vpc_identity_model = {} + vpc_identity_model['id'] = '4727d842-f94f-4a2d-824a-9bc9b02c523b' + # Construct a dict representation of a ResourceGroupIdentityById model resource_group_identity_model = {} resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' - # Construct a dict representation of a ZoneIdentityByName model - zone_identity_model = {} - zone_identity_model['name'] = 'us-south-1' + # Construct a dict representation of a SecurityGroupRuleRemotePrototypeIP model + security_group_rule_remote_prototype_model = {} + security_group_rule_remote_prototype_model['address'] = '192.168.3.4' - # Construct a dict representation of a FloatingIPPrototypeFloatingIPByZone model - floating_ip_prototype_model = {} - floating_ip_prototype_model['name'] = 'my-floating-ip' - floating_ip_prototype_model['resource_group'] = resource_group_identity_model - floating_ip_prototype_model['zone'] = zone_identity_model + # Construct a dict representation of a SecurityGroupRulePrototypeSecurityGroupRuleProtocolICMP model + security_group_rule_prototype_model = {} + security_group_rule_prototype_model['code'] = 0 + security_group_rule_prototype_model['direction'] = 'inbound' + security_group_rule_prototype_model['ip_version'] = 'ipv4' + security_group_rule_prototype_model['protocol'] = 'icmp' + security_group_rule_prototype_model['remote'] = security_group_rule_remote_prototype_model + security_group_rule_prototype_model['type'] = 8 # Set up parameter values - floating_ip_prototype = floating_ip_prototype_model + vpc = vpc_identity_model + name = 'my-security-group' + resource_group = resource_group_identity_model + rules = [security_group_rule_prototype_model] # Invoke method - response = _service.create_floating_ip( - floating_ip_prototype, + response = _service.create_security_group( + vpc, + name=name, + resource_group=resource_group, + rules=rules, headers={} ) @@ -18996,79 +21818,92 @@ def test_create_floating_ip_all_params(self): assert response.status_code == 201 # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == floating_ip_prototype + assert req_body['vpc'] == vpc_identity_model + assert req_body['name'] == 'my-security-group' + assert req_body['resource_group'] == resource_group_identity_model + assert req_body['rules'] == [security_group_rule_prototype_model] - def test_create_floating_ip_all_params_with_retries(self): - # Enable retries and run test_create_floating_ip_all_params. + def test_create_security_group_all_params_with_retries(self): + # Enable retries and run test_create_security_group_all_params. _service.enable_retries() - self.test_create_floating_ip_all_params() + self.test_create_security_group_all_params() - # Disable retries and run test_create_floating_ip_all_params. + # Disable retries and run test_create_security_group_all_params. _service.disable_retries() - self.test_create_floating_ip_all_params() + self.test_create_security_group_all_params() @responses.activate - def test_create_floating_ip_value_error(self): + def test_create_security_group_value_error(self): """ - test_create_floating_ip_value_error() + test_create_security_group_value_error() """ # Set up mock - url = preprocess_url('/floating_ips') - mock_response = '{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + url = preprocess_url('/security_groups') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) + # Construct a dict representation of a VPCIdentityById model + vpc_identity_model = {} + vpc_identity_model['id'] = '4727d842-f94f-4a2d-824a-9bc9b02c523b' + # Construct a dict representation of a ResourceGroupIdentityById model resource_group_identity_model = {} resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' - # Construct a dict representation of a ZoneIdentityByName model - zone_identity_model = {} - zone_identity_model['name'] = 'us-south-1' + # Construct a dict representation of a SecurityGroupRuleRemotePrototypeIP model + security_group_rule_remote_prototype_model = {} + security_group_rule_remote_prototype_model['address'] = '192.168.3.4' - # Construct a dict representation of a FloatingIPPrototypeFloatingIPByZone model - floating_ip_prototype_model = {} - floating_ip_prototype_model['name'] = 'my-floating-ip' - floating_ip_prototype_model['resource_group'] = resource_group_identity_model - floating_ip_prototype_model['zone'] = zone_identity_model + # Construct a dict representation of a SecurityGroupRulePrototypeSecurityGroupRuleProtocolICMP model + security_group_rule_prototype_model = {} + security_group_rule_prototype_model['code'] = 0 + security_group_rule_prototype_model['direction'] = 'inbound' + security_group_rule_prototype_model['ip_version'] = 'ipv4' + security_group_rule_prototype_model['protocol'] = 'icmp' + security_group_rule_prototype_model['remote'] = security_group_rule_remote_prototype_model + security_group_rule_prototype_model['type'] = 8 # Set up parameter values - floating_ip_prototype = floating_ip_prototype_model + vpc = vpc_identity_model + name = 'my-security-group' + resource_group = resource_group_identity_model + rules = [security_group_rule_prototype_model] # Pass in all but one required param and check for a ValueError req_param_dict = { - "floating_ip_prototype": floating_ip_prototype, + "vpc": vpc, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.create_floating_ip(**req_copy) + _service.create_security_group(**req_copy) - def test_create_floating_ip_value_error_with_retries(self): - # Enable retries and run test_create_floating_ip_value_error. + def test_create_security_group_value_error_with_retries(self): + # Enable retries and run test_create_security_group_value_error. _service.enable_retries() - self.test_create_floating_ip_value_error() + self.test_create_security_group_value_error() - # Disable retries and run test_create_floating_ip_value_error. + # Disable retries and run test_create_security_group_value_error. _service.disable_retries() - self.test_create_floating_ip_value_error() + self.test_create_security_group_value_error() -class TestDeleteFloatingIp(): +class TestDeleteSecurityGroup(): """ - Test Class for delete_floating_ip + Test Class for delete_security_group """ @responses.activate - def test_delete_floating_ip_all_params(self): + def test_delete_security_group_all_params(self): """ - delete_floating_ip() + delete_security_group() """ # Set up mock - url = preprocess_url('/floating_ips/testString') + url = preprocess_url('/security_groups/testString') responses.add(responses.DELETE, url, status=204) @@ -19077,7 +21912,7 @@ def test_delete_floating_ip_all_params(self): id = 'testString' # Invoke method - response = _service.delete_floating_ip( + response = _service.delete_security_group( id, headers={} ) @@ -19086,22 +21921,22 @@ def test_delete_floating_ip_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 204 - def test_delete_floating_ip_all_params_with_retries(self): - # Enable retries and run test_delete_floating_ip_all_params. + def test_delete_security_group_all_params_with_retries(self): + # Enable retries and run test_delete_security_group_all_params. _service.enable_retries() - self.test_delete_floating_ip_all_params() + self.test_delete_security_group_all_params() - # Disable retries and run test_delete_floating_ip_all_params. + # Disable retries and run test_delete_security_group_all_params. _service.disable_retries() - self.test_delete_floating_ip_all_params() + self.test_delete_security_group_all_params() @responses.activate - def test_delete_floating_ip_value_error(self): + def test_delete_security_group_value_error(self): """ - test_delete_floating_ip_value_error() + test_delete_security_group_value_error() """ # Set up mock - url = preprocess_url('/floating_ips/testString') + url = preprocess_url('/security_groups/testString') responses.add(responses.DELETE, url, status=204) @@ -19116,31 +21951,31 @@ def test_delete_floating_ip_value_error(self): for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.delete_floating_ip(**req_copy) + _service.delete_security_group(**req_copy) - def test_delete_floating_ip_value_error_with_retries(self): - # Enable retries and run test_delete_floating_ip_value_error. + def test_delete_security_group_value_error_with_retries(self): + # Enable retries and run test_delete_security_group_value_error. _service.enable_retries() - self.test_delete_floating_ip_value_error() + self.test_delete_security_group_value_error() - # Disable retries and run test_delete_floating_ip_value_error. + # Disable retries and run test_delete_security_group_value_error. _service.disable_retries() - self.test_delete_floating_ip_value_error() + self.test_delete_security_group_value_error() -class TestGetFloatingIp(): +class TestGetSecurityGroup(): """ - Test Class for get_floating_ip + Test Class for get_security_group """ @responses.activate - def test_get_floating_ip_all_params(self): + def test_get_security_group_all_params(self): """ - get_floating_ip() + get_security_group() """ # Set up mock - url = preprocess_url('/floating_ips/testString') - mock_response = '{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + url = preprocess_url('/security_groups/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' responses.add(responses.GET, url, body=mock_response, @@ -19151,7 +21986,7 @@ def test_get_floating_ip_all_params(self): id = 'testString' # Invoke method - response = _service.get_floating_ip( + response = _service.get_security_group( id, headers={} ) @@ -19160,23 +21995,23 @@ def test_get_floating_ip_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 200 - def test_get_floating_ip_all_params_with_retries(self): - # Enable retries and run test_get_floating_ip_all_params. + def test_get_security_group_all_params_with_retries(self): + # Enable retries and run test_get_security_group_all_params. _service.enable_retries() - self.test_get_floating_ip_all_params() + self.test_get_security_group_all_params() - # Disable retries and run test_get_floating_ip_all_params. + # Disable retries and run test_get_security_group_all_params. _service.disable_retries() - self.test_get_floating_ip_all_params() + self.test_get_security_group_all_params() @responses.activate - def test_get_floating_ip_value_error(self): + def test_get_security_group_value_error(self): """ - test_get_floating_ip_value_error() + test_get_security_group_value_error() """ # Set up mock - url = preprocess_url('/floating_ips/testString') - mock_response = '{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + url = preprocess_url('/security_groups/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' responses.add(responses.GET, url, body=mock_response, @@ -19193,54 +22028,49 @@ def test_get_floating_ip_value_error(self): for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.get_floating_ip(**req_copy) + _service.get_security_group(**req_copy) - def test_get_floating_ip_value_error_with_retries(self): - # Enable retries and run test_get_floating_ip_value_error. + def test_get_security_group_value_error_with_retries(self): + # Enable retries and run test_get_security_group_value_error. _service.enable_retries() - self.test_get_floating_ip_value_error() + self.test_get_security_group_value_error() - # Disable retries and run test_get_floating_ip_value_error. + # Disable retries and run test_get_security_group_value_error. _service.disable_retries() - self.test_get_floating_ip_value_error() + self.test_get_security_group_value_error() -class TestUpdateFloatingIp(): +class TestUpdateSecurityGroup(): """ - Test Class for update_floating_ip + Test Class for update_security_group """ @responses.activate - def test_update_floating_ip_all_params(self): + def test_update_security_group_all_params(self): """ - update_floating_ip() + update_security_group() """ # Set up mock - url = preprocess_url('/floating_ips/testString') - mock_response = '{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + url = preprocess_url('/security_groups/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) - # Construct a dict representation of a FloatingIPTargetPatchNetworkInterfaceIdentityById model - floating_ip_target_patch_model = {} - floating_ip_target_patch_model['id'] = '10c02d81-0ecb-4dc5-897d-28392913b81e' - - # Construct a dict representation of a FloatingIPPatch model - floating_ip_patch_model = {} - floating_ip_patch_model['name'] = 'my-floating-ip' - floating_ip_patch_model['target'] = floating_ip_target_patch_model + # Construct a dict representation of a SecurityGroupPatch model + security_group_patch_model = {} + security_group_patch_model['name'] = 'my-security-group' # Set up parameter values id = 'testString' - floating_ip_patch = floating_ip_patch_model + security_group_patch = security_group_patch_model # Invoke method - response = _service.update_floating_ip( + response = _service.update_security_group( id, - floating_ip_patch, + security_group_patch, headers={} ) @@ -19249,131 +22079,72 @@ def test_update_floating_ip_all_params(self): assert response.status_code == 200 # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == floating_ip_patch + assert req_body == security_group_patch - def test_update_floating_ip_all_params_with_retries(self): - # Enable retries and run test_update_floating_ip_all_params. + def test_update_security_group_all_params_with_retries(self): + # Enable retries and run test_update_security_group_all_params. _service.enable_retries() - self.test_update_floating_ip_all_params() + self.test_update_security_group_all_params() - # Disable retries and run test_update_floating_ip_all_params. + # Disable retries and run test_update_security_group_all_params. _service.disable_retries() - self.test_update_floating_ip_all_params() + self.test_update_security_group_all_params() @responses.activate - def test_update_floating_ip_value_error(self): + def test_update_security_group_value_error(self): """ - test_update_floating_ip_value_error() + test_update_security_group_value_error() """ # Set up mock - url = preprocess_url('/floating_ips/testString') - mock_response = '{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "primary_ip": {"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}' + url = preprocess_url('/security_groups/testString') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) - # Construct a dict representation of a FloatingIPTargetPatchNetworkInterfaceIdentityById model - floating_ip_target_patch_model = {} - floating_ip_target_patch_model['id'] = '10c02d81-0ecb-4dc5-897d-28392913b81e' - - # Construct a dict representation of a FloatingIPPatch model - floating_ip_patch_model = {} - floating_ip_patch_model['name'] = 'my-floating-ip' - floating_ip_patch_model['target'] = floating_ip_target_patch_model + # Construct a dict representation of a SecurityGroupPatch model + security_group_patch_model = {} + security_group_patch_model['name'] = 'my-security-group' # Set up parameter values id = 'testString' - floating_ip_patch = floating_ip_patch_model + security_group_patch = security_group_patch_model # Pass in all but one required param and check for a ValueError req_param_dict = { "id": id, - "floating_ip_patch": floating_ip_patch, + "security_group_patch": security_group_patch, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.update_floating_ip(**req_copy) + _service.update_security_group(**req_copy) - def test_update_floating_ip_value_error_with_retries(self): - # Enable retries and run test_update_floating_ip_value_error. + def test_update_security_group_value_error_with_retries(self): + # Enable retries and run test_update_security_group_value_error. _service.enable_retries() - self.test_update_floating_ip_value_error() + self.test_update_security_group_value_error() - # Disable retries and run test_update_floating_ip_value_error. + # Disable retries and run test_update_security_group_value_error. _service.disable_retries() - self.test_update_floating_ip_value_error() - -# endregion -############################################################################## -# End of Service: FloatingIPs -############################################################################## - -############################################################################## -# Start of Service: NetworkACLs -############################################################################## -# region - -class TestNewInstance(): - """ - Test Class for new_instance - """ - - def test_new_instance(self): - """ - new_instance() - """ - os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' - - service = VpcV1.new_instance( - version=version, - service_name='TEST_SERVICE', - ) - - assert service is not None - assert isinstance(service, VpcV1) - - def test_new_instance_without_authenticator(self): - """ - new_instance_without_authenticator() - """ - with pytest.raises(ValueError, match='authenticator must be provided'): - service = VpcV1.new_instance( - version=version, - service_name='TEST_SERVICE_NOT_FOUND', - ) - - def test_new_instance_without_required_params(self): - """ - new_instance_without_required_params() - """ - with pytest.raises(TypeError, match='new_instance\\(\\) missing \\d required positional arguments?: \'.*\''): - service = VpcV1.new_instance() + self.test_update_security_group_value_error() - def test_new_instance_required_param_none(self): - """ - new_instance_required_param_none() - """ - with pytest.raises(ValueError, match='version must be provided'): - service = VpcV1.new_instance( - version=None, - ) -class TestListNetworkAcls(): +class TestListSecurityGroupRules(): """ - Test Class for list_network_acls + Test Class for list_security_group_rules """ @responses.activate - def test_list_network_acls_all_params(self): + def test_list_security_group_rules_all_params(self): """ - list_network_acls() + list_security_group_rules() """ # Set up mock - url = preprocess_url('/network_acls') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls?limit=20"}, "limit": 20, "network_acls": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}' + url = preprocess_url('/security_groups/testString/rules') + mock_response = '{"rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}]}' responses.add(responses.GET, url, body=mock_response, @@ -19381,153 +22152,103 @@ def test_list_network_acls_all_params(self): status=200) # Set up parameter values - start = 'testString' - limit = 1 - resource_group_id = 'testString' + security_group_id = 'testString' # Invoke method - response = _service.list_network_acls( - start=start, - limit=limit, - resource_group_id=resource_group_id, + response = _service.list_security_group_rules( + security_group_id, headers={} ) - # Check for correct operation - assert len(responses.calls) == 1 - assert response.status_code == 200 - # Validate query params - query_string = responses.calls[0].request.url.split('?',1)[1] - query_string = urllib.parse.unquote_plus(query_string) - assert 'start={}'.format(start) in query_string - assert 'limit={}'.format(limit) in query_string - assert 'resource_group.id={}'.format(resource_group_id) in query_string - - def test_list_network_acls_all_params_with_retries(self): - # Enable retries and run test_list_network_acls_all_params. - _service.enable_retries() - self.test_list_network_acls_all_params() - - # Disable retries and run test_list_network_acls_all_params. - _service.disable_retries() - self.test_list_network_acls_all_params() - - @responses.activate - def test_list_network_acls_required_params(self): - """ - test_list_network_acls_required_params() - """ - # Set up mock - url = preprocess_url('/network_acls') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls?limit=20"}, "limit": 20, "network_acls": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) - - # Invoke method - response = _service.list_network_acls() - - # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 - def test_list_network_acls_required_params_with_retries(self): - # Enable retries and run test_list_network_acls_required_params. + def test_list_security_group_rules_all_params_with_retries(self): + # Enable retries and run test_list_security_group_rules_all_params. _service.enable_retries() - self.test_list_network_acls_required_params() + self.test_list_security_group_rules_all_params() - # Disable retries and run test_list_network_acls_required_params. + # Disable retries and run test_list_security_group_rules_all_params. _service.disable_retries() - self.test_list_network_acls_required_params() + self.test_list_security_group_rules_all_params() @responses.activate - def test_list_network_acls_value_error(self): + def test_list_security_group_rules_value_error(self): """ - test_list_network_acls_value_error() + test_list_security_group_rules_value_error() """ # Set up mock - url = preprocess_url('/network_acls') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls?limit=20"}, "limit": 20, "network_acls": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}' + url = preprocess_url('/security_groups/testString/rules') + mock_response = '{"rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}]}' responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) + # Set up parameter values + security_group_id = 'testString' + # Pass in all but one required param and check for a ValueError req_param_dict = { + "security_group_id": security_group_id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_network_acls(**req_copy) + _service.list_security_group_rules(**req_copy) - def test_list_network_acls_value_error_with_retries(self): - # Enable retries and run test_list_network_acls_value_error. + def test_list_security_group_rules_value_error_with_retries(self): + # Enable retries and run test_list_security_group_rules_value_error. _service.enable_retries() - self.test_list_network_acls_value_error() + self.test_list_security_group_rules_value_error() - # Disable retries and run test_list_network_acls_value_error. + # Disable retries and run test_list_security_group_rules_value_error. _service.disable_retries() - self.test_list_network_acls_value_error() + self.test_list_security_group_rules_value_error() -class TestCreateNetworkAcl(): +class TestCreateSecurityGroupRule(): """ - Test Class for create_network_acl + Test Class for create_security_group_rule """ @responses.activate - def test_create_network_acl_all_params(self): + def test_create_security_group_rule_all_params(self): """ - create_network_acl() + create_security_group_rule() """ # Set up mock - url = preprocess_url('/network_acls') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' + url = preprocess_url('/security_groups/testString/rules') + mock_response = '{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) - # Construct a dict representation of a ResourceGroupIdentityById model - resource_group_identity_model = {} - resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' - - # Construct a dict representation of a VPCIdentityById model - vpc_identity_model = {} - vpc_identity_model['id'] = 'f0aae929-7047-46d1-92e1-9102b07a7f6f' - - # Construct a dict representation of a NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTCPUDP model - network_acl_rule_prototype_network_acl_context_model = {} - network_acl_rule_prototype_network_acl_context_model['action'] = 'allow' - network_acl_rule_prototype_network_acl_context_model['destination'] = '192.168.3.2/32' - network_acl_rule_prototype_network_acl_context_model['direction'] = 'inbound' - network_acl_rule_prototype_network_acl_context_model['name'] = 'my-rule-2' - network_acl_rule_prototype_network_acl_context_model['source'] = '192.168.3.2/32' - network_acl_rule_prototype_network_acl_context_model['destination_port_max'] = 22 - network_acl_rule_prototype_network_acl_context_model['destination_port_min'] = 22 - network_acl_rule_prototype_network_acl_context_model['protocol'] = 'udp' - network_acl_rule_prototype_network_acl_context_model['source_port_max'] = 65535 - network_acl_rule_prototype_network_acl_context_model['source_port_min'] = 49152 + # Construct a dict representation of a SecurityGroupRuleRemotePrototypeIP model + security_group_rule_remote_prototype_model = {} + security_group_rule_remote_prototype_model['address'] = '192.168.3.4' - # Construct a dict representation of a NetworkACLPrototypeNetworkACLByRules model - network_acl_prototype_model = {} - network_acl_prototype_model['name'] = 'my-network-acl' - network_acl_prototype_model['resource_group'] = resource_group_identity_model - network_acl_prototype_model['vpc'] = vpc_identity_model - network_acl_prototype_model['rules'] = [network_acl_rule_prototype_network_acl_context_model] + # Construct a dict representation of a SecurityGroupRulePrototypeSecurityGroupRuleProtocolICMP model + security_group_rule_prototype_model = {} + security_group_rule_prototype_model['code'] = 0 + security_group_rule_prototype_model['direction'] = 'inbound' + security_group_rule_prototype_model['ip_version'] = 'ipv4' + security_group_rule_prototype_model['protocol'] = 'icmp' + security_group_rule_prototype_model['remote'] = security_group_rule_remote_prototype_model + security_group_rule_prototype_model['type'] = 8 # Set up parameter values - network_acl_prototype = network_acl_prototype_model + security_group_id = 'testString' + security_group_rule_prototype = security_group_rule_prototype_model # Invoke method - response = _service.create_network_acl( - network_acl_prototype=network_acl_prototype, + response = _service.create_security_group_rule( + security_group_id, + security_group_rule_prototype, headers={} ) @@ -19536,101 +22257,91 @@ def test_create_network_acl_all_params(self): assert response.status_code == 201 # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == network_acl_prototype + assert req_body == security_group_rule_prototype - def test_create_network_acl_all_params_with_retries(self): - # Enable retries and run test_create_network_acl_all_params. + def test_create_security_group_rule_all_params_with_retries(self): + # Enable retries and run test_create_security_group_rule_all_params. _service.enable_retries() - self.test_create_network_acl_all_params() + self.test_create_security_group_rule_all_params() - # Disable retries and run test_create_network_acl_all_params. + # Disable retries and run test_create_security_group_rule_all_params. _service.disable_retries() - self.test_create_network_acl_all_params() + self.test_create_security_group_rule_all_params() @responses.activate - def test_create_network_acl_required_params(self): + def test_create_security_group_rule_value_error(self): """ - test_create_network_acl_required_params() + test_create_security_group_rule_value_error() """ # Set up mock - url = preprocess_url('/network_acls') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' + url = preprocess_url('/security_groups/testString/rules') + mock_response = '{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) - # Invoke method - response = _service.create_network_acl() - - - # Check for correct operation - assert len(responses.calls) == 1 - assert response.status_code == 201 - - def test_create_network_acl_required_params_with_retries(self): - # Enable retries and run test_create_network_acl_required_params. - _service.enable_retries() - self.test_create_network_acl_required_params() + # Construct a dict representation of a SecurityGroupRuleRemotePrototypeIP model + security_group_rule_remote_prototype_model = {} + security_group_rule_remote_prototype_model['address'] = '192.168.3.4' - # Disable retries and run test_create_network_acl_required_params. - _service.disable_retries() - self.test_create_network_acl_required_params() + # Construct a dict representation of a SecurityGroupRulePrototypeSecurityGroupRuleProtocolICMP model + security_group_rule_prototype_model = {} + security_group_rule_prototype_model['code'] = 0 + security_group_rule_prototype_model['direction'] = 'inbound' + security_group_rule_prototype_model['ip_version'] = 'ipv4' + security_group_rule_prototype_model['protocol'] = 'icmp' + security_group_rule_prototype_model['remote'] = security_group_rule_remote_prototype_model + security_group_rule_prototype_model['type'] = 8 - @responses.activate - def test_create_network_acl_value_error(self): - """ - test_create_network_acl_value_error() - """ - # Set up mock - url = preprocess_url('/network_acls') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' - responses.add(responses.POST, - url, - body=mock_response, - content_type='application/json', - status=201) + # Set up parameter values + security_group_id = 'testString' + security_group_rule_prototype = security_group_rule_prototype_model # Pass in all but one required param and check for a ValueError req_param_dict = { + "security_group_id": security_group_id, + "security_group_rule_prototype": security_group_rule_prototype, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.create_network_acl(**req_copy) + _service.create_security_group_rule(**req_copy) - def test_create_network_acl_value_error_with_retries(self): - # Enable retries and run test_create_network_acl_value_error. + def test_create_security_group_rule_value_error_with_retries(self): + # Enable retries and run test_create_security_group_rule_value_error. _service.enable_retries() - self.test_create_network_acl_value_error() + self.test_create_security_group_rule_value_error() - # Disable retries and run test_create_network_acl_value_error. + # Disable retries and run test_create_security_group_rule_value_error. _service.disable_retries() - self.test_create_network_acl_value_error() + self.test_create_security_group_rule_value_error() -class TestDeleteNetworkAcl(): +class TestDeleteSecurityGroupRule(): """ - Test Class for delete_network_acl + Test Class for delete_security_group_rule """ @responses.activate - def test_delete_network_acl_all_params(self): + def test_delete_security_group_rule_all_params(self): """ - delete_network_acl() + delete_security_group_rule() """ # Set up mock - url = preprocess_url('/network_acls/testString') + url = preprocess_url('/security_groups/testString/rules/testString') responses.add(responses.DELETE, url, status=204) # Set up parameter values + security_group_id = 'testString' id = 'testString' # Invoke method - response = _service.delete_network_acl( + response = _service.delete_security_group_rule( + security_group_id, id, headers={} ) @@ -19639,61 +22350,63 @@ def test_delete_network_acl_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 204 - def test_delete_network_acl_all_params_with_retries(self): - # Enable retries and run test_delete_network_acl_all_params. + def test_delete_security_group_rule_all_params_with_retries(self): + # Enable retries and run test_delete_security_group_rule_all_params. _service.enable_retries() - self.test_delete_network_acl_all_params() + self.test_delete_security_group_rule_all_params() - # Disable retries and run test_delete_network_acl_all_params. + # Disable retries and run test_delete_security_group_rule_all_params. _service.disable_retries() - self.test_delete_network_acl_all_params() + self.test_delete_security_group_rule_all_params() @responses.activate - def test_delete_network_acl_value_error(self): + def test_delete_security_group_rule_value_error(self): """ - test_delete_network_acl_value_error() + test_delete_security_group_rule_value_error() """ # Set up mock - url = preprocess_url('/network_acls/testString') + url = preprocess_url('/security_groups/testString/rules/testString') responses.add(responses.DELETE, url, status=204) # Set up parameter values + security_group_id = 'testString' id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { + "security_group_id": security_group_id, "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.delete_network_acl(**req_copy) + _service.delete_security_group_rule(**req_copy) - def test_delete_network_acl_value_error_with_retries(self): - # Enable retries and run test_delete_network_acl_value_error. + def test_delete_security_group_rule_value_error_with_retries(self): + # Enable retries and run test_delete_security_group_rule_value_error. _service.enable_retries() - self.test_delete_network_acl_value_error() + self.test_delete_security_group_rule_value_error() - # Disable retries and run test_delete_network_acl_value_error. + # Disable retries and run test_delete_security_group_rule_value_error. _service.disable_retries() - self.test_delete_network_acl_value_error() + self.test_delete_security_group_rule_value_error() -class TestGetNetworkAcl(): +class TestGetSecurityGroupRule(): """ - Test Class for get_network_acl + Test Class for get_security_group_rule """ @responses.activate - def test_get_network_acl_all_params(self): + def test_get_security_group_rule_all_params(self): """ - get_network_acl() + get_security_group_rule() """ # Set up mock - url = preprocess_url('/network_acls/testString') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' + url = preprocess_url('/security_groups/testString/rules/testString') + mock_response = '{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}' responses.add(responses.GET, url, body=mock_response, @@ -19701,10 +22414,12 @@ def test_get_network_acl_all_params(self): status=200) # Set up parameter values + security_group_id = 'testString' id = 'testString' # Invoke method - response = _service.get_network_acl( + response = _service.get_security_group_rule( + security_group_id, id, headers={} ) @@ -19713,23 +22428,23 @@ def test_get_network_acl_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 200 - def test_get_network_acl_all_params_with_retries(self): - # Enable retries and run test_get_network_acl_all_params. + def test_get_security_group_rule_all_params_with_retries(self): + # Enable retries and run test_get_security_group_rule_all_params. _service.enable_retries() - self.test_get_network_acl_all_params() + self.test_get_security_group_rule_all_params() - # Disable retries and run test_get_network_acl_all_params. + # Disable retries and run test_get_security_group_rule_all_params. _service.disable_retries() - self.test_get_network_acl_all_params() + self.test_get_security_group_rule_all_params() @responses.activate - def test_get_network_acl_value_error(self): + def test_get_security_group_rule_value_error(self): """ - test_get_network_acl_value_error() + test_get_security_group_rule_value_error() """ # Set up mock - url = preprocess_url('/network_acls/testString') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' + url = preprocess_url('/security_groups/testString/rules/testString') + mock_response = '{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}' responses.add(responses.GET, url, body=mock_response, @@ -19737,58 +22452,72 @@ def test_get_network_acl_value_error(self): status=200) # Set up parameter values + security_group_id = 'testString' id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { + "security_group_id": security_group_id, "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.get_network_acl(**req_copy) + _service.get_security_group_rule(**req_copy) - def test_get_network_acl_value_error_with_retries(self): - # Enable retries and run test_get_network_acl_value_error. + def test_get_security_group_rule_value_error_with_retries(self): + # Enable retries and run test_get_security_group_rule_value_error. _service.enable_retries() - self.test_get_network_acl_value_error() + self.test_get_security_group_rule_value_error() - # Disable retries and run test_get_network_acl_value_error. + # Disable retries and run test_get_security_group_rule_value_error. _service.disable_retries() - self.test_get_network_acl_value_error() + self.test_get_security_group_rule_value_error() -class TestUpdateNetworkAcl(): +class TestUpdateSecurityGroupRule(): """ - Test Class for update_network_acl + Test Class for update_security_group_rule """ @responses.activate - def test_update_network_acl_all_params(self): + def test_update_security_group_rule_all_params(self): """ - update_network_acl() + update_security_group_rule() """ # Set up mock - url = preprocess_url('/network_acls/testString') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' + url = preprocess_url('/security_groups/testString/rules/testString') + mock_response = '{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}' responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) - # Construct a dict representation of a NetworkACLPatch model - network_acl_patch_model = {} - network_acl_patch_model['name'] = 'my-network-acl' + # Construct a dict representation of a SecurityGroupRuleRemotePatchIP model + security_group_rule_remote_patch_model = {} + security_group_rule_remote_patch_model['address'] = '192.168.3.4' + + # Construct a dict representation of a SecurityGroupRulePatch model + security_group_rule_patch_model = {} + security_group_rule_patch_model['code'] = 0 + security_group_rule_patch_model['direction'] = 'inbound' + security_group_rule_patch_model['ip_version'] = 'ipv4' + security_group_rule_patch_model['port_max'] = 22 + security_group_rule_patch_model['port_min'] = 22 + security_group_rule_patch_model['remote'] = security_group_rule_remote_patch_model + security_group_rule_patch_model['type'] = 8 # Set up parameter values + security_group_id = 'testString' id = 'testString' - network_acl_patch = network_acl_patch_model + security_group_rule_patch = security_group_rule_patch_model # Invoke method - response = _service.update_network_acl( + response = _service.update_security_group_rule( + security_group_id, id, - network_acl_patch, + security_group_rule_patch, headers={} ) @@ -19797,72 +22526,84 @@ def test_update_network_acl_all_params(self): assert response.status_code == 200 # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == network_acl_patch + assert req_body == security_group_rule_patch - def test_update_network_acl_all_params_with_retries(self): - # Enable retries and run test_update_network_acl_all_params. + def test_update_security_group_rule_all_params_with_retries(self): + # Enable retries and run test_update_security_group_rule_all_params. _service.enable_retries() - self.test_update_network_acl_all_params() + self.test_update_security_group_rule_all_params() - # Disable retries and run test_update_network_acl_all_params. + # Disable retries and run test_update_security_group_rule_all_params. _service.disable_retries() - self.test_update_network_acl_all_params() + self.test_update_security_group_rule_all_params() @responses.activate - def test_update_network_acl_value_error(self): + def test_update_security_group_rule_value_error(self): """ - test_update_network_acl_value_error() + test_update_security_group_rule_value_error() """ # Set up mock - url = preprocess_url('/network_acls/testString') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' + url = preprocess_url('/security_groups/testString/rules/testString') + mock_response = '{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}' responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) - # Construct a dict representation of a NetworkACLPatch model - network_acl_patch_model = {} - network_acl_patch_model['name'] = 'my-network-acl' + # Construct a dict representation of a SecurityGroupRuleRemotePatchIP model + security_group_rule_remote_patch_model = {} + security_group_rule_remote_patch_model['address'] = '192.168.3.4' + + # Construct a dict representation of a SecurityGroupRulePatch model + security_group_rule_patch_model = {} + security_group_rule_patch_model['code'] = 0 + security_group_rule_patch_model['direction'] = 'inbound' + security_group_rule_patch_model['ip_version'] = 'ipv4' + security_group_rule_patch_model['port_max'] = 22 + security_group_rule_patch_model['port_min'] = 22 + security_group_rule_patch_model['remote'] = security_group_rule_remote_patch_model + security_group_rule_patch_model['type'] = 8 # Set up parameter values + security_group_id = 'testString' id = 'testString' - network_acl_patch = network_acl_patch_model + security_group_rule_patch = security_group_rule_patch_model # Pass in all but one required param and check for a ValueError req_param_dict = { + "security_group_id": security_group_id, "id": id, - "network_acl_patch": network_acl_patch, + "security_group_rule_patch": security_group_rule_patch, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.update_network_acl(**req_copy) + _service.update_security_group_rule(**req_copy) - def test_update_network_acl_value_error_with_retries(self): - # Enable retries and run test_update_network_acl_value_error. + def test_update_security_group_rule_value_error_with_retries(self): + # Enable retries and run test_update_security_group_rule_value_error. _service.enable_retries() - self.test_update_network_acl_value_error() + self.test_update_security_group_rule_value_error() - # Disable retries and run test_update_network_acl_value_error. + # Disable retries and run test_update_security_group_rule_value_error. _service.disable_retries() - self.test_update_network_acl_value_error() + self.test_update_security_group_rule_value_error() -class TestListNetworkAclRules(): +class TestListSecurityGroupTargets(): """ - Test Class for list_network_acl_rules + Test Class for list_security_group_targets """ @responses.activate - def test_list_network_acl_rules_all_params(self): + def test_list_security_group_targets_all_params(self): """ - list_network_acl_rules() + list_security_group_targets() """ # Set up mock - url = preprocess_url('/network_acls/testString/rules') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "total_count": 132}' + url = preprocess_url('/security_groups/testString/targets') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/targets?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/targets?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -19870,17 +22611,15 @@ def test_list_network_acl_rules_all_params(self): status=200) # Set up parameter values - network_acl_id = 'testString' + security_group_id = 'testString' start = 'testString' limit = 1 - direction = 'inbound' # Invoke method - response = _service.list_network_acl_rules( - network_acl_id, + response = _service.list_security_group_targets( + security_group_id, start=start, limit=limit, - direction=direction, headers={} ) @@ -19892,25 +22631,24 @@ def test_list_network_acl_rules_all_params(self): query_string = urllib.parse.unquote_plus(query_string) assert 'start={}'.format(start) in query_string assert 'limit={}'.format(limit) in query_string - assert 'direction={}'.format(direction) in query_string - def test_list_network_acl_rules_all_params_with_retries(self): - # Enable retries and run test_list_network_acl_rules_all_params. + def test_list_security_group_targets_all_params_with_retries(self): + # Enable retries and run test_list_security_group_targets_all_params. _service.enable_retries() - self.test_list_network_acl_rules_all_params() + self.test_list_security_group_targets_all_params() - # Disable retries and run test_list_network_acl_rules_all_params. + # Disable retries and run test_list_security_group_targets_all_params. _service.disable_retries() - self.test_list_network_acl_rules_all_params() + self.test_list_security_group_targets_all_params() @responses.activate - def test_list_network_acl_rules_required_params(self): + def test_list_security_group_targets_required_params(self): """ - test_list_network_acl_rules_required_params() + test_list_security_group_targets_required_params() """ # Set up mock - url = preprocess_url('/network_acls/testString/rules') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "total_count": 132}' + url = preprocess_url('/security_groups/testString/targets') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/targets?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/targets?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -19918,11 +22656,11 @@ def test_list_network_acl_rules_required_params(self): status=200) # Set up parameter values - network_acl_id = 'testString' + security_group_id = 'testString' # Invoke method - response = _service.list_network_acl_rules( - network_acl_id, + response = _service.list_security_group_targets( + security_group_id, headers={} ) @@ -19930,23 +22668,23 @@ def test_list_network_acl_rules_required_params(self): assert len(responses.calls) == 1 assert response.status_code == 200 - def test_list_network_acl_rules_required_params_with_retries(self): - # Enable retries and run test_list_network_acl_rules_required_params. + def test_list_security_group_targets_required_params_with_retries(self): + # Enable retries and run test_list_security_group_targets_required_params. _service.enable_retries() - self.test_list_network_acl_rules_required_params() + self.test_list_security_group_targets_required_params() - # Disable retries and run test_list_network_acl_rules_required_params. + # Disable retries and run test_list_security_group_targets_required_params. _service.disable_retries() - self.test_list_network_acl_rules_required_params() + self.test_list_security_group_targets_required_params() @responses.activate - def test_list_network_acl_rules_value_error(self): + def test_list_security_group_targets_value_error(self): """ - test_list_network_acl_rules_value_error() + test_list_security_group_targets_value_error() """ # Set up mock - url = preprocess_url('/network_acls/testString/rules') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}], "total_count": 132}' + url = preprocess_url('/security_groups/testString/targets') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/targets?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/targets?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -19954,166 +22692,50 @@ def test_list_network_acl_rules_value_error(self): status=200) # Set up parameter values - network_acl_id = 'testString' - - # Pass in all but one required param and check for a ValueError - req_param_dict = { - "network_acl_id": network_acl_id, - } - for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} - with pytest.raises(ValueError): - _service.list_network_acl_rules(**req_copy) - - - def test_list_network_acl_rules_value_error_with_retries(self): - # Enable retries and run test_list_network_acl_rules_value_error. - _service.enable_retries() - self.test_list_network_acl_rules_value_error() - - # Disable retries and run test_list_network_acl_rules_value_error. - _service.disable_retries() - self.test_list_network_acl_rules_value_error() - -class TestCreateNetworkAclRule(): - """ - Test Class for create_network_acl_rule - """ - - @responses.activate - def test_create_network_acl_rule_all_params(self): - """ - create_network_acl_rule() - """ - # Set up mock - url = preprocess_url('/network_acls/testString/rules') - mock_response = '{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}' - responses.add(responses.POST, - url, - body=mock_response, - content_type='application/json', - status=201) - - # Construct a dict representation of a NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityById model - network_acl_rule_before_prototype_model = {} - network_acl_rule_before_prototype_model['id'] = '8daca77a-4980-4d33-8f3e-7038797be8f9' - - # Construct a dict representation of a NetworkACLRulePrototypeNetworkACLRuleProtocolICMP model - network_acl_rule_prototype_model = {} - network_acl_rule_prototype_model['action'] = 'allow' - network_acl_rule_prototype_model['before'] = network_acl_rule_before_prototype_model - network_acl_rule_prototype_model['destination'] = '192.168.3.2/32' - network_acl_rule_prototype_model['direction'] = 'inbound' - network_acl_rule_prototype_model['name'] = 'my-rule-2' - network_acl_rule_prototype_model['source'] = '192.168.3.2/32' - network_acl_rule_prototype_model['code'] = 0 - network_acl_rule_prototype_model['protocol'] = 'icmp' - network_acl_rule_prototype_model['type'] = 8 - - # Set up parameter values - network_acl_id = 'testString' - network_acl_rule_prototype = network_acl_rule_prototype_model - - # Invoke method - response = _service.create_network_acl_rule( - network_acl_id, - network_acl_rule_prototype, - headers={} - ) - - # Check for correct operation - assert len(responses.calls) == 1 - assert response.status_code == 201 - # Validate body params - req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == network_acl_rule_prototype - - def test_create_network_acl_rule_all_params_with_retries(self): - # Enable retries and run test_create_network_acl_rule_all_params. - _service.enable_retries() - self.test_create_network_acl_rule_all_params() - - # Disable retries and run test_create_network_acl_rule_all_params. - _service.disable_retries() - self.test_create_network_acl_rule_all_params() - - @responses.activate - def test_create_network_acl_rule_value_error(self): - """ - test_create_network_acl_rule_value_error() - """ - # Set up mock - url = preprocess_url('/network_acls/testString/rules') - mock_response = '{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}' - responses.add(responses.POST, - url, - body=mock_response, - content_type='application/json', - status=201) - - # Construct a dict representation of a NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityById model - network_acl_rule_before_prototype_model = {} - network_acl_rule_before_prototype_model['id'] = '8daca77a-4980-4d33-8f3e-7038797be8f9' - - # Construct a dict representation of a NetworkACLRulePrototypeNetworkACLRuleProtocolICMP model - network_acl_rule_prototype_model = {} - network_acl_rule_prototype_model['action'] = 'allow' - network_acl_rule_prototype_model['before'] = network_acl_rule_before_prototype_model - network_acl_rule_prototype_model['destination'] = '192.168.3.2/32' - network_acl_rule_prototype_model['direction'] = 'inbound' - network_acl_rule_prototype_model['name'] = 'my-rule-2' - network_acl_rule_prototype_model['source'] = '192.168.3.2/32' - network_acl_rule_prototype_model['code'] = 0 - network_acl_rule_prototype_model['protocol'] = 'icmp' - network_acl_rule_prototype_model['type'] = 8 - - # Set up parameter values - network_acl_id = 'testString' - network_acl_rule_prototype = network_acl_rule_prototype_model + security_group_id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "network_acl_id": network_acl_id, - "network_acl_rule_prototype": network_acl_rule_prototype, + "security_group_id": security_group_id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.create_network_acl_rule(**req_copy) + _service.list_security_group_targets(**req_copy) - def test_create_network_acl_rule_value_error_with_retries(self): - # Enable retries and run test_create_network_acl_rule_value_error. + def test_list_security_group_targets_value_error_with_retries(self): + # Enable retries and run test_list_security_group_targets_value_error. _service.enable_retries() - self.test_create_network_acl_rule_value_error() + self.test_list_security_group_targets_value_error() - # Disable retries and run test_create_network_acl_rule_value_error. + # Disable retries and run test_list_security_group_targets_value_error. _service.disable_retries() - self.test_create_network_acl_rule_value_error() + self.test_list_security_group_targets_value_error() -class TestDeleteNetworkAclRule(): +class TestDeleteSecurityGroupTargetBinding(): """ - Test Class for delete_network_acl_rule + Test Class for delete_security_group_target_binding """ @responses.activate - def test_delete_network_acl_rule_all_params(self): + def test_delete_security_group_target_binding_all_params(self): """ - delete_network_acl_rule() + delete_security_group_target_binding() """ # Set up mock - url = preprocess_url('/network_acls/testString/rules/testString') + url = preprocess_url('/security_groups/testString/targets/testString') responses.add(responses.DELETE, url, status=204) # Set up parameter values - network_acl_id = 'testString' + security_group_id = 'testString' id = 'testString' # Invoke method - response = _service.delete_network_acl_rule( - network_acl_id, + response = _service.delete_security_group_target_binding( + security_group_id, id, headers={} ) @@ -20122,63 +22744,63 @@ def test_delete_network_acl_rule_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 204 - def test_delete_network_acl_rule_all_params_with_retries(self): - # Enable retries and run test_delete_network_acl_rule_all_params. + def test_delete_security_group_target_binding_all_params_with_retries(self): + # Enable retries and run test_delete_security_group_target_binding_all_params. _service.enable_retries() - self.test_delete_network_acl_rule_all_params() + self.test_delete_security_group_target_binding_all_params() - # Disable retries and run test_delete_network_acl_rule_all_params. + # Disable retries and run test_delete_security_group_target_binding_all_params. _service.disable_retries() - self.test_delete_network_acl_rule_all_params() + self.test_delete_security_group_target_binding_all_params() @responses.activate - def test_delete_network_acl_rule_value_error(self): + def test_delete_security_group_target_binding_value_error(self): """ - test_delete_network_acl_rule_value_error() + test_delete_security_group_target_binding_value_error() """ # Set up mock - url = preprocess_url('/network_acls/testString/rules/testString') + url = preprocess_url('/security_groups/testString/targets/testString') responses.add(responses.DELETE, url, status=204) # Set up parameter values - network_acl_id = 'testString' + security_group_id = 'testString' id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "network_acl_id": network_acl_id, + "security_group_id": security_group_id, "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.delete_network_acl_rule(**req_copy) + _service.delete_security_group_target_binding(**req_copy) - def test_delete_network_acl_rule_value_error_with_retries(self): - # Enable retries and run test_delete_network_acl_rule_value_error. + def test_delete_security_group_target_binding_value_error_with_retries(self): + # Enable retries and run test_delete_security_group_target_binding_value_error. _service.enable_retries() - self.test_delete_network_acl_rule_value_error() + self.test_delete_security_group_target_binding_value_error() - # Disable retries and run test_delete_network_acl_rule_value_error. + # Disable retries and run test_delete_security_group_target_binding_value_error. _service.disable_retries() - self.test_delete_network_acl_rule_value_error() + self.test_delete_security_group_target_binding_value_error() -class TestGetNetworkAclRule(): +class TestGetSecurityGroupTarget(): """ - Test Class for get_network_acl_rule + Test Class for get_security_group_target """ @responses.activate - def test_get_network_acl_rule_all_params(self): + def test_get_security_group_target_all_params(self): """ - get_network_acl_rule() + get_security_group_target() """ # Set up mock - url = preprocess_url('/network_acls/testString/rules/testString') - mock_response = '{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}' + url = preprocess_url('/security_groups/testString/targets/testString') + mock_response = '{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}' responses.add(responses.GET, url, body=mock_response, @@ -20186,12 +22808,12 @@ def test_get_network_acl_rule_all_params(self): status=200) # Set up parameter values - network_acl_id = 'testString' + security_group_id = 'testString' id = 'testString' # Invoke method - response = _service.get_network_acl_rule( - network_acl_id, + response = _service.get_security_group_target( + security_group_id, id, headers={} ) @@ -20200,23 +22822,23 @@ def test_get_network_acl_rule_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 200 - def test_get_network_acl_rule_all_params_with_retries(self): - # Enable retries and run test_get_network_acl_rule_all_params. + def test_get_security_group_target_all_params_with_retries(self): + # Enable retries and run test_get_security_group_target_all_params. _service.enable_retries() - self.test_get_network_acl_rule_all_params() + self.test_get_security_group_target_all_params() - # Disable retries and run test_get_network_acl_rule_all_params. + # Disable retries and run test_get_security_group_target_all_params. _service.disable_retries() - self.test_get_network_acl_rule_all_params() + self.test_get_security_group_target_all_params() @responses.activate - def test_get_network_acl_rule_value_error(self): + def test_get_security_group_target_value_error(self): """ - test_get_network_acl_rule_value_error() + test_get_security_group_target_value_error() """ # Set up mock - url = preprocess_url('/network_acls/testString/rules/testString') - mock_response = '{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}' + url = preprocess_url('/security_groups/testString/targets/testString') + mock_response = '{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}' responses.add(responses.GET, url, body=mock_response, @@ -20224,162 +22846,117 @@ def test_get_network_acl_rule_value_error(self): status=200) # Set up parameter values - network_acl_id = 'testString' + security_group_id = 'testString' id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "network_acl_id": network_acl_id, + "security_group_id": security_group_id, "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.get_network_acl_rule(**req_copy) + _service.get_security_group_target(**req_copy) - def test_get_network_acl_rule_value_error_with_retries(self): - # Enable retries and run test_get_network_acl_rule_value_error. + def test_get_security_group_target_value_error_with_retries(self): + # Enable retries and run test_get_security_group_target_value_error. _service.enable_retries() - self.test_get_network_acl_rule_value_error() + self.test_get_security_group_target_value_error() - # Disable retries and run test_get_network_acl_rule_value_error. + # Disable retries and run test_get_security_group_target_value_error. _service.disable_retries() - self.test_get_network_acl_rule_value_error() + self.test_get_security_group_target_value_error() -class TestUpdateNetworkAclRule(): +class TestCreateSecurityGroupTargetBinding(): """ - Test Class for update_network_acl_rule + Test Class for create_security_group_target_binding """ @responses.activate - def test_update_network_acl_rule_all_params(self): + def test_create_security_group_target_binding_all_params(self): """ - update_network_acl_rule() + create_security_group_target_binding() """ # Set up mock - url = preprocess_url('/network_acls/testString/rules/testString') - mock_response = '{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}' - responses.add(responses.PATCH, + url = preprocess_url('/security_groups/testString/targets/testString') + mock_response = '{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}' + responses.add(responses.PUT, url, body=mock_response, content_type='application/json', status=200) - # Construct a dict representation of a NetworkACLRuleBeforePatchNetworkACLRuleIdentityById model - network_acl_rule_before_patch_model = {} - network_acl_rule_before_patch_model['id'] = '8daca77a-4980-4d33-8f3e-7038797be8f9' - - # Construct a dict representation of a NetworkACLRulePatch model - network_acl_rule_patch_model = {} - network_acl_rule_patch_model['action'] = 'allow' - network_acl_rule_patch_model['before'] = network_acl_rule_before_patch_model - network_acl_rule_patch_model['code'] = 0 - network_acl_rule_patch_model['destination'] = '192.168.3.2/32' - network_acl_rule_patch_model['destination_port_max'] = 22 - network_acl_rule_patch_model['destination_port_min'] = 22 - network_acl_rule_patch_model['direction'] = 'inbound' - network_acl_rule_patch_model['name'] = 'my-rule-2' - network_acl_rule_patch_model['source'] = '192.168.3.2/32' - network_acl_rule_patch_model['source_port_max'] = 65535 - network_acl_rule_patch_model['source_port_min'] = 49152 - network_acl_rule_patch_model['type'] = 8 - # Set up parameter values - network_acl_id = 'testString' + security_group_id = 'testString' id = 'testString' - network_acl_rule_patch = network_acl_rule_patch_model # Invoke method - response = _service.update_network_acl_rule( - network_acl_id, + response = _service.create_security_group_target_binding( + security_group_id, id, - network_acl_rule_patch, headers={} ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 - # Validate body params - req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == network_acl_rule_patch - def test_update_network_acl_rule_all_params_with_retries(self): - # Enable retries and run test_update_network_acl_rule_all_params. + def test_create_security_group_target_binding_all_params_with_retries(self): + # Enable retries and run test_create_security_group_target_binding_all_params. _service.enable_retries() - self.test_update_network_acl_rule_all_params() + self.test_create_security_group_target_binding_all_params() - # Disable retries and run test_update_network_acl_rule_all_params. + # Disable retries and run test_create_security_group_target_binding_all_params. _service.disable_retries() - self.test_update_network_acl_rule_all_params() + self.test_create_security_group_target_binding_all_params() @responses.activate - def test_update_network_acl_rule_value_error(self): + def test_create_security_group_target_binding_value_error(self): """ - test_update_network_acl_rule_value_error() + test_create_security_group_target_binding_value_error() """ # Set up mock - url = preprocess_url('/network_acls/testString/rules/testString') - mock_response = '{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "code": 0, "protocol": "icmp", "type": 8}' - responses.add(responses.PATCH, + url = preprocess_url('/security_groups/testString/targets/testString') + mock_response = '{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}' + responses.add(responses.PUT, url, body=mock_response, content_type='application/json', status=200) - # Construct a dict representation of a NetworkACLRuleBeforePatchNetworkACLRuleIdentityById model - network_acl_rule_before_patch_model = {} - network_acl_rule_before_patch_model['id'] = '8daca77a-4980-4d33-8f3e-7038797be8f9' - - # Construct a dict representation of a NetworkACLRulePatch model - network_acl_rule_patch_model = {} - network_acl_rule_patch_model['action'] = 'allow' - network_acl_rule_patch_model['before'] = network_acl_rule_before_patch_model - network_acl_rule_patch_model['code'] = 0 - network_acl_rule_patch_model['destination'] = '192.168.3.2/32' - network_acl_rule_patch_model['destination_port_max'] = 22 - network_acl_rule_patch_model['destination_port_min'] = 22 - network_acl_rule_patch_model['direction'] = 'inbound' - network_acl_rule_patch_model['name'] = 'my-rule-2' - network_acl_rule_patch_model['source'] = '192.168.3.2/32' - network_acl_rule_patch_model['source_port_max'] = 65535 - network_acl_rule_patch_model['source_port_min'] = 49152 - network_acl_rule_patch_model['type'] = 8 - # Set up parameter values - network_acl_id = 'testString' + security_group_id = 'testString' id = 'testString' - network_acl_rule_patch = network_acl_rule_patch_model # Pass in all but one required param and check for a ValueError req_param_dict = { - "network_acl_id": network_acl_id, + "security_group_id": security_group_id, "id": id, - "network_acl_rule_patch": network_acl_rule_patch, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.update_network_acl_rule(**req_copy) + _service.create_security_group_target_binding(**req_copy) - def test_update_network_acl_rule_value_error_with_retries(self): - # Enable retries and run test_update_network_acl_rule_value_error. + def test_create_security_group_target_binding_value_error_with_retries(self): + # Enable retries and run test_create_security_group_target_binding_value_error. _service.enable_retries() - self.test_update_network_acl_rule_value_error() + self.test_create_security_group_target_binding_value_error() - # Disable retries and run test_update_network_acl_rule_value_error. + # Disable retries and run test_create_security_group_target_binding_value_error. _service.disable_retries() - self.test_update_network_acl_rule_value_error() + self.test_create_security_group_target_binding_value_error() # endregion ############################################################################## -# End of Service: NetworkACLs +# End of Service: SecurityGroups ############################################################################## ############################################################################## -# Start of Service: SecurityGroups +# Start of Service: VPNGateways ############################################################################## # region @@ -20427,19 +23004,19 @@ def test_new_instance_required_param_none(self): service = VpcV1.new_instance( version=None, ) -class TestListSecurityGroups(): +class TestListIkePolicies(): """ - Test Class for list_security_groups + Test Class for list_ike_policies """ @responses.activate - def test_list_security_groups_all_params(self): + def test_list_ike_policies_all_params(self): """ - list_security_groups() + list_ike_policies() """ # Set up mock - url = preprocess_url('/security_groups') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "security_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "total_count": 132}' + url = preprocess_url('/ike_policies') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies?limit=20"}, "ike_policies": [{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "dh_group": 14, "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "ike_version": 1, "key_lifetime": 28800, "name": "my-ike-policy", "negotiation_mode": "main", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ike_policy"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -20449,19 +23026,11 @@ def test_list_security_groups_all_params(self): # Set up parameter values start = 'testString' limit = 1 - resource_group_id = 'testString' - vpc_id = 'testString' - vpc_crn = 'testString' - vpc_name = 'testString' # Invoke method - response = _service.list_security_groups( + response = _service.list_ike_policies( start=start, limit=limit, - resource_group_id=resource_group_id, - vpc_id=vpc_id, - vpc_crn=vpc_crn, - vpc_name=vpc_name, headers={} ) @@ -20473,28 +23042,24 @@ def test_list_security_groups_all_params(self): query_string = urllib.parse.unquote_plus(query_string) assert 'start={}'.format(start) in query_string assert 'limit={}'.format(limit) in query_string - assert 'resource_group.id={}'.format(resource_group_id) in query_string - assert 'vpc.id={}'.format(vpc_id) in query_string - assert 'vpc.crn={}'.format(vpc_crn) in query_string - assert 'vpc.name={}'.format(vpc_name) in query_string - def test_list_security_groups_all_params_with_retries(self): - # Enable retries and run test_list_security_groups_all_params. + def test_list_ike_policies_all_params_with_retries(self): + # Enable retries and run test_list_ike_policies_all_params. _service.enable_retries() - self.test_list_security_groups_all_params() + self.test_list_ike_policies_all_params() - # Disable retries and run test_list_security_groups_all_params. + # Disable retries and run test_list_ike_policies_all_params. _service.disable_retries() - self.test_list_security_groups_all_params() + self.test_list_ike_policies_all_params() @responses.activate - def test_list_security_groups_required_params(self): + def test_list_ike_policies_required_params(self): """ - test_list_security_groups_required_params() + test_list_ike_policies_required_params() """ # Set up mock - url = preprocess_url('/security_groups') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "security_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "total_count": 132}' + url = preprocess_url('/ike_policies') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies?limit=20"}, "ike_policies": [{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "dh_group": 14, "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "ike_version": 1, "key_lifetime": 28800, "name": "my-ike-policy", "negotiation_mode": "main", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ike_policy"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -20502,30 +23067,30 @@ def test_list_security_groups_required_params(self): status=200) # Invoke method - response = _service.list_security_groups() + response = _service.list_ike_policies() # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 - def test_list_security_groups_required_params_with_retries(self): - # Enable retries and run test_list_security_groups_required_params. + def test_list_ike_policies_required_params_with_retries(self): + # Enable retries and run test_list_ike_policies_required_params. _service.enable_retries() - self.test_list_security_groups_required_params() + self.test_list_ike_policies_required_params() - # Disable retries and run test_list_security_groups_required_params. + # Disable retries and run test_list_ike_policies_required_params. _service.disable_retries() - self.test_list_security_groups_required_params() + self.test_list_ike_policies_required_params() @responses.activate - def test_list_security_groups_value_error(self): + def test_list_ike_policies_value_error(self): """ - test_list_security_groups_value_error() + test_list_ike_policies_value_error() """ # Set up mock - url = preprocess_url('/security_groups') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "security_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "total_count": 132}' + url = preprocess_url('/ike_policies') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies?limit=20"}, "ike_policies": [{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "dh_group": 14, "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "ike_version": 1, "key_lifetime": 28800, "name": "my-ike-policy", "negotiation_mode": "main", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ike_policy"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -20538,70 +23103,59 @@ def test_list_security_groups_value_error(self): for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_security_groups(**req_copy) + _service.list_ike_policies(**req_copy) - def test_list_security_groups_value_error_with_retries(self): - # Enable retries and run test_list_security_groups_value_error. + def test_list_ike_policies_value_error_with_retries(self): + # Enable retries and run test_list_ike_policies_value_error. _service.enable_retries() - self.test_list_security_groups_value_error() + self.test_list_ike_policies_value_error() - # Disable retries and run test_list_security_groups_value_error. + # Disable retries and run test_list_ike_policies_value_error. _service.disable_retries() - self.test_list_security_groups_value_error() + self.test_list_ike_policies_value_error() -class TestCreateSecurityGroup(): +class TestCreateIkePolicy(): """ - Test Class for create_security_group + Test Class for create_ike_policy """ @responses.activate - def test_create_security_group_all_params(self): + def test_create_ike_policy_all_params(self): """ - create_security_group() + create_ike_policy() """ # Set up mock - url = preprocess_url('/security_groups') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' + url = preprocess_url('/ike_policies') + mock_response = '{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "dh_group": 14, "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "ike_version": 1, "key_lifetime": 28800, "name": "my-ike-policy", "negotiation_mode": "main", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ike_policy"}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) - # Construct a dict representation of a VPCIdentityById model - vpc_identity_model = {} - vpc_identity_model['id'] = '4727d842-f94f-4a2d-824a-9bc9b02c523b' - # Construct a dict representation of a ResourceGroupIdentityById model resource_group_identity_model = {} resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' - # Construct a dict representation of a SecurityGroupRuleRemotePrototypeIP model - security_group_rule_remote_prototype_model = {} - security_group_rule_remote_prototype_model['address'] = '192.168.3.4' - - # Construct a dict representation of a SecurityGroupRulePrototypeSecurityGroupRuleProtocolICMP model - security_group_rule_prototype_model = {} - security_group_rule_prototype_model['code'] = 0 - security_group_rule_prototype_model['direction'] = 'inbound' - security_group_rule_prototype_model['ip_version'] = 'ipv4' - security_group_rule_prototype_model['protocol'] = 'icmp' - security_group_rule_prototype_model['remote'] = security_group_rule_remote_prototype_model - security_group_rule_prototype_model['type'] = 8 - # Set up parameter values - vpc = vpc_identity_model - name = 'my-security-group' + authentication_algorithm = 'md5' + dh_group = 14 + encryption_algorithm = 'aes128' + ike_version = 1 + key_lifetime = 28800 + name = 'my-ike-policy' resource_group = resource_group_identity_model - rules = [security_group_rule_prototype_model] # Invoke method - response = _service.create_security_group( - vpc, + response = _service.create_ike_policy( + authentication_algorithm, + dh_group, + encryption_algorithm, + ike_version, + key_lifetime=key_lifetime, name=name, resource_group=resource_group, - rules=rules, headers={} ) @@ -20610,92 +23164,84 @@ def test_create_security_group_all_params(self): assert response.status_code == 201 # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body['vpc'] == vpc_identity_model - assert req_body['name'] == 'my-security-group' + assert req_body['authentication_algorithm'] == 'md5' + assert req_body['dh_group'] == 14 + assert req_body['encryption_algorithm'] == 'aes128' + assert req_body['ike_version'] == 1 + assert req_body['key_lifetime'] == 28800 + assert req_body['name'] == 'my-ike-policy' assert req_body['resource_group'] == resource_group_identity_model - assert req_body['rules'] == [security_group_rule_prototype_model] - def test_create_security_group_all_params_with_retries(self): - # Enable retries and run test_create_security_group_all_params. + def test_create_ike_policy_all_params_with_retries(self): + # Enable retries and run test_create_ike_policy_all_params. _service.enable_retries() - self.test_create_security_group_all_params() + self.test_create_ike_policy_all_params() - # Disable retries and run test_create_security_group_all_params. + # Disable retries and run test_create_ike_policy_all_params. _service.disable_retries() - self.test_create_security_group_all_params() + self.test_create_ike_policy_all_params() @responses.activate - def test_create_security_group_value_error(self): + def test_create_ike_policy_value_error(self): """ - test_create_security_group_value_error() + test_create_ike_policy_value_error() """ # Set up mock - url = preprocess_url('/security_groups') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' + url = preprocess_url('/ike_policies') + mock_response = '{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "dh_group": 14, "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "ike_version": 1, "key_lifetime": 28800, "name": "my-ike-policy", "negotiation_mode": "main", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ike_policy"}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) - # Construct a dict representation of a VPCIdentityById model - vpc_identity_model = {} - vpc_identity_model['id'] = '4727d842-f94f-4a2d-824a-9bc9b02c523b' - # Construct a dict representation of a ResourceGroupIdentityById model resource_group_identity_model = {} resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' - # Construct a dict representation of a SecurityGroupRuleRemotePrototypeIP model - security_group_rule_remote_prototype_model = {} - security_group_rule_remote_prototype_model['address'] = '192.168.3.4' - - # Construct a dict representation of a SecurityGroupRulePrototypeSecurityGroupRuleProtocolICMP model - security_group_rule_prototype_model = {} - security_group_rule_prototype_model['code'] = 0 - security_group_rule_prototype_model['direction'] = 'inbound' - security_group_rule_prototype_model['ip_version'] = 'ipv4' - security_group_rule_prototype_model['protocol'] = 'icmp' - security_group_rule_prototype_model['remote'] = security_group_rule_remote_prototype_model - security_group_rule_prototype_model['type'] = 8 - # Set up parameter values - vpc = vpc_identity_model - name = 'my-security-group' + authentication_algorithm = 'md5' + dh_group = 14 + encryption_algorithm = 'aes128' + ike_version = 1 + key_lifetime = 28800 + name = 'my-ike-policy' resource_group = resource_group_identity_model - rules = [security_group_rule_prototype_model] # Pass in all but one required param and check for a ValueError req_param_dict = { - "vpc": vpc, + "authentication_algorithm": authentication_algorithm, + "dh_group": dh_group, + "encryption_algorithm": encryption_algorithm, + "ike_version": ike_version, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.create_security_group(**req_copy) + _service.create_ike_policy(**req_copy) - def test_create_security_group_value_error_with_retries(self): - # Enable retries and run test_create_security_group_value_error. + def test_create_ike_policy_value_error_with_retries(self): + # Enable retries and run test_create_ike_policy_value_error. _service.enable_retries() - self.test_create_security_group_value_error() + self.test_create_ike_policy_value_error() - # Disable retries and run test_create_security_group_value_error. + # Disable retries and run test_create_ike_policy_value_error. _service.disable_retries() - self.test_create_security_group_value_error() + self.test_create_ike_policy_value_error() -class TestDeleteSecurityGroup(): +class TestDeleteIkePolicy(): """ - Test Class for delete_security_group + Test Class for delete_ike_policy """ @responses.activate - def test_delete_security_group_all_params(self): + def test_delete_ike_policy_all_params(self): """ - delete_security_group() + delete_ike_policy() """ # Set up mock - url = preprocess_url('/security_groups/testString') + url = preprocess_url('/ike_policies/testString') responses.add(responses.DELETE, url, status=204) @@ -20704,7 +23250,7 @@ def test_delete_security_group_all_params(self): id = 'testString' # Invoke method - response = _service.delete_security_group( + response = _service.delete_ike_policy( id, headers={} ) @@ -20713,25 +23259,102 @@ def test_delete_security_group_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 204 - def test_delete_security_group_all_params_with_retries(self): - # Enable retries and run test_delete_security_group_all_params. + def test_delete_ike_policy_all_params_with_retries(self): + # Enable retries and run test_delete_ike_policy_all_params. _service.enable_retries() - self.test_delete_security_group_all_params() + self.test_delete_ike_policy_all_params() - # Disable retries and run test_delete_security_group_all_params. + # Disable retries and run test_delete_ike_policy_all_params. _service.disable_retries() - self.test_delete_security_group_all_params() + self.test_delete_ike_policy_all_params() @responses.activate - def test_delete_security_group_value_error(self): + def test_delete_ike_policy_value_error(self): """ - test_delete_security_group_value_error() + test_delete_ike_policy_value_error() """ # Set up mock - url = preprocess_url('/security_groups/testString') + url = preprocess_url('/ike_policies/testString') responses.add(responses.DELETE, url, - status=204) + status=204) + + # Set up parameter values + id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "id": id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.delete_ike_policy(**req_copy) + + + def test_delete_ike_policy_value_error_with_retries(self): + # Enable retries and run test_delete_ike_policy_value_error. + _service.enable_retries() + self.test_delete_ike_policy_value_error() + + # Disable retries and run test_delete_ike_policy_value_error. + _service.disable_retries() + self.test_delete_ike_policy_value_error() + +class TestGetIkePolicy(): + """ + Test Class for get_ike_policy + """ + + @responses.activate + def test_get_ike_policy_all_params(self): + """ + get_ike_policy() + """ + # Set up mock + url = preprocess_url('/ike_policies/testString') + mock_response = '{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "dh_group": 14, "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "ike_version": 1, "key_lifetime": 28800, "name": "my-ike-policy", "negotiation_mode": "main", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ike_policy"}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + id = 'testString' + + # Invoke method + response = _service.get_ike_policy( + id, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_ike_policy_all_params_with_retries(self): + # Enable retries and run test_get_ike_policy_all_params. + _service.enable_retries() + self.test_get_ike_policy_all_params() + + # Disable retries and run test_get_ike_policy_all_params. + _service.disable_retries() + self.test_get_ike_policy_all_params() + + @responses.activate + def test_get_ike_policy_value_error(self): + """ + test_get_ike_policy_value_error() + """ + # Set up mock + url = preprocess_url('/ike_policies/testString') + mock_response = '{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "dh_group": 14, "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "ike_version": 1, "key_lifetime": 28800, "name": "my-ike-policy", "negotiation_mode": "main", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ike_policy"}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) # Set up parameter values id = 'testString' @@ -20743,200 +23366,210 @@ def test_delete_security_group_value_error(self): for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.delete_security_group(**req_copy) + _service.get_ike_policy(**req_copy) - def test_delete_security_group_value_error_with_retries(self): - # Enable retries and run test_delete_security_group_value_error. + def test_get_ike_policy_value_error_with_retries(self): + # Enable retries and run test_get_ike_policy_value_error. _service.enable_retries() - self.test_delete_security_group_value_error() + self.test_get_ike_policy_value_error() - # Disable retries and run test_delete_security_group_value_error. + # Disable retries and run test_get_ike_policy_value_error. _service.disable_retries() - self.test_delete_security_group_value_error() + self.test_get_ike_policy_value_error() -class TestGetSecurityGroup(): +class TestUpdateIkePolicy(): """ - Test Class for get_security_group + Test Class for update_ike_policy """ @responses.activate - def test_get_security_group_all_params(self): + def test_update_ike_policy_all_params(self): """ - get_security_group() + update_ike_policy() """ # Set up mock - url = preprocess_url('/security_groups/testString') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' - responses.add(responses.GET, + url = preprocess_url('/ike_policies/testString') + mock_response = '{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "dh_group": 14, "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "ike_version": 1, "key_lifetime": 28800, "name": "my-ike-policy", "negotiation_mode": "main", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ike_policy"}' + responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) + # Construct a dict representation of a IKEPolicyPatch model + ike_policy_patch_model = {} + ike_policy_patch_model['authentication_algorithm'] = 'md5' + ike_policy_patch_model['dh_group'] = 14 + ike_policy_patch_model['encryption_algorithm'] = 'aes128' + ike_policy_patch_model['ike_version'] = 1 + ike_policy_patch_model['key_lifetime'] = 28800 + ike_policy_patch_model['name'] = 'my-ike-policy' + # Set up parameter values id = 'testString' + ike_policy_patch = ike_policy_patch_model # Invoke method - response = _service.get_security_group( + response = _service.update_ike_policy( id, + ike_policy_patch, headers={} ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body == ike_policy_patch - def test_get_security_group_all_params_with_retries(self): - # Enable retries and run test_get_security_group_all_params. + def test_update_ike_policy_all_params_with_retries(self): + # Enable retries and run test_update_ike_policy_all_params. _service.enable_retries() - self.test_get_security_group_all_params() + self.test_update_ike_policy_all_params() - # Disable retries and run test_get_security_group_all_params. + # Disable retries and run test_update_ike_policy_all_params. _service.disable_retries() - self.test_get_security_group_all_params() + self.test_update_ike_policy_all_params() @responses.activate - def test_get_security_group_value_error(self): + def test_update_ike_policy_value_error(self): """ - test_get_security_group_value_error() + test_update_ike_policy_value_error() """ # Set up mock - url = preprocess_url('/security_groups/testString') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' - responses.add(responses.GET, + url = preprocess_url('/ike_policies/testString') + mock_response = '{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "dh_group": 14, "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "ike_version": 1, "key_lifetime": 28800, "name": "my-ike-policy", "negotiation_mode": "main", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ike_policy"}' + responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) + # Construct a dict representation of a IKEPolicyPatch model + ike_policy_patch_model = {} + ike_policy_patch_model['authentication_algorithm'] = 'md5' + ike_policy_patch_model['dh_group'] = 14 + ike_policy_patch_model['encryption_algorithm'] = 'aes128' + ike_policy_patch_model['ike_version'] = 1 + ike_policy_patch_model['key_lifetime'] = 28800 + ike_policy_patch_model['name'] = 'my-ike-policy' + # Set up parameter values id = 'testString' + ike_policy_patch = ike_policy_patch_model # Pass in all but one required param and check for a ValueError req_param_dict = { "id": id, + "ike_policy_patch": ike_policy_patch, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.get_security_group(**req_copy) + _service.update_ike_policy(**req_copy) - def test_get_security_group_value_error_with_retries(self): - # Enable retries and run test_get_security_group_value_error. + def test_update_ike_policy_value_error_with_retries(self): + # Enable retries and run test_update_ike_policy_value_error. _service.enable_retries() - self.test_get_security_group_value_error() + self.test_update_ike_policy_value_error() - # Disable retries and run test_get_security_group_value_error. + # Disable retries and run test_update_ike_policy_value_error. _service.disable_retries() - self.test_get_security_group_value_error() + self.test_update_ike_policy_value_error() -class TestUpdateSecurityGroup(): +class TestListIkePolicyConnections(): """ - Test Class for update_security_group + Test Class for list_ike_policy_connections """ @responses.activate - def test_update_security_group_all_params(self): + def test_list_ike_policy_connections_all_params(self): """ - update_security_group() + list_ike_policy_connections() """ # Set up mock - url = preprocess_url('/security_groups/testString') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' - responses.add(responses.PATCH, + url = preprocess_url('/ike_policies/testString/connections') + mock_response = '{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}' + responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) - # Construct a dict representation of a SecurityGroupPatch model - security_group_patch_model = {} - security_group_patch_model['name'] = 'my-security-group' - # Set up parameter values id = 'testString' - security_group_patch = security_group_patch_model # Invoke method - response = _service.update_security_group( + response = _service.list_ike_policy_connections( id, - security_group_patch, headers={} ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 - # Validate body params - req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == security_group_patch - def test_update_security_group_all_params_with_retries(self): - # Enable retries and run test_update_security_group_all_params. + def test_list_ike_policy_connections_all_params_with_retries(self): + # Enable retries and run test_list_ike_policy_connections_all_params. _service.enable_retries() - self.test_update_security_group_all_params() + self.test_list_ike_policy_connections_all_params() - # Disable retries and run test_update_security_group_all_params. + # Disable retries and run test_list_ike_policy_connections_all_params. _service.disable_retries() - self.test_update_security_group_all_params() + self.test_list_ike_policy_connections_all_params() @responses.activate - def test_update_security_group_value_error(self): + def test_list_ike_policy_connections_value_error(self): """ - test_update_security_group_value_error() + test_list_ike_policy_connections_value_error() """ # Set up mock - url = preprocess_url('/security_groups/testString') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}], "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' - responses.add(responses.PATCH, + url = preprocess_url('/ike_policies/testString/connections') + mock_response = '{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}' + responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) - # Construct a dict representation of a SecurityGroupPatch model - security_group_patch_model = {} - security_group_patch_model['name'] = 'my-security-group' - # Set up parameter values id = 'testString' - security_group_patch = security_group_patch_model # Pass in all but one required param and check for a ValueError req_param_dict = { "id": id, - "security_group_patch": security_group_patch, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.update_security_group(**req_copy) + _service.list_ike_policy_connections(**req_copy) - def test_update_security_group_value_error_with_retries(self): - # Enable retries and run test_update_security_group_value_error. + def test_list_ike_policy_connections_value_error_with_retries(self): + # Enable retries and run test_list_ike_policy_connections_value_error. _service.enable_retries() - self.test_update_security_group_value_error() + self.test_list_ike_policy_connections_value_error() - # Disable retries and run test_update_security_group_value_error. + # Disable retries and run test_list_ike_policy_connections_value_error. _service.disable_retries() - self.test_update_security_group_value_error() + self.test_list_ike_policy_connections_value_error() -class TestListSecurityGroupRules(): +class TestListIpsecPolicies(): """ - Test Class for list_security_group_rules + Test Class for list_ipsec_policies """ @responses.activate - def test_list_security_group_rules_all_params(self): + def test_list_ipsec_policies_all_params(self): """ - list_security_group_rules() + list_ipsec_policies() """ # Set up mock - url = preprocess_url('/security_groups/testString/rules') - mock_response = '{"rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}]}' + url = preprocess_url('/ipsec_policies') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies?limit=20"}, "ipsec_policies": [{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "key_lifetime": 3600, "name": "my-ipsec-policy", "pfs": "disabled", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ipsec_policy", "transform_protocol": "esp"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132}' responses.add(responses.GET, url, body=mock_response, @@ -20944,103 +23577,136 @@ def test_list_security_group_rules_all_params(self): status=200) # Set up parameter values - security_group_id = 'testString' + start = 'testString' + limit = 1 # Invoke method - response = _service.list_security_group_rules( - security_group_id, + response = _service.list_ipsec_policies( + start=start, + limit=limit, headers={} ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?',1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'start={}'.format(start) in query_string + assert 'limit={}'.format(limit) in query_string - def test_list_security_group_rules_all_params_with_retries(self): - # Enable retries and run test_list_security_group_rules_all_params. + def test_list_ipsec_policies_all_params_with_retries(self): + # Enable retries and run test_list_ipsec_policies_all_params. _service.enable_retries() - self.test_list_security_group_rules_all_params() + self.test_list_ipsec_policies_all_params() - # Disable retries and run test_list_security_group_rules_all_params. + # Disable retries and run test_list_ipsec_policies_all_params. _service.disable_retries() - self.test_list_security_group_rules_all_params() + self.test_list_ipsec_policies_all_params() @responses.activate - def test_list_security_group_rules_value_error(self): + def test_list_ipsec_policies_required_params(self): """ - test_list_security_group_rules_value_error() + test_list_ipsec_policies_required_params() """ # Set up mock - url = preprocess_url('/security_groups/testString/rules') - mock_response = '{"rules": [{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}]}' + url = preprocess_url('/ipsec_policies') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies?limit=20"}, "ipsec_policies": [{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "key_lifetime": 3600, "name": "my-ipsec-policy", "pfs": "disabled", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ipsec_policy", "transform_protocol": "esp"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132}' responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) - # Set up parameter values - security_group_id = 'testString' + # Invoke method + response = _service.list_ipsec_policies() + + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_ipsec_policies_required_params_with_retries(self): + # Enable retries and run test_list_ipsec_policies_required_params. + _service.enable_retries() + self.test_list_ipsec_policies_required_params() + + # Disable retries and run test_list_ipsec_policies_required_params. + _service.disable_retries() + self.test_list_ipsec_policies_required_params() + + @responses.activate + def test_list_ipsec_policies_value_error(self): + """ + test_list_ipsec_policies_value_error() + """ + # Set up mock + url = preprocess_url('/ipsec_policies') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies?limit=20"}, "ipsec_policies": [{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "key_lifetime": 3600, "name": "my-ipsec-policy", "pfs": "disabled", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ipsec_policy", "transform_protocol": "esp"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) # Pass in all but one required param and check for a ValueError req_param_dict = { - "security_group_id": security_group_id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_security_group_rules(**req_copy) + _service.list_ipsec_policies(**req_copy) - def test_list_security_group_rules_value_error_with_retries(self): - # Enable retries and run test_list_security_group_rules_value_error. + def test_list_ipsec_policies_value_error_with_retries(self): + # Enable retries and run test_list_ipsec_policies_value_error. _service.enable_retries() - self.test_list_security_group_rules_value_error() + self.test_list_ipsec_policies_value_error() - # Disable retries and run test_list_security_group_rules_value_error. + # Disable retries and run test_list_ipsec_policies_value_error. _service.disable_retries() - self.test_list_security_group_rules_value_error() + self.test_list_ipsec_policies_value_error() -class TestCreateSecurityGroupRule(): +class TestCreateIpsecPolicy(): """ - Test Class for create_security_group_rule + Test Class for create_ipsec_policy """ @responses.activate - def test_create_security_group_rule_all_params(self): + def test_create_ipsec_policy_all_params(self): """ - create_security_group_rule() + create_ipsec_policy() """ # Set up mock - url = preprocess_url('/security_groups/testString/rules') - mock_response = '{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}' + url = preprocess_url('/ipsec_policies') + mock_response = '{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "key_lifetime": 3600, "name": "my-ipsec-policy", "pfs": "disabled", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ipsec_policy", "transform_protocol": "esp"}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) - # Construct a dict representation of a SecurityGroupRuleRemotePrototypeIP model - security_group_rule_remote_prototype_model = {} - security_group_rule_remote_prototype_model['address'] = '192.168.3.4' - - # Construct a dict representation of a SecurityGroupRulePrototypeSecurityGroupRuleProtocolICMP model - security_group_rule_prototype_model = {} - security_group_rule_prototype_model['code'] = 0 - security_group_rule_prototype_model['direction'] = 'inbound' - security_group_rule_prototype_model['ip_version'] = 'ipv4' - security_group_rule_prototype_model['protocol'] = 'icmp' - security_group_rule_prototype_model['remote'] = security_group_rule_remote_prototype_model - security_group_rule_prototype_model['type'] = 8 + # Construct a dict representation of a ResourceGroupIdentityById model + resource_group_identity_model = {} + resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' # Set up parameter values - security_group_id = 'testString' - security_group_rule_prototype = security_group_rule_prototype_model + authentication_algorithm = 'md5' + encryption_algorithm = 'aes128' + pfs = 'disabled' + key_lifetime = 3600 + name = 'my-ipsec-policy' + resource_group = resource_group_identity_model # Invoke method - response = _service.create_security_group_rule( - security_group_id, - security_group_rule_prototype, + response = _service.create_ipsec_policy( + authentication_algorithm, + encryption_algorithm, + pfs, + key_lifetime=key_lifetime, + name=name, + resource_group=resource_group, headers={} ) @@ -21049,91 +23715,90 @@ def test_create_security_group_rule_all_params(self): assert response.status_code == 201 # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == security_group_rule_prototype + assert req_body['authentication_algorithm'] == 'md5' + assert req_body['encryption_algorithm'] == 'aes128' + assert req_body['pfs'] == 'disabled' + assert req_body['key_lifetime'] == 3600 + assert req_body['name'] == 'my-ipsec-policy' + assert req_body['resource_group'] == resource_group_identity_model - def test_create_security_group_rule_all_params_with_retries(self): - # Enable retries and run test_create_security_group_rule_all_params. + def test_create_ipsec_policy_all_params_with_retries(self): + # Enable retries and run test_create_ipsec_policy_all_params. _service.enable_retries() - self.test_create_security_group_rule_all_params() + self.test_create_ipsec_policy_all_params() - # Disable retries and run test_create_security_group_rule_all_params. + # Disable retries and run test_create_ipsec_policy_all_params. _service.disable_retries() - self.test_create_security_group_rule_all_params() + self.test_create_ipsec_policy_all_params() @responses.activate - def test_create_security_group_rule_value_error(self): + def test_create_ipsec_policy_value_error(self): """ - test_create_security_group_rule_value_error() + test_create_ipsec_policy_value_error() """ # Set up mock - url = preprocess_url('/security_groups/testString/rules') - mock_response = '{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}' + url = preprocess_url('/ipsec_policies') + mock_response = '{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "key_lifetime": 3600, "name": "my-ipsec-policy", "pfs": "disabled", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ipsec_policy", "transform_protocol": "esp"}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) - # Construct a dict representation of a SecurityGroupRuleRemotePrototypeIP model - security_group_rule_remote_prototype_model = {} - security_group_rule_remote_prototype_model['address'] = '192.168.3.4' - - # Construct a dict representation of a SecurityGroupRulePrototypeSecurityGroupRuleProtocolICMP model - security_group_rule_prototype_model = {} - security_group_rule_prototype_model['code'] = 0 - security_group_rule_prototype_model['direction'] = 'inbound' - security_group_rule_prototype_model['ip_version'] = 'ipv4' - security_group_rule_prototype_model['protocol'] = 'icmp' - security_group_rule_prototype_model['remote'] = security_group_rule_remote_prototype_model - security_group_rule_prototype_model['type'] = 8 + # Construct a dict representation of a ResourceGroupIdentityById model + resource_group_identity_model = {} + resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' # Set up parameter values - security_group_id = 'testString' - security_group_rule_prototype = security_group_rule_prototype_model + authentication_algorithm = 'md5' + encryption_algorithm = 'aes128' + pfs = 'disabled' + key_lifetime = 3600 + name = 'my-ipsec-policy' + resource_group = resource_group_identity_model # Pass in all but one required param and check for a ValueError req_param_dict = { - "security_group_id": security_group_id, - "security_group_rule_prototype": security_group_rule_prototype, + "authentication_algorithm": authentication_algorithm, + "encryption_algorithm": encryption_algorithm, + "pfs": pfs, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.create_security_group_rule(**req_copy) + _service.create_ipsec_policy(**req_copy) - def test_create_security_group_rule_value_error_with_retries(self): - # Enable retries and run test_create_security_group_rule_value_error. + def test_create_ipsec_policy_value_error_with_retries(self): + # Enable retries and run test_create_ipsec_policy_value_error. _service.enable_retries() - self.test_create_security_group_rule_value_error() + self.test_create_ipsec_policy_value_error() - # Disable retries and run test_create_security_group_rule_value_error. + # Disable retries and run test_create_ipsec_policy_value_error. _service.disable_retries() - self.test_create_security_group_rule_value_error() + self.test_create_ipsec_policy_value_error() -class TestDeleteSecurityGroupRule(): +class TestDeleteIpsecPolicy(): """ - Test Class for delete_security_group_rule + Test Class for delete_ipsec_policy """ @responses.activate - def test_delete_security_group_rule_all_params(self): + def test_delete_ipsec_policy_all_params(self): """ - delete_security_group_rule() + delete_ipsec_policy() """ # Set up mock - url = preprocess_url('/security_groups/testString/rules/testString') + url = preprocess_url('/ipsec_policies/testString') responses.add(responses.DELETE, url, status=204) # Set up parameter values - security_group_id = 'testString' id = 'testString' # Invoke method - response = _service.delete_security_group_rule( - security_group_id, + response = _service.delete_ipsec_policy( id, headers={} ) @@ -21142,63 +23807,61 @@ def test_delete_security_group_rule_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 204 - def test_delete_security_group_rule_all_params_with_retries(self): - # Enable retries and run test_delete_security_group_rule_all_params. + def test_delete_ipsec_policy_all_params_with_retries(self): + # Enable retries and run test_delete_ipsec_policy_all_params. _service.enable_retries() - self.test_delete_security_group_rule_all_params() + self.test_delete_ipsec_policy_all_params() - # Disable retries and run test_delete_security_group_rule_all_params. + # Disable retries and run test_delete_ipsec_policy_all_params. _service.disable_retries() - self.test_delete_security_group_rule_all_params() + self.test_delete_ipsec_policy_all_params() @responses.activate - def test_delete_security_group_rule_value_error(self): + def test_delete_ipsec_policy_value_error(self): """ - test_delete_security_group_rule_value_error() + test_delete_ipsec_policy_value_error() """ # Set up mock - url = preprocess_url('/security_groups/testString/rules/testString') + url = preprocess_url('/ipsec_policies/testString') responses.add(responses.DELETE, url, status=204) # Set up parameter values - security_group_id = 'testString' id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "security_group_id": security_group_id, "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.delete_security_group_rule(**req_copy) + _service.delete_ipsec_policy(**req_copy) - def test_delete_security_group_rule_value_error_with_retries(self): - # Enable retries and run test_delete_security_group_rule_value_error. + def test_delete_ipsec_policy_value_error_with_retries(self): + # Enable retries and run test_delete_ipsec_policy_value_error. _service.enable_retries() - self.test_delete_security_group_rule_value_error() + self.test_delete_ipsec_policy_value_error() - # Disable retries and run test_delete_security_group_rule_value_error. + # Disable retries and run test_delete_ipsec_policy_value_error. _service.disable_retries() - self.test_delete_security_group_rule_value_error() + self.test_delete_ipsec_policy_value_error() -class TestGetSecurityGroupRule(): +class TestGetIpsecPolicy(): """ - Test Class for get_security_group_rule + Test Class for get_ipsec_policy """ @responses.activate - def test_get_security_group_rule_all_params(self): + def test_get_ipsec_policy_all_params(self): """ - get_security_group_rule() + get_ipsec_policy() """ # Set up mock - url = preprocess_url('/security_groups/testString/rules/testString') - mock_response = '{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}' + url = preprocess_url('/ipsec_policies/testString') + mock_response = '{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "key_lifetime": 3600, "name": "my-ipsec-policy", "pfs": "disabled", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ipsec_policy", "transform_protocol": "esp"}' responses.add(responses.GET, url, body=mock_response, @@ -21206,12 +23869,10 @@ def test_get_security_group_rule_all_params(self): status=200) # Set up parameter values - security_group_id = 'testString' id = 'testString' # Invoke method - response = _service.get_security_group_rule( - security_group_id, + response = _service.get_ipsec_policy( id, headers={} ) @@ -21220,182 +23881,241 @@ def test_get_security_group_rule_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 200 - def test_get_security_group_rule_all_params_with_retries(self): - # Enable retries and run test_get_security_group_rule_all_params. + def test_get_ipsec_policy_all_params_with_retries(self): + # Enable retries and run test_get_ipsec_policy_all_params. _service.enable_retries() - self.test_get_security_group_rule_all_params() + self.test_get_ipsec_policy_all_params() - # Disable retries and run test_get_security_group_rule_all_params. + # Disable retries and run test_get_ipsec_policy_all_params. + _service.disable_retries() + self.test_get_ipsec_policy_all_params() + + @responses.activate + def test_get_ipsec_policy_value_error(self): + """ + test_get_ipsec_policy_value_error() + """ + # Set up mock + url = preprocess_url('/ipsec_policies/testString') + mock_response = '{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "key_lifetime": 3600, "name": "my-ipsec-policy", "pfs": "disabled", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ipsec_policy", "transform_protocol": "esp"}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "id": id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_ipsec_policy(**req_copy) + + + def test_get_ipsec_policy_value_error_with_retries(self): + # Enable retries and run test_get_ipsec_policy_value_error. + _service.enable_retries() + self.test_get_ipsec_policy_value_error() + + # Disable retries and run test_get_ipsec_policy_value_error. + _service.disable_retries() + self.test_get_ipsec_policy_value_error() + +class TestUpdateIpsecPolicy(): + """ + Test Class for update_ipsec_policy + """ + + @responses.activate + def test_update_ipsec_policy_all_params(self): + """ + update_ipsec_policy() + """ + # Set up mock + url = preprocess_url('/ipsec_policies/testString') + mock_response = '{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "key_lifetime": 3600, "name": "my-ipsec-policy", "pfs": "disabled", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ipsec_policy", "transform_protocol": "esp"}' + responses.add(responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Construct a dict representation of a IPsecPolicyPatch model + i_psec_policy_patch_model = {} + i_psec_policy_patch_model['authentication_algorithm'] = 'md5' + i_psec_policy_patch_model['encryption_algorithm'] = 'aes128' + i_psec_policy_patch_model['key_lifetime'] = 3600 + i_psec_policy_patch_model['name'] = 'my-ipsec-policy' + i_psec_policy_patch_model['pfs'] = 'disabled' + + # Set up parameter values + id = 'testString' + i_psec_policy_patch = i_psec_policy_patch_model + + # Invoke method + response = _service.update_ipsec_policy( + id, + i_psec_policy_patch, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body == i_psec_policy_patch + + def test_update_ipsec_policy_all_params_with_retries(self): + # Enable retries and run test_update_ipsec_policy_all_params. + _service.enable_retries() + self.test_update_ipsec_policy_all_params() + + # Disable retries and run test_update_ipsec_policy_all_params. _service.disable_retries() - self.test_get_security_group_rule_all_params() + self.test_update_ipsec_policy_all_params() @responses.activate - def test_get_security_group_rule_value_error(self): + def test_update_ipsec_policy_value_error(self): """ - test_get_security_group_rule_value_error() + test_update_ipsec_policy_value_error() """ # Set up mock - url = preprocess_url('/security_groups/testString/rules/testString') - mock_response = '{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}' - responses.add(responses.GET, + url = preprocess_url('/ipsec_policies/testString') + mock_response = '{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "key_lifetime": 3600, "name": "my-ipsec-policy", "pfs": "disabled", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ipsec_policy", "transform_protocol": "esp"}' + responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) + # Construct a dict representation of a IPsecPolicyPatch model + i_psec_policy_patch_model = {} + i_psec_policy_patch_model['authentication_algorithm'] = 'md5' + i_psec_policy_patch_model['encryption_algorithm'] = 'aes128' + i_psec_policy_patch_model['key_lifetime'] = 3600 + i_psec_policy_patch_model['name'] = 'my-ipsec-policy' + i_psec_policy_patch_model['pfs'] = 'disabled' + # Set up parameter values - security_group_id = 'testString' id = 'testString' + i_psec_policy_patch = i_psec_policy_patch_model # Pass in all but one required param and check for a ValueError req_param_dict = { - "security_group_id": security_group_id, "id": id, + "i_psec_policy_patch": i_psec_policy_patch, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.get_security_group_rule(**req_copy) + _service.update_ipsec_policy(**req_copy) - def test_get_security_group_rule_value_error_with_retries(self): - # Enable retries and run test_get_security_group_rule_value_error. + def test_update_ipsec_policy_value_error_with_retries(self): + # Enable retries and run test_update_ipsec_policy_value_error. _service.enable_retries() - self.test_get_security_group_rule_value_error() + self.test_update_ipsec_policy_value_error() - # Disable retries and run test_get_security_group_rule_value_error. + # Disable retries and run test_update_ipsec_policy_value_error. _service.disable_retries() - self.test_get_security_group_rule_value_error() + self.test_update_ipsec_policy_value_error() -class TestUpdateSecurityGroupRule(): +class TestListIpsecPolicyConnections(): """ - Test Class for update_security_group_rule + Test Class for list_ipsec_policy_connections """ @responses.activate - def test_update_security_group_rule_all_params(self): + def test_list_ipsec_policy_connections_all_params(self): """ - update_security_group_rule() + list_ipsec_policy_connections() """ # Set up mock - url = preprocess_url('/security_groups/testString/rules/testString') - mock_response = '{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}' - responses.add(responses.PATCH, + url = preprocess_url('/ipsec_policies/testString/connections') + mock_response = '{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}' + responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) - # Construct a dict representation of a SecurityGroupRuleRemotePatchIP model - security_group_rule_remote_patch_model = {} - security_group_rule_remote_patch_model['address'] = '192.168.3.4' - - # Construct a dict representation of a SecurityGroupRulePatch model - security_group_rule_patch_model = {} - security_group_rule_patch_model['code'] = 0 - security_group_rule_patch_model['direction'] = 'inbound' - security_group_rule_patch_model['ip_version'] = 'ipv4' - security_group_rule_patch_model['port_max'] = 22 - security_group_rule_patch_model['port_min'] = 22 - security_group_rule_patch_model['remote'] = security_group_rule_remote_patch_model - security_group_rule_patch_model['type'] = 8 - # Set up parameter values - security_group_id = 'testString' id = 'testString' - security_group_rule_patch = security_group_rule_patch_model # Invoke method - response = _service.update_security_group_rule( - security_group_id, + response = _service.list_ipsec_policy_connections( id, - security_group_rule_patch, headers={} ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 - # Validate body params - req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == security_group_rule_patch - def test_update_security_group_rule_all_params_with_retries(self): - # Enable retries and run test_update_security_group_rule_all_params. + def test_list_ipsec_policy_connections_all_params_with_retries(self): + # Enable retries and run test_list_ipsec_policy_connections_all_params. _service.enable_retries() - self.test_update_security_group_rule_all_params() + self.test_list_ipsec_policy_connections_all_params() - # Disable retries and run test_update_security_group_rule_all_params. + # Disable retries and run test_list_ipsec_policy_connections_all_params. _service.disable_retries() - self.test_update_security_group_rule_all_params() + self.test_list_ipsec_policy_connections_all_params() @responses.activate - def test_update_security_group_rule_value_error(self): + def test_list_ipsec_policy_connections_value_error(self): """ - test_update_security_group_rule_value_error() + test_list_ipsec_policy_connections_value_error() """ # Set up mock - url = preprocess_url('/security_groups/testString/rules/testString') - mock_response = '{"direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/rules/6f2a6efe-21e2-401c-b237-620aa26ba16a", "id": "6f2a6efe-21e2-401c-b237-620aa26ba16a", "ip_version": "ipv4", "remote": {"address": "192.168.3.4"}, "protocol": "all"}' - responses.add(responses.PATCH, + url = preprocess_url('/ipsec_policies/testString/connections') + mock_response = '{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}' + responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) - # Construct a dict representation of a SecurityGroupRuleRemotePatchIP model - security_group_rule_remote_patch_model = {} - security_group_rule_remote_patch_model['address'] = '192.168.3.4' - - # Construct a dict representation of a SecurityGroupRulePatch model - security_group_rule_patch_model = {} - security_group_rule_patch_model['code'] = 0 - security_group_rule_patch_model['direction'] = 'inbound' - security_group_rule_patch_model['ip_version'] = 'ipv4' - security_group_rule_patch_model['port_max'] = 22 - security_group_rule_patch_model['port_min'] = 22 - security_group_rule_patch_model['remote'] = security_group_rule_remote_patch_model - security_group_rule_patch_model['type'] = 8 - # Set up parameter values - security_group_id = 'testString' id = 'testString' - security_group_rule_patch = security_group_rule_patch_model # Pass in all but one required param and check for a ValueError req_param_dict = { - "security_group_id": security_group_id, "id": id, - "security_group_rule_patch": security_group_rule_patch, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.update_security_group_rule(**req_copy) + _service.list_ipsec_policy_connections(**req_copy) - def test_update_security_group_rule_value_error_with_retries(self): - # Enable retries and run test_update_security_group_rule_value_error. + def test_list_ipsec_policy_connections_value_error_with_retries(self): + # Enable retries and run test_list_ipsec_policy_connections_value_error. _service.enable_retries() - self.test_update_security_group_rule_value_error() + self.test_list_ipsec_policy_connections_value_error() - # Disable retries and run test_update_security_group_rule_value_error. + # Disable retries and run test_list_ipsec_policy_connections_value_error. _service.disable_retries() - self.test_update_security_group_rule_value_error() + self.test_list_ipsec_policy_connections_value_error() -class TestListSecurityGroupTargets(): +class TestListVpnGateways(): """ - Test Class for list_security_group_targets + Test Class for list_vpn_gateways """ @responses.activate - def test_list_security_group_targets_all_params(self): + def test_list_vpn_gateways_all_params(self): """ - list_security_group_targets() + list_vpn_gateways() """ # Set up mock - url = preprocess_url('/security_groups/testString/targets') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/targets?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/targets?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "total_count": 132}' + url = preprocess_url('/vpn_gateways') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132, "vpn_gateways": [{"connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "name": "my-vpn-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_gateway", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}]}' responses.add(responses.GET, url, body=mock_response, @@ -21403,15 +24123,17 @@ def test_list_security_group_targets_all_params(self): status=200) # Set up parameter values - security_group_id = 'testString' start = 'testString' limit = 1 + resource_group_id = 'testString' + mode = 'route' # Invoke method - response = _service.list_security_group_targets( - security_group_id, + response = _service.list_vpn_gateways( start=start, limit=limit, + resource_group_id=resource_group_id, + mode=mode, headers={} ) @@ -21423,270 +24145,286 @@ def test_list_security_group_targets_all_params(self): query_string = urllib.parse.unquote_plus(query_string) assert 'start={}'.format(start) in query_string assert 'limit={}'.format(limit) in query_string + assert 'resource_group.id={}'.format(resource_group_id) in query_string + assert 'mode={}'.format(mode) in query_string - def test_list_security_group_targets_all_params_with_retries(self): - # Enable retries and run test_list_security_group_targets_all_params. + def test_list_vpn_gateways_all_params_with_retries(self): + # Enable retries and run test_list_vpn_gateways_all_params. _service.enable_retries() - self.test_list_security_group_targets_all_params() + self.test_list_vpn_gateways_all_params() - # Disable retries and run test_list_security_group_targets_all_params. + # Disable retries and run test_list_vpn_gateways_all_params. _service.disable_retries() - self.test_list_security_group_targets_all_params() + self.test_list_vpn_gateways_all_params() @responses.activate - def test_list_security_group_targets_required_params(self): + def test_list_vpn_gateways_required_params(self): """ - test_list_security_group_targets_required_params() + test_list_vpn_gateways_required_params() """ # Set up mock - url = preprocess_url('/security_groups/testString/targets') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/targets?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/targets?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "total_count": 132}' + url = preprocess_url('/vpn_gateways') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132, "vpn_gateways": [{"connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "name": "my-vpn-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_gateway", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}]}' responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) - # Set up parameter values - security_group_id = 'testString' - # Invoke method - response = _service.list_security_group_targets( - security_group_id, - headers={} - ) + response = _service.list_vpn_gateways() + # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 - def test_list_security_group_targets_required_params_with_retries(self): - # Enable retries and run test_list_security_group_targets_required_params. + def test_list_vpn_gateways_required_params_with_retries(self): + # Enable retries and run test_list_vpn_gateways_required_params. _service.enable_retries() - self.test_list_security_group_targets_required_params() + self.test_list_vpn_gateways_required_params() - # Disable retries and run test_list_security_group_targets_required_params. + # Disable retries and run test_list_vpn_gateways_required_params. _service.disable_retries() - self.test_list_security_group_targets_required_params() + self.test_list_vpn_gateways_required_params() @responses.activate - def test_list_security_group_targets_value_error(self): + def test_list_vpn_gateways_value_error(self): """ - test_list_security_group_targets_value_error() + test_list_vpn_gateways_value_error() """ # Set up mock - url = preprocess_url('/security_groups/testString/targets') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/targets?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271/targets?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "total_count": 132}' + url = preprocess_url('/vpn_gateways') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132, "vpn_gateways": [{"connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "name": "my-vpn-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_gateway", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}]}' responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) - # Set up parameter values - security_group_id = 'testString' - # Pass in all but one required param and check for a ValueError req_param_dict = { - "security_group_id": security_group_id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_security_group_targets(**req_copy) + _service.list_vpn_gateways(**req_copy) - def test_list_security_group_targets_value_error_with_retries(self): - # Enable retries and run test_list_security_group_targets_value_error. + def test_list_vpn_gateways_value_error_with_retries(self): + # Enable retries and run test_list_vpn_gateways_value_error. _service.enable_retries() - self.test_list_security_group_targets_value_error() + self.test_list_vpn_gateways_value_error() - # Disable retries and run test_list_security_group_targets_value_error. + # Disable retries and run test_list_vpn_gateways_value_error. _service.disable_retries() - self.test_list_security_group_targets_value_error() + self.test_list_vpn_gateways_value_error() -class TestDeleteSecurityGroupTargetBinding(): +class TestCreateVpnGateway(): """ - Test Class for delete_security_group_target_binding + Test Class for create_vpn_gateway """ @responses.activate - def test_delete_security_group_target_binding_all_params(self): + def test_create_vpn_gateway_all_params(self): """ - delete_security_group_target_binding() + create_vpn_gateway() """ # Set up mock - url = preprocess_url('/security_groups/testString/targets/testString') - responses.add(responses.DELETE, + url = preprocess_url('/vpn_gateways') + mock_response = '{"connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "name": "my-vpn-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_gateway", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}' + responses.add(responses.POST, url, - status=204) + body=mock_response, + content_type='application/json', + status=201) + + # Construct a dict representation of a ResourceGroupIdentityById model + resource_group_identity_model = {} + resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + + # Construct a dict representation of a SubnetIdentityById model + subnet_identity_model = {} + subnet_identity_model['id'] = '7ec86020-1c6e-4889-b3f0-a15f2e50f87e' + + # Construct a dict representation of a VPNGatewayPrototypeVPNGatewayRouteModePrototype model + vpn_gateway_prototype_model = {} + vpn_gateway_prototype_model['name'] = 'my-vpn-gateway' + vpn_gateway_prototype_model['resource_group'] = resource_group_identity_model + vpn_gateway_prototype_model['subnet'] = subnet_identity_model + vpn_gateway_prototype_model['mode'] = 'route' # Set up parameter values - security_group_id = 'testString' - id = 'testString' + vpn_gateway_prototype = vpn_gateway_prototype_model # Invoke method - response = _service.delete_security_group_target_binding( - security_group_id, - id, + response = _service.create_vpn_gateway( + vpn_gateway_prototype, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 204 + assert response.status_code == 201 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body == vpn_gateway_prototype - def test_delete_security_group_target_binding_all_params_with_retries(self): - # Enable retries and run test_delete_security_group_target_binding_all_params. + def test_create_vpn_gateway_all_params_with_retries(self): + # Enable retries and run test_create_vpn_gateway_all_params. _service.enable_retries() - self.test_delete_security_group_target_binding_all_params() + self.test_create_vpn_gateway_all_params() - # Disable retries and run test_delete_security_group_target_binding_all_params. + # Disable retries and run test_create_vpn_gateway_all_params. _service.disable_retries() - self.test_delete_security_group_target_binding_all_params() + self.test_create_vpn_gateway_all_params() @responses.activate - def test_delete_security_group_target_binding_value_error(self): + def test_create_vpn_gateway_value_error(self): """ - test_delete_security_group_target_binding_value_error() + test_create_vpn_gateway_value_error() """ # Set up mock - url = preprocess_url('/security_groups/testString/targets/testString') - responses.add(responses.DELETE, + url = preprocess_url('/vpn_gateways') + mock_response = '{"connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "name": "my-vpn-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_gateway", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}' + responses.add(responses.POST, url, - status=204) + body=mock_response, + content_type='application/json', + status=201) + + # Construct a dict representation of a ResourceGroupIdentityById model + resource_group_identity_model = {} + resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + + # Construct a dict representation of a SubnetIdentityById model + subnet_identity_model = {} + subnet_identity_model['id'] = '7ec86020-1c6e-4889-b3f0-a15f2e50f87e' + + # Construct a dict representation of a VPNGatewayPrototypeVPNGatewayRouteModePrototype model + vpn_gateway_prototype_model = {} + vpn_gateway_prototype_model['name'] = 'my-vpn-gateway' + vpn_gateway_prototype_model['resource_group'] = resource_group_identity_model + vpn_gateway_prototype_model['subnet'] = subnet_identity_model + vpn_gateway_prototype_model['mode'] = 'route' # Set up parameter values - security_group_id = 'testString' - id = 'testString' + vpn_gateway_prototype = vpn_gateway_prototype_model # Pass in all but one required param and check for a ValueError req_param_dict = { - "security_group_id": security_group_id, - "id": id, + "vpn_gateway_prototype": vpn_gateway_prototype, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.delete_security_group_target_binding(**req_copy) + _service.create_vpn_gateway(**req_copy) - def test_delete_security_group_target_binding_value_error_with_retries(self): - # Enable retries and run test_delete_security_group_target_binding_value_error. + def test_create_vpn_gateway_value_error_with_retries(self): + # Enable retries and run test_create_vpn_gateway_value_error. _service.enable_retries() - self.test_delete_security_group_target_binding_value_error() + self.test_create_vpn_gateway_value_error() - # Disable retries and run test_delete_security_group_target_binding_value_error. + # Disable retries and run test_create_vpn_gateway_value_error. _service.disable_retries() - self.test_delete_security_group_target_binding_value_error() + self.test_create_vpn_gateway_value_error() -class TestGetSecurityGroupTarget(): +class TestDeleteVpnGateway(): """ - Test Class for get_security_group_target + Test Class for delete_vpn_gateway """ @responses.activate - def test_get_security_group_target_all_params(self): + def test_delete_vpn_gateway_all_params(self): """ - get_security_group_target() + delete_vpn_gateway() """ # Set up mock - url = preprocess_url('/security_groups/testString/targets/testString') - mock_response = '{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}' - responses.add(responses.GET, + url = preprocess_url('/vpn_gateways/testString') + responses.add(responses.DELETE, url, - body=mock_response, - content_type='application/json', - status=200) + status=202) # Set up parameter values - security_group_id = 'testString' id = 'testString' # Invoke method - response = _service.get_security_group_target( - security_group_id, + response = _service.delete_vpn_gateway( id, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 200 + assert response.status_code == 202 - def test_get_security_group_target_all_params_with_retries(self): - # Enable retries and run test_get_security_group_target_all_params. + def test_delete_vpn_gateway_all_params_with_retries(self): + # Enable retries and run test_delete_vpn_gateway_all_params. _service.enable_retries() - self.test_get_security_group_target_all_params() + self.test_delete_vpn_gateway_all_params() - # Disable retries and run test_get_security_group_target_all_params. + # Disable retries and run test_delete_vpn_gateway_all_params. _service.disable_retries() - self.test_get_security_group_target_all_params() + self.test_delete_vpn_gateway_all_params() @responses.activate - def test_get_security_group_target_value_error(self): + def test_delete_vpn_gateway_value_error(self): """ - test_get_security_group_target_value_error() + test_delete_vpn_gateway_value_error() """ # Set up mock - url = preprocess_url('/security_groups/testString/targets/testString') - mock_response = '{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}' - responses.add(responses.GET, + url = preprocess_url('/vpn_gateways/testString') + responses.add(responses.DELETE, url, - body=mock_response, - content_type='application/json', - status=200) + status=202) # Set up parameter values - security_group_id = 'testString' id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "security_group_id": security_group_id, "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.get_security_group_target(**req_copy) + _service.delete_vpn_gateway(**req_copy) - def test_get_security_group_target_value_error_with_retries(self): - # Enable retries and run test_get_security_group_target_value_error. + def test_delete_vpn_gateway_value_error_with_retries(self): + # Enable retries and run test_delete_vpn_gateway_value_error. _service.enable_retries() - self.test_get_security_group_target_value_error() + self.test_delete_vpn_gateway_value_error() - # Disable retries and run test_get_security_group_target_value_error. + # Disable retries and run test_delete_vpn_gateway_value_error. _service.disable_retries() - self.test_get_security_group_target_value_error() + self.test_delete_vpn_gateway_value_error() -class TestCreateSecurityGroupTargetBinding(): +class TestGetVpnGateway(): """ - Test Class for create_security_group_target_binding + Test Class for get_vpn_gateway """ @responses.activate - def test_create_security_group_target_binding_all_params(self): + def test_get_vpn_gateway_all_params(self): """ - create_security_group_target_binding() + get_vpn_gateway() """ # Set up mock - url = preprocess_url('/security_groups/testString/targets/testString') - mock_response = '{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}' - responses.add(responses.PUT, + url = preprocess_url('/vpn_gateways/testString') + mock_response = '{"connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "name": "my-vpn-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_gateway", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}' + responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) # Set up parameter values - security_group_id = 'testString' id = 'testString' # Invoke method - response = _service.create_security_group_target_binding( - security_group_id, + response = _service.get_vpn_gateway( id, headers={} ) @@ -21695,120 +24433,156 @@ def test_create_security_group_target_binding_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 200 - def test_create_security_group_target_binding_all_params_with_retries(self): - # Enable retries and run test_create_security_group_target_binding_all_params. + def test_get_vpn_gateway_all_params_with_retries(self): + # Enable retries and run test_get_vpn_gateway_all_params. _service.enable_retries() - self.test_create_security_group_target_binding_all_params() + self.test_get_vpn_gateway_all_params() - # Disable retries and run test_create_security_group_target_binding_all_params. + # Disable retries and run test_get_vpn_gateway_all_params. _service.disable_retries() - self.test_create_security_group_target_binding_all_params() + self.test_get_vpn_gateway_all_params() @responses.activate - def test_create_security_group_target_binding_value_error(self): + def test_get_vpn_gateway_value_error(self): """ - test_create_security_group_target_binding_value_error() + test_get_vpn_gateway_value_error() """ # Set up mock - url = preprocess_url('/security_groups/testString/targets/testString') - mock_response = '{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}' - responses.add(responses.PUT, + url = preprocess_url('/vpn_gateways/testString') + mock_response = '{"connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "name": "my-vpn-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_gateway", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}' + responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) # Set up parameter values - security_group_id = 'testString' id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "security_group_id": security_group_id, "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.create_security_group_target_binding(**req_copy) + _service.get_vpn_gateway(**req_copy) - def test_create_security_group_target_binding_value_error_with_retries(self): - # Enable retries and run test_create_security_group_target_binding_value_error. + def test_get_vpn_gateway_value_error_with_retries(self): + # Enable retries and run test_get_vpn_gateway_value_error. _service.enable_retries() - self.test_create_security_group_target_binding_value_error() + self.test_get_vpn_gateway_value_error() - # Disable retries and run test_create_security_group_target_binding_value_error. + # Disable retries and run test_get_vpn_gateway_value_error. _service.disable_retries() - self.test_create_security_group_target_binding_value_error() - -# endregion -############################################################################## -# End of Service: SecurityGroups -############################################################################## - -############################################################################## -# Start of Service: VPNGateways -############################################################################## -# region + self.test_get_vpn_gateway_value_error() -class TestNewInstance(): +class TestUpdateVpnGateway(): """ - Test Class for new_instance + Test Class for update_vpn_gateway """ - def test_new_instance(self): + @responses.activate + def test_update_vpn_gateway_all_params(self): """ - new_instance() + update_vpn_gateway() """ - os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' + # Set up mock + url = preprocess_url('/vpn_gateways/testString') + mock_response = '{"connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "name": "my-vpn-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_gateway", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}' + responses.add(responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200) - service = VpcV1.new_instance( - version=version, - service_name='TEST_SERVICE', + # Construct a dict representation of a VPNGatewayPatch model + vpn_gateway_patch_model = {} + vpn_gateway_patch_model['name'] = 'my-vpn-gateway' + + # Set up parameter values + id = 'testString' + vpn_gateway_patch = vpn_gateway_patch_model + + # Invoke method + response = _service.update_vpn_gateway( + id, + vpn_gateway_patch, + headers={} ) - assert service is not None - assert isinstance(service, VpcV1) + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body == vpn_gateway_patch - def test_new_instance_without_authenticator(self): + def test_update_vpn_gateway_all_params_with_retries(self): + # Enable retries and run test_update_vpn_gateway_all_params. + _service.enable_retries() + self.test_update_vpn_gateway_all_params() + + # Disable retries and run test_update_vpn_gateway_all_params. + _service.disable_retries() + self.test_update_vpn_gateway_all_params() + + @responses.activate + def test_update_vpn_gateway_value_error(self): """ - new_instance_without_authenticator() + test_update_vpn_gateway_value_error() """ - with pytest.raises(ValueError, match='authenticator must be provided'): - service = VpcV1.new_instance( - version=version, - service_name='TEST_SERVICE_NOT_FOUND', - ) + # Set up mock + url = preprocess_url('/vpn_gateways/testString') + mock_response = '{"connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "name": "my-vpn-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_gateway", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}' + responses.add(responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Construct a dict representation of a VPNGatewayPatch model + vpn_gateway_patch_model = {} + vpn_gateway_patch_model['name'] = 'my-vpn-gateway' + + # Set up parameter values + id = 'testString' + vpn_gateway_patch = vpn_gateway_patch_model + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "id": id, + "vpn_gateway_patch": vpn_gateway_patch, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.update_vpn_gateway(**req_copy) - def test_new_instance_without_required_params(self): - """ - new_instance_without_required_params() - """ - with pytest.raises(TypeError, match='new_instance\\(\\) missing \\d required positional arguments?: \'.*\''): - service = VpcV1.new_instance() - def test_new_instance_required_param_none(self): - """ - new_instance_required_param_none() - """ - with pytest.raises(ValueError, match='version must be provided'): - service = VpcV1.new_instance( - version=None, - ) -class TestListIkePolicies(): + def test_update_vpn_gateway_value_error_with_retries(self): + # Enable retries and run test_update_vpn_gateway_value_error. + _service.enable_retries() + self.test_update_vpn_gateway_value_error() + + # Disable retries and run test_update_vpn_gateway_value_error. + _service.disable_retries() + self.test_update_vpn_gateway_value_error() + +class TestListVpnGatewayConnections(): """ - Test Class for list_ike_policies + Test Class for list_vpn_gateway_connections """ @responses.activate - def test_list_ike_policies_all_params(self): + def test_list_vpn_gateway_connections_all_params(self): """ - list_ike_policies() + list_vpn_gateway_connections() """ # Set up mock - url = preprocess_url('/ike_policies') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies?limit=20"}, "ike_policies": [{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "dh_group": 14, "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "ike_version": 1, "key_lifetime": 28800, "name": "my-ike-policy", "negotiation_mode": "main", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ike_policy"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132}' + url = preprocess_url('/vpn_gateways/testString/connections') + mock_response = '{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}' responses.add(responses.GET, url, body=mock_response, @@ -21816,13 +24590,13 @@ def test_list_ike_policies_all_params(self): status=200) # Set up parameter values - start = 'testString' - limit = 1 + vpn_gateway_id = 'testString' + status = 'testString' # Invoke method - response = _service.list_ike_policies( - start=start, - limit=limit, + response = _service.list_vpn_gateway_connections( + vpn_gateway_id, + status=status, headers={} ) @@ -21832,122 +24606,141 @@ def test_list_ike_policies_all_params(self): # Validate query params query_string = responses.calls[0].request.url.split('?',1)[1] query_string = urllib.parse.unquote_plus(query_string) - assert 'start={}'.format(start) in query_string - assert 'limit={}'.format(limit) in query_string + assert 'status={}'.format(status) in query_string - def test_list_ike_policies_all_params_with_retries(self): - # Enable retries and run test_list_ike_policies_all_params. + def test_list_vpn_gateway_connections_all_params_with_retries(self): + # Enable retries and run test_list_vpn_gateway_connections_all_params. _service.enable_retries() - self.test_list_ike_policies_all_params() + self.test_list_vpn_gateway_connections_all_params() - # Disable retries and run test_list_ike_policies_all_params. + # Disable retries and run test_list_vpn_gateway_connections_all_params. _service.disable_retries() - self.test_list_ike_policies_all_params() + self.test_list_vpn_gateway_connections_all_params() @responses.activate - def test_list_ike_policies_required_params(self): + def test_list_vpn_gateway_connections_required_params(self): """ - test_list_ike_policies_required_params() + test_list_vpn_gateway_connections_required_params() """ # Set up mock - url = preprocess_url('/ike_policies') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies?limit=20"}, "ike_policies": [{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "dh_group": 14, "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "ike_version": 1, "key_lifetime": 28800, "name": "my-ike-policy", "negotiation_mode": "main", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ike_policy"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132}' + url = preprocess_url('/vpn_gateways/testString/connections') + mock_response = '{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}' responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) - # Invoke method - response = _service.list_ike_policies() + # Set up parameter values + vpn_gateway_id = 'testString' + # Invoke method + response = _service.list_vpn_gateway_connections( + vpn_gateway_id, + headers={} + ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 - def test_list_ike_policies_required_params_with_retries(self): - # Enable retries and run test_list_ike_policies_required_params. + def test_list_vpn_gateway_connections_required_params_with_retries(self): + # Enable retries and run test_list_vpn_gateway_connections_required_params. _service.enable_retries() - self.test_list_ike_policies_required_params() + self.test_list_vpn_gateway_connections_required_params() - # Disable retries and run test_list_ike_policies_required_params. + # Disable retries and run test_list_vpn_gateway_connections_required_params. _service.disable_retries() - self.test_list_ike_policies_required_params() + self.test_list_vpn_gateway_connections_required_params() @responses.activate - def test_list_ike_policies_value_error(self): + def test_list_vpn_gateway_connections_value_error(self): """ - test_list_ike_policies_value_error() + test_list_vpn_gateway_connections_value_error() """ # Set up mock - url = preprocess_url('/ike_policies') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies?limit=20"}, "ike_policies": [{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "dh_group": 14, "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "ike_version": 1, "key_lifetime": 28800, "name": "my-ike-policy", "negotiation_mode": "main", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ike_policy"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132}' + url = preprocess_url('/vpn_gateways/testString/connections') + mock_response = '{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}' responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) + # Set up parameter values + vpn_gateway_id = 'testString' + # Pass in all but one required param and check for a ValueError req_param_dict = { + "vpn_gateway_id": vpn_gateway_id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_ike_policies(**req_copy) + _service.list_vpn_gateway_connections(**req_copy) - def test_list_ike_policies_value_error_with_retries(self): - # Enable retries and run test_list_ike_policies_value_error. + def test_list_vpn_gateway_connections_value_error_with_retries(self): + # Enable retries and run test_list_vpn_gateway_connections_value_error. _service.enable_retries() - self.test_list_ike_policies_value_error() + self.test_list_vpn_gateway_connections_value_error() - # Disable retries and run test_list_ike_policies_value_error. + # Disable retries and run test_list_vpn_gateway_connections_value_error. _service.disable_retries() - self.test_list_ike_policies_value_error() + self.test_list_vpn_gateway_connections_value_error() -class TestCreateIkePolicy(): +class TestCreateVpnGatewayConnection(): """ - Test Class for create_ike_policy + Test Class for create_vpn_gateway_connection """ @responses.activate - def test_create_ike_policy_all_params(self): + def test_create_vpn_gateway_connection_all_params(self): """ - create_ike_policy() + create_vpn_gateway_connection() """ # Set up mock - url = preprocess_url('/ike_policies') - mock_response = '{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "dh_group": 14, "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "ike_version": 1, "key_lifetime": 28800, "name": "my-ike-policy", "negotiation_mode": "main", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ike_policy"}' + url = preprocess_url('/vpn_gateways/testString/connections') + mock_response = '{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) - # Construct a dict representation of a ResourceGroupIdentityById model - resource_group_identity_model = {} - resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + # Construct a dict representation of a VPNGatewayConnectionDPDPrototype model + vpn_gateway_connection_dpd_prototype_model = {} + vpn_gateway_connection_dpd_prototype_model['action'] = 'restart' + vpn_gateway_connection_dpd_prototype_model['interval'] = 30 + vpn_gateway_connection_dpd_prototype_model['timeout'] = 120 + + # Construct a dict representation of a VPNGatewayConnectionIKEPolicyPrototypeIKEPolicyIdentityById model + vpn_gateway_connection_ike_policy_prototype_model = {} + vpn_gateway_connection_ike_policy_prototype_model['id'] = 'ddf51bec-3424-11e8-b467-0ed5f89f718b' + + # Construct a dict representation of a VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityById model + vpn_gateway_connection_i_psec_policy_prototype_model = {} + vpn_gateway_connection_i_psec_policy_prototype_model['id'] = 'ddf51bec-3424-11e8-b467-0ed5f89f718b' + + # Construct a dict representation of a VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype model + vpn_gateway_connection_prototype_model = {} + vpn_gateway_connection_prototype_model['admin_state_up'] = True + vpn_gateway_connection_prototype_model['dead_peer_detection'] = vpn_gateway_connection_dpd_prototype_model + vpn_gateway_connection_prototype_model['ike_policy'] = vpn_gateway_connection_ike_policy_prototype_model + vpn_gateway_connection_prototype_model['ipsec_policy'] = vpn_gateway_connection_i_psec_policy_prototype_model + vpn_gateway_connection_prototype_model['name'] = 'my-vpn-connection' + vpn_gateway_connection_prototype_model['peer_address'] = '169.21.50.5' + vpn_gateway_connection_prototype_model['psk'] = 'lkj14b1oi0alcniejkso' + vpn_gateway_connection_prototype_model['routing_protocol'] = 'none' # Set up parameter values - authentication_algorithm = 'md5' - dh_group = 14 - encryption_algorithm = 'aes128' - ike_version = 1 - key_lifetime = 28800 - name = 'my-ike-policy' - resource_group = resource_group_identity_model + vpn_gateway_id = 'testString' + vpn_gateway_connection_prototype = vpn_gateway_connection_prototype_model # Invoke method - response = _service.create_ike_policy( - authentication_algorithm, - dh_group, - encryption_algorithm, - ike_version, - key_lifetime=key_lifetime, - name=name, - resource_group=resource_group, + response = _service.create_vpn_gateway_connection( + vpn_gateway_id, + vpn_gateway_connection_prototype, headers={} ) @@ -21956,156 +24749,168 @@ def test_create_ike_policy_all_params(self): assert response.status_code == 201 # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body['authentication_algorithm'] == 'md5' - assert req_body['dh_group'] == 14 - assert req_body['encryption_algorithm'] == 'aes128' - assert req_body['ike_version'] == 1 - assert req_body['key_lifetime'] == 28800 - assert req_body['name'] == 'my-ike-policy' - assert req_body['resource_group'] == resource_group_identity_model + assert req_body == vpn_gateway_connection_prototype - def test_create_ike_policy_all_params_with_retries(self): - # Enable retries and run test_create_ike_policy_all_params. + def test_create_vpn_gateway_connection_all_params_with_retries(self): + # Enable retries and run test_create_vpn_gateway_connection_all_params. _service.enable_retries() - self.test_create_ike_policy_all_params() + self.test_create_vpn_gateway_connection_all_params() - # Disable retries and run test_create_ike_policy_all_params. + # Disable retries and run test_create_vpn_gateway_connection_all_params. _service.disable_retries() - self.test_create_ike_policy_all_params() + self.test_create_vpn_gateway_connection_all_params() @responses.activate - def test_create_ike_policy_value_error(self): + def test_create_vpn_gateway_connection_value_error(self): """ - test_create_ike_policy_value_error() + test_create_vpn_gateway_connection_value_error() """ # Set up mock - url = preprocess_url('/ike_policies') - mock_response = '{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "dh_group": 14, "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "ike_version": 1, "key_lifetime": 28800, "name": "my-ike-policy", "negotiation_mode": "main", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ike_policy"}' + url = preprocess_url('/vpn_gateways/testString/connections') + mock_response = '{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) - # Construct a dict representation of a ResourceGroupIdentityById model - resource_group_identity_model = {} - resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + # Construct a dict representation of a VPNGatewayConnectionDPDPrototype model + vpn_gateway_connection_dpd_prototype_model = {} + vpn_gateway_connection_dpd_prototype_model['action'] = 'restart' + vpn_gateway_connection_dpd_prototype_model['interval'] = 30 + vpn_gateway_connection_dpd_prototype_model['timeout'] = 120 + + # Construct a dict representation of a VPNGatewayConnectionIKEPolicyPrototypeIKEPolicyIdentityById model + vpn_gateway_connection_ike_policy_prototype_model = {} + vpn_gateway_connection_ike_policy_prototype_model['id'] = 'ddf51bec-3424-11e8-b467-0ed5f89f718b' + + # Construct a dict representation of a VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityById model + vpn_gateway_connection_i_psec_policy_prototype_model = {} + vpn_gateway_connection_i_psec_policy_prototype_model['id'] = 'ddf51bec-3424-11e8-b467-0ed5f89f718b' + + # Construct a dict representation of a VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype model + vpn_gateway_connection_prototype_model = {} + vpn_gateway_connection_prototype_model['admin_state_up'] = True + vpn_gateway_connection_prototype_model['dead_peer_detection'] = vpn_gateway_connection_dpd_prototype_model + vpn_gateway_connection_prototype_model['ike_policy'] = vpn_gateway_connection_ike_policy_prototype_model + vpn_gateway_connection_prototype_model['ipsec_policy'] = vpn_gateway_connection_i_psec_policy_prototype_model + vpn_gateway_connection_prototype_model['name'] = 'my-vpn-connection' + vpn_gateway_connection_prototype_model['peer_address'] = '169.21.50.5' + vpn_gateway_connection_prototype_model['psk'] = 'lkj14b1oi0alcniejkso' + vpn_gateway_connection_prototype_model['routing_protocol'] = 'none' # Set up parameter values - authentication_algorithm = 'md5' - dh_group = 14 - encryption_algorithm = 'aes128' - ike_version = 1 - key_lifetime = 28800 - name = 'my-ike-policy' - resource_group = resource_group_identity_model + vpn_gateway_id = 'testString' + vpn_gateway_connection_prototype = vpn_gateway_connection_prototype_model # Pass in all but one required param and check for a ValueError req_param_dict = { - "authentication_algorithm": authentication_algorithm, - "dh_group": dh_group, - "encryption_algorithm": encryption_algorithm, - "ike_version": ike_version, + "vpn_gateway_id": vpn_gateway_id, + "vpn_gateway_connection_prototype": vpn_gateway_connection_prototype, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.create_ike_policy(**req_copy) + _service.create_vpn_gateway_connection(**req_copy) - def test_create_ike_policy_value_error_with_retries(self): - # Enable retries and run test_create_ike_policy_value_error. + def test_create_vpn_gateway_connection_value_error_with_retries(self): + # Enable retries and run test_create_vpn_gateway_connection_value_error. _service.enable_retries() - self.test_create_ike_policy_value_error() + self.test_create_vpn_gateway_connection_value_error() - # Disable retries and run test_create_ike_policy_value_error. + # Disable retries and run test_create_vpn_gateway_connection_value_error. _service.disable_retries() - self.test_create_ike_policy_value_error() + self.test_create_vpn_gateway_connection_value_error() -class TestDeleteIkePolicy(): +class TestDeleteVpnGatewayConnection(): """ - Test Class for delete_ike_policy + Test Class for delete_vpn_gateway_connection """ @responses.activate - def test_delete_ike_policy_all_params(self): + def test_delete_vpn_gateway_connection_all_params(self): """ - delete_ike_policy() + delete_vpn_gateway_connection() """ # Set up mock - url = preprocess_url('/ike_policies/testString') + url = preprocess_url('/vpn_gateways/testString/connections/testString') responses.add(responses.DELETE, url, - status=204) + status=202) # Set up parameter values + vpn_gateway_id = 'testString' id = 'testString' # Invoke method - response = _service.delete_ike_policy( + response = _service.delete_vpn_gateway_connection( + vpn_gateway_id, id, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 204 + assert response.status_code == 202 - def test_delete_ike_policy_all_params_with_retries(self): - # Enable retries and run test_delete_ike_policy_all_params. + def test_delete_vpn_gateway_connection_all_params_with_retries(self): + # Enable retries and run test_delete_vpn_gateway_connection_all_params. _service.enable_retries() - self.test_delete_ike_policy_all_params() + self.test_delete_vpn_gateway_connection_all_params() - # Disable retries and run test_delete_ike_policy_all_params. + # Disable retries and run test_delete_vpn_gateway_connection_all_params. _service.disable_retries() - self.test_delete_ike_policy_all_params() + self.test_delete_vpn_gateway_connection_all_params() @responses.activate - def test_delete_ike_policy_value_error(self): + def test_delete_vpn_gateway_connection_value_error(self): """ - test_delete_ike_policy_value_error() + test_delete_vpn_gateway_connection_value_error() """ # Set up mock - url = preprocess_url('/ike_policies/testString') + url = preprocess_url('/vpn_gateways/testString/connections/testString') responses.add(responses.DELETE, url, - status=204) + status=202) # Set up parameter values + vpn_gateway_id = 'testString' id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { + "vpn_gateway_id": vpn_gateway_id, "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.delete_ike_policy(**req_copy) + _service.delete_vpn_gateway_connection(**req_copy) - def test_delete_ike_policy_value_error_with_retries(self): - # Enable retries and run test_delete_ike_policy_value_error. + def test_delete_vpn_gateway_connection_value_error_with_retries(self): + # Enable retries and run test_delete_vpn_gateway_connection_value_error. _service.enable_retries() - self.test_delete_ike_policy_value_error() + self.test_delete_vpn_gateway_connection_value_error() - # Disable retries and run test_delete_ike_policy_value_error. + # Disable retries and run test_delete_vpn_gateway_connection_value_error. _service.disable_retries() - self.test_delete_ike_policy_value_error() + self.test_delete_vpn_gateway_connection_value_error() -class TestGetIkePolicy(): +class TestGetVpnGatewayConnection(): """ - Test Class for get_ike_policy + Test Class for get_vpn_gateway_connection """ @responses.activate - def test_get_ike_policy_all_params(self): + def test_get_vpn_gateway_connection_all_params(self): """ - get_ike_policy() + get_vpn_gateway_connection() """ # Set up mock - url = preprocess_url('/ike_policies/testString') - mock_response = '{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "dh_group": 14, "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "ike_version": 1, "key_lifetime": 28800, "name": "my-ike-policy", "negotiation_mode": "main", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ike_policy"}' + url = preprocess_url('/vpn_gateways/testString/connections/testString') + mock_response = '{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}' responses.add(responses.GET, url, body=mock_response, @@ -22113,10 +24918,12 @@ def test_get_ike_policy_all_params(self): status=200) # Set up parameter values + vpn_gateway_id = 'testString' id = 'testString' # Invoke method - response = _service.get_ike_policy( + response = _service.get_vpn_gateway_connection( + vpn_gateway_id, id, headers={} ) @@ -22125,23 +24932,23 @@ def test_get_ike_policy_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 200 - def test_get_ike_policy_all_params_with_retries(self): - # Enable retries and run test_get_ike_policy_all_params. + def test_get_vpn_gateway_connection_all_params_with_retries(self): + # Enable retries and run test_get_vpn_gateway_connection_all_params. _service.enable_retries() - self.test_get_ike_policy_all_params() + self.test_get_vpn_gateway_connection_all_params() - # Disable retries and run test_get_ike_policy_all_params. + # Disable retries and run test_get_vpn_gateway_connection_all_params. _service.disable_retries() - self.test_get_ike_policy_all_params() + self.test_get_vpn_gateway_connection_all_params() @responses.activate - def test_get_ike_policy_value_error(self): + def test_get_vpn_gateway_connection_value_error(self): """ - test_get_ike_policy_value_error() + test_get_vpn_gateway_connection_value_error() """ # Set up mock - url = preprocess_url('/ike_policies/testString') - mock_response = '{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "dh_group": 14, "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "ike_version": 1, "key_lifetime": 28800, "name": "my-ike-policy", "negotiation_mode": "main", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ike_policy"}' + url = preprocess_url('/vpn_gateways/testString/connections/testString') + mock_response = '{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}' responses.add(responses.GET, url, body=mock_response, @@ -22149,765 +24956,894 @@ def test_get_ike_policy_value_error(self): status=200) # Set up parameter values + vpn_gateway_id = 'testString' id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { + "vpn_gateway_id": vpn_gateway_id, "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.get_ike_policy(**req_copy) + _service.get_vpn_gateway_connection(**req_copy) - def test_get_ike_policy_value_error_with_retries(self): - # Enable retries and run test_get_ike_policy_value_error. + def test_get_vpn_gateway_connection_value_error_with_retries(self): + # Enable retries and run test_get_vpn_gateway_connection_value_error. _service.enable_retries() - self.test_get_ike_policy_value_error() + self.test_get_vpn_gateway_connection_value_error() - # Disable retries and run test_get_ike_policy_value_error. + # Disable retries and run test_get_vpn_gateway_connection_value_error. _service.disable_retries() - self.test_get_ike_policy_value_error() + self.test_get_vpn_gateway_connection_value_error() -class TestUpdateIkePolicy(): +class TestUpdateVpnGatewayConnection(): """ - Test Class for update_ike_policy + Test Class for update_vpn_gateway_connection """ @responses.activate - def test_update_ike_policy_all_params(self): + def test_update_vpn_gateway_connection_all_params(self): """ - update_ike_policy() + update_vpn_gateway_connection() """ # Set up mock - url = preprocess_url('/ike_policies/testString') - mock_response = '{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "dh_group": 14, "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "ike_version": 1, "key_lifetime": 28800, "name": "my-ike-policy", "negotiation_mode": "main", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ike_policy"}' + url = preprocess_url('/vpn_gateways/testString/connections/testString') + mock_response = '{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}' responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', status=200) - # Construct a dict representation of a IKEPolicyPatch model - ike_policy_patch_model = {} - ike_policy_patch_model['authentication_algorithm'] = 'md5' - ike_policy_patch_model['dh_group'] = 14 - ike_policy_patch_model['encryption_algorithm'] = 'aes128' - ike_policy_patch_model['ike_version'] = 1 - ike_policy_patch_model['key_lifetime'] = 28800 - ike_policy_patch_model['name'] = 'my-ike-policy' + # Construct a dict representation of a VPNGatewayConnectionDPDPatch model + vpn_gateway_connection_dpd_patch_model = {} + vpn_gateway_connection_dpd_patch_model['action'] = 'restart' + vpn_gateway_connection_dpd_patch_model['interval'] = 30 + vpn_gateway_connection_dpd_patch_model['timeout'] = 120 + + # Construct a dict representation of a VPNGatewayConnectionIKEPolicyPatchIKEPolicyIdentityById model + vpn_gateway_connection_ike_policy_patch_model = {} + vpn_gateway_connection_ike_policy_patch_model['id'] = 'ddf51bec-3424-11e8-b467-0ed5f89f718b' + + # Construct a dict representation of a VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityById model + vpn_gateway_connection_i_psec_policy_patch_model = {} + vpn_gateway_connection_i_psec_policy_patch_model['id'] = 'ddf51bec-3424-11e8-b467-0ed5f89f718b' + + # Construct a dict representation of a VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch model + vpn_gateway_connection_patch_model = {} + vpn_gateway_connection_patch_model['admin_state_up'] = True + vpn_gateway_connection_patch_model['dead_peer_detection'] = vpn_gateway_connection_dpd_patch_model + vpn_gateway_connection_patch_model['ike_policy'] = vpn_gateway_connection_ike_policy_patch_model + vpn_gateway_connection_patch_model['ipsec_policy'] = vpn_gateway_connection_i_psec_policy_patch_model + vpn_gateway_connection_patch_model['name'] = 'my-vpn-connection' + vpn_gateway_connection_patch_model['peer_address'] = '169.21.50.5' + vpn_gateway_connection_patch_model['psk'] = 'lkj14b1oi0alcniejkso' + vpn_gateway_connection_patch_model['routing_protocol'] = 'none' # Set up parameter values + vpn_gateway_id = 'testString' id = 'testString' - ike_policy_patch = ike_policy_patch_model + vpn_gateway_connection_patch = vpn_gateway_connection_patch_model # Invoke method - response = _service.update_ike_policy( + response = _service.update_vpn_gateway_connection( + vpn_gateway_id, + id, + vpn_gateway_connection_patch, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body == vpn_gateway_connection_patch + + def test_update_vpn_gateway_connection_all_params_with_retries(self): + # Enable retries and run test_update_vpn_gateway_connection_all_params. + _service.enable_retries() + self.test_update_vpn_gateway_connection_all_params() + + # Disable retries and run test_update_vpn_gateway_connection_all_params. + _service.disable_retries() + self.test_update_vpn_gateway_connection_all_params() + + @responses.activate + def test_update_vpn_gateway_connection_value_error(self): + """ + test_update_vpn_gateway_connection_value_error() + """ + # Set up mock + url = preprocess_url('/vpn_gateways/testString/connections/testString') + mock_response = '{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}' + responses.add(responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Construct a dict representation of a VPNGatewayConnectionDPDPatch model + vpn_gateway_connection_dpd_patch_model = {} + vpn_gateway_connection_dpd_patch_model['action'] = 'restart' + vpn_gateway_connection_dpd_patch_model['interval'] = 30 + vpn_gateway_connection_dpd_patch_model['timeout'] = 120 + + # Construct a dict representation of a VPNGatewayConnectionIKEPolicyPatchIKEPolicyIdentityById model + vpn_gateway_connection_ike_policy_patch_model = {} + vpn_gateway_connection_ike_policy_patch_model['id'] = 'ddf51bec-3424-11e8-b467-0ed5f89f718b' + + # Construct a dict representation of a VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityById model + vpn_gateway_connection_i_psec_policy_patch_model = {} + vpn_gateway_connection_i_psec_policy_patch_model['id'] = 'ddf51bec-3424-11e8-b467-0ed5f89f718b' + + # Construct a dict representation of a VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch model + vpn_gateway_connection_patch_model = {} + vpn_gateway_connection_patch_model['admin_state_up'] = True + vpn_gateway_connection_patch_model['dead_peer_detection'] = vpn_gateway_connection_dpd_patch_model + vpn_gateway_connection_patch_model['ike_policy'] = vpn_gateway_connection_ike_policy_patch_model + vpn_gateway_connection_patch_model['ipsec_policy'] = vpn_gateway_connection_i_psec_policy_patch_model + vpn_gateway_connection_patch_model['name'] = 'my-vpn-connection' + vpn_gateway_connection_patch_model['peer_address'] = '169.21.50.5' + vpn_gateway_connection_patch_model['psk'] = 'lkj14b1oi0alcniejkso' + vpn_gateway_connection_patch_model['routing_protocol'] = 'none' + + # Set up parameter values + vpn_gateway_id = 'testString' + id = 'testString' + vpn_gateway_connection_patch = vpn_gateway_connection_patch_model + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "vpn_gateway_id": vpn_gateway_id, + "id": id, + "vpn_gateway_connection_patch": vpn_gateway_connection_patch, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.update_vpn_gateway_connection(**req_copy) + + + def test_update_vpn_gateway_connection_value_error_with_retries(self): + # Enable retries and run test_update_vpn_gateway_connection_value_error. + _service.enable_retries() + self.test_update_vpn_gateway_connection_value_error() + + # Disable retries and run test_update_vpn_gateway_connection_value_error. + _service.disable_retries() + self.test_update_vpn_gateway_connection_value_error() + +class TestListVpnGatewayConnectionLocalCidrs(): + """ + Test Class for list_vpn_gateway_connection_local_cidrs + """ + + @responses.activate + def test_list_vpn_gateway_connection_local_cidrs_all_params(self): + """ + list_vpn_gateway_connection_local_cidrs() + """ + # Set up mock + url = preprocess_url('/vpn_gateways/testString/connections/testString/local_cidrs') + mock_response = '{"local_cidrs": ["192.168.1.0/24"]}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + + # Set up parameter values + vpn_gateway_id = 'testString' + id = 'testString' + + # Invoke method + response = _service.list_vpn_gateway_connection_local_cidrs( + vpn_gateway_id, id, - ike_policy_patch, headers={} ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 - # Validate body params - req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == ike_policy_patch - def test_update_ike_policy_all_params_with_retries(self): - # Enable retries and run test_update_ike_policy_all_params. + def test_list_vpn_gateway_connection_local_cidrs_all_params_with_retries(self): + # Enable retries and run test_list_vpn_gateway_connection_local_cidrs_all_params. _service.enable_retries() - self.test_update_ike_policy_all_params() + self.test_list_vpn_gateway_connection_local_cidrs_all_params() - # Disable retries and run test_update_ike_policy_all_params. + # Disable retries and run test_list_vpn_gateway_connection_local_cidrs_all_params. _service.disable_retries() - self.test_update_ike_policy_all_params() + self.test_list_vpn_gateway_connection_local_cidrs_all_params() @responses.activate - def test_update_ike_policy_value_error(self): + def test_list_vpn_gateway_connection_local_cidrs_value_error(self): """ - test_update_ike_policy_value_error() + test_list_vpn_gateway_connection_local_cidrs_value_error() """ # Set up mock - url = preprocess_url('/ike_policies/testString') - mock_response = '{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "dh_group": 14, "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "ike_version": 1, "key_lifetime": 28800, "name": "my-ike-policy", "negotiation_mode": "main", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ike_policy"}' - responses.add(responses.PATCH, + url = preprocess_url('/vpn_gateways/testString/connections/testString/local_cidrs') + mock_response = '{"local_cidrs": ["192.168.1.0/24"]}' + responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) - # Construct a dict representation of a IKEPolicyPatch model - ike_policy_patch_model = {} - ike_policy_patch_model['authentication_algorithm'] = 'md5' - ike_policy_patch_model['dh_group'] = 14 - ike_policy_patch_model['encryption_algorithm'] = 'aes128' - ike_policy_patch_model['ike_version'] = 1 - ike_policy_patch_model['key_lifetime'] = 28800 - ike_policy_patch_model['name'] = 'my-ike-policy' - # Set up parameter values + vpn_gateway_id = 'testString' id = 'testString' - ike_policy_patch = ike_policy_patch_model # Pass in all but one required param and check for a ValueError req_param_dict = { + "vpn_gateway_id": vpn_gateway_id, "id": id, - "ike_policy_patch": ike_policy_patch, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.update_ike_policy(**req_copy) + _service.list_vpn_gateway_connection_local_cidrs(**req_copy) - def test_update_ike_policy_value_error_with_retries(self): - # Enable retries and run test_update_ike_policy_value_error. + def test_list_vpn_gateway_connection_local_cidrs_value_error_with_retries(self): + # Enable retries and run test_list_vpn_gateway_connection_local_cidrs_value_error. _service.enable_retries() - self.test_update_ike_policy_value_error() + self.test_list_vpn_gateway_connection_local_cidrs_value_error() - # Disable retries and run test_update_ike_policy_value_error. + # Disable retries and run test_list_vpn_gateway_connection_local_cidrs_value_error. _service.disable_retries() - self.test_update_ike_policy_value_error() + self.test_list_vpn_gateway_connection_local_cidrs_value_error() -class TestListIkePolicyConnections(): +class TestRemoveVpnGatewayConnectionLocalCidr(): """ - Test Class for list_ike_policy_connections + Test Class for remove_vpn_gateway_connection_local_cidr """ @responses.activate - def test_list_ike_policy_connections_all_params(self): + def test_remove_vpn_gateway_connection_local_cidr_all_params(self): """ - list_ike_policy_connections() + remove_vpn_gateway_connection_local_cidr() """ # Set up mock - url = preprocess_url('/ike_policies/testString/connections') - mock_response = '{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}' - responses.add(responses.GET, + url = preprocess_url('/vpn_gateways/testString/connections/testString/local_cidrs/testString/testString') + responses.add(responses.DELETE, url, - body=mock_response, - content_type='application/json', - status=200) + status=204) # Set up parameter values + vpn_gateway_id = 'testString' id = 'testString' + cidr_prefix = 'testString' + prefix_length = 'testString' # Invoke method - response = _service.list_ike_policy_connections( + response = _service.remove_vpn_gateway_connection_local_cidr( + vpn_gateway_id, id, + cidr_prefix, + prefix_length, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 200 + assert response.status_code == 204 - def test_list_ike_policy_connections_all_params_with_retries(self): - # Enable retries and run test_list_ike_policy_connections_all_params. + def test_remove_vpn_gateway_connection_local_cidr_all_params_with_retries(self): + # Enable retries and run test_remove_vpn_gateway_connection_local_cidr_all_params. _service.enable_retries() - self.test_list_ike_policy_connections_all_params() + self.test_remove_vpn_gateway_connection_local_cidr_all_params() - # Disable retries and run test_list_ike_policy_connections_all_params. + # Disable retries and run test_remove_vpn_gateway_connection_local_cidr_all_params. _service.disable_retries() - self.test_list_ike_policy_connections_all_params() + self.test_remove_vpn_gateway_connection_local_cidr_all_params() @responses.activate - def test_list_ike_policy_connections_value_error(self): + def test_remove_vpn_gateway_connection_local_cidr_value_error(self): """ - test_list_ike_policy_connections_value_error() + test_remove_vpn_gateway_connection_local_cidr_value_error() """ # Set up mock - url = preprocess_url('/ike_policies/testString/connections') - mock_response = '{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}' - responses.add(responses.GET, + url = preprocess_url('/vpn_gateways/testString/connections/testString/local_cidrs/testString/testString') + responses.add(responses.DELETE, url, - body=mock_response, - content_type='application/json', - status=200) + status=204) # Set up parameter values + vpn_gateway_id = 'testString' id = 'testString' + cidr_prefix = 'testString' + prefix_length = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { + "vpn_gateway_id": vpn_gateway_id, "id": id, + "cidr_prefix": cidr_prefix, + "prefix_length": prefix_length, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_ike_policy_connections(**req_copy) + _service.remove_vpn_gateway_connection_local_cidr(**req_copy) - def test_list_ike_policy_connections_value_error_with_retries(self): - # Enable retries and run test_list_ike_policy_connections_value_error. + def test_remove_vpn_gateway_connection_local_cidr_value_error_with_retries(self): + # Enable retries and run test_remove_vpn_gateway_connection_local_cidr_value_error. _service.enable_retries() - self.test_list_ike_policy_connections_value_error() + self.test_remove_vpn_gateway_connection_local_cidr_value_error() - # Disable retries and run test_list_ike_policy_connections_value_error. + # Disable retries and run test_remove_vpn_gateway_connection_local_cidr_value_error. _service.disable_retries() - self.test_list_ike_policy_connections_value_error() + self.test_remove_vpn_gateway_connection_local_cidr_value_error() -class TestListIpsecPolicies(): +class TestCheckVpnGatewayConnectionLocalCidr(): """ - Test Class for list_ipsec_policies + Test Class for check_vpn_gateway_connection_local_cidr """ @responses.activate - def test_list_ipsec_policies_all_params(self): + def test_check_vpn_gateway_connection_local_cidr_all_params(self): """ - list_ipsec_policies() + check_vpn_gateway_connection_local_cidr() """ # Set up mock - url = preprocess_url('/ipsec_policies') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies?limit=20"}, "ipsec_policies": [{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "key_lifetime": 3600, "name": "my-ipsec-policy", "pfs": "disabled", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ipsec_policy", "transform_protocol": "esp"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132}' + url = preprocess_url('/vpn_gateways/testString/connections/testString/local_cidrs/testString/testString') responses.add(responses.GET, url, - body=mock_response, - content_type='application/json', - status=200) + status=204) # Set up parameter values - start = 'testString' - limit = 1 + vpn_gateway_id = 'testString' + id = 'testString' + cidr_prefix = 'testString' + prefix_length = 'testString' # Invoke method - response = _service.list_ipsec_policies( - start=start, - limit=limit, + response = _service.check_vpn_gateway_connection_local_cidr( + vpn_gateway_id, + id, + cidr_prefix, + prefix_length, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 200 - # Validate query params - query_string = responses.calls[0].request.url.split('?',1)[1] - query_string = urllib.parse.unquote_plus(query_string) - assert 'start={}'.format(start) in query_string - assert 'limit={}'.format(limit) in query_string + assert response.status_code == 204 - def test_list_ipsec_policies_all_params_with_retries(self): - # Enable retries and run test_list_ipsec_policies_all_params. + def test_check_vpn_gateway_connection_local_cidr_all_params_with_retries(self): + # Enable retries and run test_check_vpn_gateway_connection_local_cidr_all_params. _service.enable_retries() - self.test_list_ipsec_policies_all_params() + self.test_check_vpn_gateway_connection_local_cidr_all_params() - # Disable retries and run test_list_ipsec_policies_all_params. + # Disable retries and run test_check_vpn_gateway_connection_local_cidr_all_params. _service.disable_retries() - self.test_list_ipsec_policies_all_params() + self.test_check_vpn_gateway_connection_local_cidr_all_params() @responses.activate - def test_list_ipsec_policies_required_params(self): + def test_check_vpn_gateway_connection_local_cidr_value_error(self): """ - test_list_ipsec_policies_required_params() + test_check_vpn_gateway_connection_local_cidr_value_error() """ # Set up mock - url = preprocess_url('/ipsec_policies') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies?limit=20"}, "ipsec_policies": [{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "key_lifetime": 3600, "name": "my-ipsec-policy", "pfs": "disabled", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ipsec_policy", "transform_protocol": "esp"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132}' + url = preprocess_url('/vpn_gateways/testString/connections/testString/local_cidrs/testString/testString') responses.add(responses.GET, url, - body=mock_response, - content_type='application/json', - status=200) - - # Invoke method - response = _service.list_ipsec_policies() - - - # Check for correct operation - assert len(responses.calls) == 1 - assert response.status_code == 200 - - def test_list_ipsec_policies_required_params_with_retries(self): - # Enable retries and run test_list_ipsec_policies_required_params. - _service.enable_retries() - self.test_list_ipsec_policies_required_params() - - # Disable retries and run test_list_ipsec_policies_required_params. - _service.disable_retries() - self.test_list_ipsec_policies_required_params() + status=204) - @responses.activate - def test_list_ipsec_policies_value_error(self): - """ - test_list_ipsec_policies_value_error() - """ - # Set up mock - url = preprocess_url('/ipsec_policies') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies?limit=20"}, "ipsec_policies": [{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "key_lifetime": 3600, "name": "my-ipsec-policy", "pfs": "disabled", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ipsec_policy", "transform_protocol": "esp"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + # Set up parameter values + vpn_gateway_id = 'testString' + id = 'testString' + cidr_prefix = 'testString' + prefix_length = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { + "vpn_gateway_id": vpn_gateway_id, + "id": id, + "cidr_prefix": cidr_prefix, + "prefix_length": prefix_length, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_ipsec_policies(**req_copy) + _service.check_vpn_gateway_connection_local_cidr(**req_copy) - def test_list_ipsec_policies_value_error_with_retries(self): - # Enable retries and run test_list_ipsec_policies_value_error. + def test_check_vpn_gateway_connection_local_cidr_value_error_with_retries(self): + # Enable retries and run test_check_vpn_gateway_connection_local_cidr_value_error. _service.enable_retries() - self.test_list_ipsec_policies_value_error() + self.test_check_vpn_gateway_connection_local_cidr_value_error() - # Disable retries and run test_list_ipsec_policies_value_error. + # Disable retries and run test_check_vpn_gateway_connection_local_cidr_value_error. _service.disable_retries() - self.test_list_ipsec_policies_value_error() + self.test_check_vpn_gateway_connection_local_cidr_value_error() -class TestCreateIpsecPolicy(): +class TestAddVpnGatewayConnectionLocalCidr(): """ - Test Class for create_ipsec_policy + Test Class for add_vpn_gateway_connection_local_cidr """ @responses.activate - def test_create_ipsec_policy_all_params(self): + def test_add_vpn_gateway_connection_local_cidr_all_params(self): """ - create_ipsec_policy() + add_vpn_gateway_connection_local_cidr() """ # Set up mock - url = preprocess_url('/ipsec_policies') - mock_response = '{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "key_lifetime": 3600, "name": "my-ipsec-policy", "pfs": "disabled", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ipsec_policy", "transform_protocol": "esp"}' - responses.add(responses.POST, + url = preprocess_url('/vpn_gateways/testString/connections/testString/local_cidrs/testString/testString') + responses.add(responses.PUT, url, - body=mock_response, - content_type='application/json', - status=201) - - # Construct a dict representation of a ResourceGroupIdentityById model - resource_group_identity_model = {} - resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + status=204) # Set up parameter values - authentication_algorithm = 'md5' - encryption_algorithm = 'aes128' - pfs = 'disabled' - key_lifetime = 3600 - name = 'my-ipsec-policy' - resource_group = resource_group_identity_model + vpn_gateway_id = 'testString' + id = 'testString' + cidr_prefix = 'testString' + prefix_length = 'testString' # Invoke method - response = _service.create_ipsec_policy( - authentication_algorithm, - encryption_algorithm, - pfs, - key_lifetime=key_lifetime, - name=name, - resource_group=resource_group, + response = _service.add_vpn_gateway_connection_local_cidr( + vpn_gateway_id, + id, + cidr_prefix, + prefix_length, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 201 - # Validate body params - req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body['authentication_algorithm'] == 'md5' - assert req_body['encryption_algorithm'] == 'aes128' - assert req_body['pfs'] == 'disabled' - assert req_body['key_lifetime'] == 3600 - assert req_body['name'] == 'my-ipsec-policy' - assert req_body['resource_group'] == resource_group_identity_model + assert response.status_code == 204 - def test_create_ipsec_policy_all_params_with_retries(self): - # Enable retries and run test_create_ipsec_policy_all_params. + def test_add_vpn_gateway_connection_local_cidr_all_params_with_retries(self): + # Enable retries and run test_add_vpn_gateway_connection_local_cidr_all_params. _service.enable_retries() - self.test_create_ipsec_policy_all_params() + self.test_add_vpn_gateway_connection_local_cidr_all_params() - # Disable retries and run test_create_ipsec_policy_all_params. + # Disable retries and run test_add_vpn_gateway_connection_local_cidr_all_params. _service.disable_retries() - self.test_create_ipsec_policy_all_params() + self.test_add_vpn_gateway_connection_local_cidr_all_params() @responses.activate - def test_create_ipsec_policy_value_error(self): + def test_add_vpn_gateway_connection_local_cidr_value_error(self): """ - test_create_ipsec_policy_value_error() + test_add_vpn_gateway_connection_local_cidr_value_error() """ # Set up mock - url = preprocess_url('/ipsec_policies') - mock_response = '{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "key_lifetime": 3600, "name": "my-ipsec-policy", "pfs": "disabled", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ipsec_policy", "transform_protocol": "esp"}' - responses.add(responses.POST, + url = preprocess_url('/vpn_gateways/testString/connections/testString/local_cidrs/testString/testString') + responses.add(responses.PUT, url, - body=mock_response, - content_type='application/json', - status=201) - - # Construct a dict representation of a ResourceGroupIdentityById model - resource_group_identity_model = {} - resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + status=204) # Set up parameter values - authentication_algorithm = 'md5' - encryption_algorithm = 'aes128' - pfs = 'disabled' - key_lifetime = 3600 - name = 'my-ipsec-policy' - resource_group = resource_group_identity_model + vpn_gateway_id = 'testString' + id = 'testString' + cidr_prefix = 'testString' + prefix_length = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "authentication_algorithm": authentication_algorithm, - "encryption_algorithm": encryption_algorithm, - "pfs": pfs, + "vpn_gateway_id": vpn_gateway_id, + "id": id, + "cidr_prefix": cidr_prefix, + "prefix_length": prefix_length, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.create_ipsec_policy(**req_copy) + _service.add_vpn_gateway_connection_local_cidr(**req_copy) - def test_create_ipsec_policy_value_error_with_retries(self): - # Enable retries and run test_create_ipsec_policy_value_error. + def test_add_vpn_gateway_connection_local_cidr_value_error_with_retries(self): + # Enable retries and run test_add_vpn_gateway_connection_local_cidr_value_error. _service.enable_retries() - self.test_create_ipsec_policy_value_error() + self.test_add_vpn_gateway_connection_local_cidr_value_error() - # Disable retries and run test_create_ipsec_policy_value_error. + # Disable retries and run test_add_vpn_gateway_connection_local_cidr_value_error. _service.disable_retries() - self.test_create_ipsec_policy_value_error() + self.test_add_vpn_gateway_connection_local_cidr_value_error() -class TestDeleteIpsecPolicy(): +class TestListVpnGatewayConnectionPeerCidrs(): """ - Test Class for delete_ipsec_policy + Test Class for list_vpn_gateway_connection_peer_cidrs """ @responses.activate - def test_delete_ipsec_policy_all_params(self): + def test_list_vpn_gateway_connection_peer_cidrs_all_params(self): """ - delete_ipsec_policy() + list_vpn_gateway_connection_peer_cidrs() """ # Set up mock - url = preprocess_url('/ipsec_policies/testString') - responses.add(responses.DELETE, + url = preprocess_url('/vpn_gateways/testString/connections/testString/peer_cidrs') + mock_response = '{"peer_cidrs": ["10.45.1.0/24"]}' + responses.add(responses.GET, url, - status=204) + body=mock_response, + content_type='application/json', + status=200) # Set up parameter values + vpn_gateway_id = 'testString' id = 'testString' # Invoke method - response = _service.delete_ipsec_policy( + response = _service.list_vpn_gateway_connection_peer_cidrs( + vpn_gateway_id, id, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 204 + assert response.status_code == 200 - def test_delete_ipsec_policy_all_params_with_retries(self): - # Enable retries and run test_delete_ipsec_policy_all_params. + def test_list_vpn_gateway_connection_peer_cidrs_all_params_with_retries(self): + # Enable retries and run test_list_vpn_gateway_connection_peer_cidrs_all_params. _service.enable_retries() - self.test_delete_ipsec_policy_all_params() + self.test_list_vpn_gateway_connection_peer_cidrs_all_params() - # Disable retries and run test_delete_ipsec_policy_all_params. + # Disable retries and run test_list_vpn_gateway_connection_peer_cidrs_all_params. _service.disable_retries() - self.test_delete_ipsec_policy_all_params() + self.test_list_vpn_gateway_connection_peer_cidrs_all_params() @responses.activate - def test_delete_ipsec_policy_value_error(self): + def test_list_vpn_gateway_connection_peer_cidrs_value_error(self): """ - test_delete_ipsec_policy_value_error() + test_list_vpn_gateway_connection_peer_cidrs_value_error() """ # Set up mock - url = preprocess_url('/ipsec_policies/testString') - responses.add(responses.DELETE, + url = preprocess_url('/vpn_gateways/testString/connections/testString/peer_cidrs') + mock_response = '{"peer_cidrs": ["10.45.1.0/24"]}' + responses.add(responses.GET, url, - status=204) + body=mock_response, + content_type='application/json', + status=200) # Set up parameter values + vpn_gateway_id = 'testString' id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { + "vpn_gateway_id": vpn_gateway_id, "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.delete_ipsec_policy(**req_copy) + _service.list_vpn_gateway_connection_peer_cidrs(**req_copy) - def test_delete_ipsec_policy_value_error_with_retries(self): - # Enable retries and run test_delete_ipsec_policy_value_error. + def test_list_vpn_gateway_connection_peer_cidrs_value_error_with_retries(self): + # Enable retries and run test_list_vpn_gateway_connection_peer_cidrs_value_error. _service.enable_retries() - self.test_delete_ipsec_policy_value_error() + self.test_list_vpn_gateway_connection_peer_cidrs_value_error() - # Disable retries and run test_delete_ipsec_policy_value_error. + # Disable retries and run test_list_vpn_gateway_connection_peer_cidrs_value_error. _service.disable_retries() - self.test_delete_ipsec_policy_value_error() + self.test_list_vpn_gateway_connection_peer_cidrs_value_error() -class TestGetIpsecPolicy(): +class TestRemoveVpnGatewayConnectionPeerCidr(): """ - Test Class for get_ipsec_policy + Test Class for remove_vpn_gateway_connection_peer_cidr """ @responses.activate - def test_get_ipsec_policy_all_params(self): + def test_remove_vpn_gateway_connection_peer_cidr_all_params(self): """ - get_ipsec_policy() + remove_vpn_gateway_connection_peer_cidr() """ # Set up mock - url = preprocess_url('/ipsec_policies/testString') - mock_response = '{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "key_lifetime": 3600, "name": "my-ipsec-policy", "pfs": "disabled", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ipsec_policy", "transform_protocol": "esp"}' - responses.add(responses.GET, + url = preprocess_url('/vpn_gateways/testString/connections/testString/peer_cidrs/testString/testString') + responses.add(responses.DELETE, url, - body=mock_response, - content_type='application/json', - status=200) + status=204) # Set up parameter values + vpn_gateway_id = 'testString' id = 'testString' + cidr_prefix = 'testString' + prefix_length = 'testString' # Invoke method - response = _service.get_ipsec_policy( + response = _service.remove_vpn_gateway_connection_peer_cidr( + vpn_gateway_id, id, + cidr_prefix, + prefix_length, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 200 + assert response.status_code == 204 - def test_get_ipsec_policy_all_params_with_retries(self): - # Enable retries and run test_get_ipsec_policy_all_params. + def test_remove_vpn_gateway_connection_peer_cidr_all_params_with_retries(self): + # Enable retries and run test_remove_vpn_gateway_connection_peer_cidr_all_params. _service.enable_retries() - self.test_get_ipsec_policy_all_params() + self.test_remove_vpn_gateway_connection_peer_cidr_all_params() - # Disable retries and run test_get_ipsec_policy_all_params. + # Disable retries and run test_remove_vpn_gateway_connection_peer_cidr_all_params. _service.disable_retries() - self.test_get_ipsec_policy_all_params() + self.test_remove_vpn_gateway_connection_peer_cidr_all_params() @responses.activate - def test_get_ipsec_policy_value_error(self): + def test_remove_vpn_gateway_connection_peer_cidr_value_error(self): """ - test_get_ipsec_policy_value_error() + test_remove_vpn_gateway_connection_peer_cidr_value_error() """ # Set up mock - url = preprocess_url('/ipsec_policies/testString') - mock_response = '{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "key_lifetime": 3600, "name": "my-ipsec-policy", "pfs": "disabled", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ipsec_policy", "transform_protocol": "esp"}' - responses.add(responses.GET, + url = preprocess_url('/vpn_gateways/testString/connections/testString/peer_cidrs/testString/testString') + responses.add(responses.DELETE, url, - body=mock_response, - content_type='application/json', - status=200) + status=204) # Set up parameter values + vpn_gateway_id = 'testString' id = 'testString' + cidr_prefix = 'testString' + prefix_length = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { + "vpn_gateway_id": vpn_gateway_id, "id": id, + "cidr_prefix": cidr_prefix, + "prefix_length": prefix_length, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.get_ipsec_policy(**req_copy) + _service.remove_vpn_gateway_connection_peer_cidr(**req_copy) - def test_get_ipsec_policy_value_error_with_retries(self): - # Enable retries and run test_get_ipsec_policy_value_error. + def test_remove_vpn_gateway_connection_peer_cidr_value_error_with_retries(self): + # Enable retries and run test_remove_vpn_gateway_connection_peer_cidr_value_error. _service.enable_retries() - self.test_get_ipsec_policy_value_error() + self.test_remove_vpn_gateway_connection_peer_cidr_value_error() - # Disable retries and run test_get_ipsec_policy_value_error. + # Disable retries and run test_remove_vpn_gateway_connection_peer_cidr_value_error. _service.disable_retries() - self.test_get_ipsec_policy_value_error() + self.test_remove_vpn_gateway_connection_peer_cidr_value_error() -class TestUpdateIpsecPolicy(): +class TestCheckVpnGatewayConnectionPeerCidr(): """ - Test Class for update_ipsec_policy + Test Class for check_vpn_gateway_connection_peer_cidr """ @responses.activate - def test_update_ipsec_policy_all_params(self): + def test_check_vpn_gateway_connection_peer_cidr_all_params(self): """ - update_ipsec_policy() + check_vpn_gateway_connection_peer_cidr() """ # Set up mock - url = preprocess_url('/ipsec_policies/testString') - mock_response = '{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "key_lifetime": 3600, "name": "my-ipsec-policy", "pfs": "disabled", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ipsec_policy", "transform_protocol": "esp"}' - responses.add(responses.PATCH, + url = preprocess_url('/vpn_gateways/testString/connections/testString/peer_cidrs/testString/testString') + responses.add(responses.GET, url, - body=mock_response, - content_type='application/json', - status=200) - - # Construct a dict representation of a IPsecPolicyPatch model - i_psec_policy_patch_model = {} - i_psec_policy_patch_model['authentication_algorithm'] = 'md5' - i_psec_policy_patch_model['encryption_algorithm'] = 'aes128' - i_psec_policy_patch_model['key_lifetime'] = 3600 - i_psec_policy_patch_model['name'] = 'my-ipsec-policy' - i_psec_policy_patch_model['pfs'] = 'disabled' + status=204) # Set up parameter values + vpn_gateway_id = 'testString' id = 'testString' - i_psec_policy_patch = i_psec_policy_patch_model + cidr_prefix = 'testString' + prefix_length = 'testString' # Invoke method - response = _service.update_ipsec_policy( + response = _service.check_vpn_gateway_connection_peer_cidr( + vpn_gateway_id, id, - i_psec_policy_patch, + cidr_prefix, + prefix_length, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 200 - # Validate body params - req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == i_psec_policy_patch + assert response.status_code == 204 - def test_update_ipsec_policy_all_params_with_retries(self): - # Enable retries and run test_update_ipsec_policy_all_params. + def test_check_vpn_gateway_connection_peer_cidr_all_params_with_retries(self): + # Enable retries and run test_check_vpn_gateway_connection_peer_cidr_all_params. _service.enable_retries() - self.test_update_ipsec_policy_all_params() + self.test_check_vpn_gateway_connection_peer_cidr_all_params() - # Disable retries and run test_update_ipsec_policy_all_params. + # Disable retries and run test_check_vpn_gateway_connection_peer_cidr_all_params. _service.disable_retries() - self.test_update_ipsec_policy_all_params() + self.test_check_vpn_gateway_connection_peer_cidr_all_params() @responses.activate - def test_update_ipsec_policy_value_error(self): + def test_check_vpn_gateway_connection_peer_cidr_value_error(self): """ - test_update_ipsec_policy_value_error() + test_check_vpn_gateway_connection_peer_cidr_value_error() """ # Set up mock - url = preprocess_url('/ipsec_policies/testString') - mock_response = '{"authentication_algorithm": "md5", "connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes128", "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "key_lifetime": 3600, "name": "my-ipsec-policy", "pfs": "disabled", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "ipsec_policy", "transform_protocol": "esp"}' - responses.add(responses.PATCH, + url = preprocess_url('/vpn_gateways/testString/connections/testString/peer_cidrs/testString/testString') + responses.add(responses.GET, url, - body=mock_response, - content_type='application/json', - status=200) - - # Construct a dict representation of a IPsecPolicyPatch model - i_psec_policy_patch_model = {} - i_psec_policy_patch_model['authentication_algorithm'] = 'md5' - i_psec_policy_patch_model['encryption_algorithm'] = 'aes128' - i_psec_policy_patch_model['key_lifetime'] = 3600 - i_psec_policy_patch_model['name'] = 'my-ipsec-policy' - i_psec_policy_patch_model['pfs'] = 'disabled' + status=204) # Set up parameter values + vpn_gateway_id = 'testString' id = 'testString' - i_psec_policy_patch = i_psec_policy_patch_model + cidr_prefix = 'testString' + prefix_length = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { + "vpn_gateway_id": vpn_gateway_id, "id": id, - "i_psec_policy_patch": i_psec_policy_patch, + "cidr_prefix": cidr_prefix, + "prefix_length": prefix_length, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.update_ipsec_policy(**req_copy) + _service.check_vpn_gateway_connection_peer_cidr(**req_copy) - def test_update_ipsec_policy_value_error_with_retries(self): - # Enable retries and run test_update_ipsec_policy_value_error. + def test_check_vpn_gateway_connection_peer_cidr_value_error_with_retries(self): + # Enable retries and run test_check_vpn_gateway_connection_peer_cidr_value_error. _service.enable_retries() - self.test_update_ipsec_policy_value_error() + self.test_check_vpn_gateway_connection_peer_cidr_value_error() - # Disable retries and run test_update_ipsec_policy_value_error. + # Disable retries and run test_check_vpn_gateway_connection_peer_cidr_value_error. _service.disable_retries() - self.test_update_ipsec_policy_value_error() + self.test_check_vpn_gateway_connection_peer_cidr_value_error() -class TestListIpsecPolicyConnections(): +class TestAddVpnGatewayConnectionPeerCidr(): """ - Test Class for list_ipsec_policy_connections + Test Class for add_vpn_gateway_connection_peer_cidr """ @responses.activate - def test_list_ipsec_policy_connections_all_params(self): + def test_add_vpn_gateway_connection_peer_cidr_all_params(self): """ - list_ipsec_policy_connections() + add_vpn_gateway_connection_peer_cidr() """ # Set up mock - url = preprocess_url('/ipsec_policies/testString/connections') - mock_response = '{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}' - responses.add(responses.GET, + url = preprocess_url('/vpn_gateways/testString/connections/testString/peer_cidrs/testString/testString') + responses.add(responses.PUT, url, - body=mock_response, - content_type='application/json', - status=200) + status=204) # Set up parameter values + vpn_gateway_id = 'testString' id = 'testString' + cidr_prefix = 'testString' + prefix_length = 'testString' # Invoke method - response = _service.list_ipsec_policy_connections( + response = _service.add_vpn_gateway_connection_peer_cidr( + vpn_gateway_id, id, + cidr_prefix, + prefix_length, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 200 + assert response.status_code == 204 - def test_list_ipsec_policy_connections_all_params_with_retries(self): - # Enable retries and run test_list_ipsec_policy_connections_all_params. + def test_add_vpn_gateway_connection_peer_cidr_all_params_with_retries(self): + # Enable retries and run test_add_vpn_gateway_connection_peer_cidr_all_params. _service.enable_retries() - self.test_list_ipsec_policy_connections_all_params() + self.test_add_vpn_gateway_connection_peer_cidr_all_params() - # Disable retries and run test_list_ipsec_policy_connections_all_params. + # Disable retries and run test_add_vpn_gateway_connection_peer_cidr_all_params. _service.disable_retries() - self.test_list_ipsec_policy_connections_all_params() + self.test_add_vpn_gateway_connection_peer_cidr_all_params() @responses.activate - def test_list_ipsec_policy_connections_value_error(self): + def test_add_vpn_gateway_connection_peer_cidr_value_error(self): """ - test_list_ipsec_policy_connections_value_error() + test_add_vpn_gateway_connection_peer_cidr_value_error() """ # Set up mock - url = preprocess_url('/ipsec_policies/testString/connections') - mock_response = '{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}' - responses.add(responses.GET, + url = preprocess_url('/vpn_gateways/testString/connections/testString/peer_cidrs/testString/testString') + responses.add(responses.PUT, url, - body=mock_response, - content_type='application/json', - status=200) + status=204) # Set up parameter values + vpn_gateway_id = 'testString' id = 'testString' + cidr_prefix = 'testString' + prefix_length = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { + "vpn_gateway_id": vpn_gateway_id, "id": id, + "cidr_prefix": cidr_prefix, + "prefix_length": prefix_length, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_ipsec_policy_connections(**req_copy) + _service.add_vpn_gateway_connection_peer_cidr(**req_copy) - def test_list_ipsec_policy_connections_value_error_with_retries(self): - # Enable retries and run test_list_ipsec_policy_connections_value_error. + def test_add_vpn_gateway_connection_peer_cidr_value_error_with_retries(self): + # Enable retries and run test_add_vpn_gateway_connection_peer_cidr_value_error. _service.enable_retries() - self.test_list_ipsec_policy_connections_value_error() + self.test_add_vpn_gateway_connection_peer_cidr_value_error() - # Disable retries and run test_list_ipsec_policy_connections_value_error. + # Disable retries and run test_add_vpn_gateway_connection_peer_cidr_value_error. _service.disable_retries() - self.test_list_ipsec_policy_connections_value_error() + self.test_add_vpn_gateway_connection_peer_cidr_value_error() -class TestListVpnGateways(): +# endregion +############################################################################## +# End of Service: VPNGateways +############################################################################## + +############################################################################## +# Start of Service: VPNServers +############################################################################## +# region + +class TestNewInstance(): """ - Test Class for list_vpn_gateways + Test Class for new_instance + """ + + def test_new_instance(self): + """ + new_instance() + """ + os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' + + service = VpcV1.new_instance( + version=version, + service_name='TEST_SERVICE', + ) + + assert service is not None + assert isinstance(service, VpcV1) + + def test_new_instance_without_authenticator(self): + """ + new_instance_without_authenticator() + """ + with pytest.raises(ValueError, match='authenticator must be provided'): + service = VpcV1.new_instance( + version=version, + service_name='TEST_SERVICE_NOT_FOUND', + ) + + def test_new_instance_without_required_params(self): + """ + new_instance_without_required_params() + """ + with pytest.raises(TypeError, match='new_instance\\(\\) missing \\d required positional arguments?: \'.*\''): + service = VpcV1.new_instance() + + def test_new_instance_required_param_none(self): + """ + new_instance_required_param_none() + """ + with pytest.raises(ValueError, match='version must be provided'): + service = VpcV1.new_instance( + version=None, + ) +class TestListVpnServers(): + """ + Test Class for list_vpn_servers """ @responses.activate - def test_list_vpn_gateways_all_params(self): + def test_list_vpn_servers_all_params(self): """ - list_vpn_gateways() + list_vpn_servers() """ # Set up mock - url = preprocess_url('/vpn_gateways') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132, "vpn_gateways": [{"connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "name": "my-vpn-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_gateway", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}]}' + url = preprocess_url('/vpn_servers') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers?start=ffd653466e284937896724b2dd044c9c&limit=20"}, "total_count": 132, "vpn_servers": [{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "client_authentication": [{"method": "certificate", "identity_provider": {"provider_type": "iam"}}], "client_auto_delete": true, "client_auto_delete_timeout": 1, "client_dns_server_ips": [{"address": "192.168.3.4"}], "client_idle_timeout": 600, "client_ip_pool": "172.16.0.0/16", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "lifecycle_state": "stable", "name": "my-vpn-server", "port": 443, "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_server", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}]}' responses.add(responses.GET, url, body=mock_response, @@ -22915,17 +25851,19 @@ def test_list_vpn_gateways_all_params(self): status=200) # Set up parameter values + name = 'testString' start = 'testString' limit = 1 resource_group_id = 'testString' - mode = 'route' + sort = 'name' # Invoke method - response = _service.list_vpn_gateways( + response = _service.list_vpn_servers( + name=name, start=start, limit=limit, resource_group_id=resource_group_id, - mode=mode, + sort=sort, headers={} ) @@ -22935,28 +25873,29 @@ def test_list_vpn_gateways_all_params(self): # Validate query params query_string = responses.calls[0].request.url.split('?',1)[1] query_string = urllib.parse.unquote_plus(query_string) + assert 'name={}'.format(name) in query_string assert 'start={}'.format(start) in query_string assert 'limit={}'.format(limit) in query_string assert 'resource_group.id={}'.format(resource_group_id) in query_string - assert 'mode={}'.format(mode) in query_string + assert 'sort={}'.format(sort) in query_string - def test_list_vpn_gateways_all_params_with_retries(self): - # Enable retries and run test_list_vpn_gateways_all_params. + def test_list_vpn_servers_all_params_with_retries(self): + # Enable retries and run test_list_vpn_servers_all_params. _service.enable_retries() - self.test_list_vpn_gateways_all_params() + self.test_list_vpn_servers_all_params() - # Disable retries and run test_list_vpn_gateways_all_params. + # Disable retries and run test_list_vpn_servers_all_params. _service.disable_retries() - self.test_list_vpn_gateways_all_params() + self.test_list_vpn_servers_all_params() @responses.activate - def test_list_vpn_gateways_required_params(self): + def test_list_vpn_servers_required_params(self): """ - test_list_vpn_gateways_required_params() + test_list_vpn_servers_required_params() """ # Set up mock - url = preprocess_url('/vpn_gateways') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132, "vpn_gateways": [{"connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "name": "my-vpn-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_gateway", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}]}' + url = preprocess_url('/vpn_servers') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers?start=ffd653466e284937896724b2dd044c9c&limit=20"}, "total_count": 132, "vpn_servers": [{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "client_authentication": [{"method": "certificate", "identity_provider": {"provider_type": "iam"}}], "client_auto_delete": true, "client_auto_delete_timeout": 1, "client_dns_server_ips": [{"address": "192.168.3.4"}], "client_idle_timeout": 600, "client_ip_pool": "172.16.0.0/16", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "lifecycle_state": "stable", "name": "my-vpn-server", "port": 443, "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_server", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}]}' responses.add(responses.GET, url, body=mock_response, @@ -22964,30 +25903,30 @@ def test_list_vpn_gateways_required_params(self): status=200) # Invoke method - response = _service.list_vpn_gateways() + response = _service.list_vpn_servers() # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 - def test_list_vpn_gateways_required_params_with_retries(self): - # Enable retries and run test_list_vpn_gateways_required_params. + def test_list_vpn_servers_required_params_with_retries(self): + # Enable retries and run test_list_vpn_servers_required_params. _service.enable_retries() - self.test_list_vpn_gateways_required_params() + self.test_list_vpn_servers_required_params() - # Disable retries and run test_list_vpn_gateways_required_params. + # Disable retries and run test_list_vpn_servers_required_params. _service.disable_retries() - self.test_list_vpn_gateways_required_params() + self.test_list_vpn_servers_required_params() @responses.activate - def test_list_vpn_gateways_value_error(self): + def test_list_vpn_servers_value_error(self): """ - test_list_vpn_gateways_value_error() + test_list_vpn_servers_value_error() """ # Set up mock - url = preprocess_url('/vpn_gateways') - mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways?start=9d5a91a3e2cbd233b5a5b33436855ed&limit=20"}, "total_count": 132, "vpn_gateways": [{"connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "name": "my-vpn-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_gateway", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}]}' + url = preprocess_url('/vpn_servers') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers?start=ffd653466e284937896724b2dd044c9c&limit=20"}, "total_count": 132, "vpn_servers": [{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "client_authentication": [{"method": "certificate", "identity_provider": {"provider_type": "iam"}}], "client_auto_delete": true, "client_auto_delete_timeout": 1, "client_dns_server_ips": [{"address": "192.168.3.4"}], "client_idle_timeout": 600, "client_ip_pool": "172.16.0.0/16", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "lifecycle_state": "stable", "name": "my-vpn-server", "port": 443, "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_server", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}]}' responses.add(responses.GET, url, body=mock_response, @@ -23000,58 +25939,94 @@ def test_list_vpn_gateways_value_error(self): for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_vpn_gateways(**req_copy) + _service.list_vpn_servers(**req_copy) - def test_list_vpn_gateways_value_error_with_retries(self): - # Enable retries and run test_list_vpn_gateways_value_error. + def test_list_vpn_servers_value_error_with_retries(self): + # Enable retries and run test_list_vpn_servers_value_error. _service.enable_retries() - self.test_list_vpn_gateways_value_error() + self.test_list_vpn_servers_value_error() - # Disable retries and run test_list_vpn_gateways_value_error. + # Disable retries and run test_list_vpn_servers_value_error. _service.disable_retries() - self.test_list_vpn_gateways_value_error() + self.test_list_vpn_servers_value_error() -class TestCreateVpnGateway(): +class TestCreateVpnServer(): """ - Test Class for create_vpn_gateway + Test Class for create_vpn_server """ @responses.activate - def test_create_vpn_gateway_all_params(self): + def test_create_vpn_server_all_params(self): """ - create_vpn_gateway() + create_vpn_server() """ # Set up mock - url = preprocess_url('/vpn_gateways') - mock_response = '{"connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "name": "my-vpn-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_gateway", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}' + url = preprocess_url('/vpn_servers') + mock_response = '{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "client_authentication": [{"method": "certificate", "identity_provider": {"provider_type": "iam"}}], "client_auto_delete": true, "client_auto_delete_timeout": 1, "client_dns_server_ips": [{"address": "192.168.3.4"}], "client_idle_timeout": 600, "client_ip_pool": "172.16.0.0/16", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "lifecycle_state": "stable", "name": "my-vpn-server", "port": 443, "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_server", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) - # Construct a dict representation of a ResourceGroupIdentityById model - resource_group_identity_model = {} - resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + # Construct a dict representation of a CertificateInstanceIdentityByCRN model + certificate_instance_identity_model = {} + certificate_instance_identity_model['crn'] = 'crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5' + + # Construct a dict representation of a VPNServerAuthenticationByUsernameIdProviderByIAM model + vpn_server_authentication_by_username_id_provider_model = {} + vpn_server_authentication_by_username_id_provider_model['provider_type'] = 'iam' + + # Construct a dict representation of a VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpn_server_authentication_prototype_model = {} + vpn_server_authentication_prototype_model['method'] = 'username' + vpn_server_authentication_prototype_model['identity_provider'] = vpn_server_authentication_by_username_id_provider_model # Construct a dict representation of a SubnetIdentityById model subnet_identity_model = {} subnet_identity_model['id'] = '7ec86020-1c6e-4889-b3f0-a15f2e50f87e' - # Construct a dict representation of a VPNGatewayPrototypeVPNGatewayRouteModePrototype model - vpn_gateway_prototype_model = {} - vpn_gateway_prototype_model['name'] = 'my-vpn-gateway' - vpn_gateway_prototype_model['resource_group'] = resource_group_identity_model - vpn_gateway_prototype_model['subnet'] = subnet_identity_model - vpn_gateway_prototype_model['mode'] = 'route' + # Construct a dict representation of a IP model + ip_model = {} + ip_model['address'] = '192.168.3.4' + + # Construct a dict representation of a ResourceGroupIdentityById model + resource_group_identity_model = {} + resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + + # Construct a dict representation of a SecurityGroupIdentityById model + security_group_identity_model = {} + security_group_identity_model['id'] = 'be5df5ca-12a0-494b-907e-aa6ec2bfa271' # Set up parameter values - vpn_gateway_prototype = vpn_gateway_prototype_model + certificate = certificate_instance_identity_model + client_authentication = [vpn_server_authentication_prototype_model] + client_ip_pool = '172.16.0.0/16' + subnets = [subnet_identity_model] + client_dns_server_ips = [ip_model] + client_idle_timeout = 600 + enable_split_tunneling = False + name = 'my-vpn-server' + port = 443 + protocol = 'udp' + resource_group = resource_group_identity_model + security_groups = [security_group_identity_model] # Invoke method - response = _service.create_vpn_gateway( - vpn_gateway_prototype, + response = _service.create_vpn_server( + certificate, + client_authentication, + client_ip_pool, + subnets, + client_dns_server_ips=client_dns_server_ips, + client_idle_timeout=client_idle_timeout, + enable_split_tunneling=enable_split_tunneling, + name=name, + port=port, + protocol=protocol, + resource_group=resource_group, + security_groups=security_groups, headers={} ) @@ -23060,90 +26035,131 @@ def test_create_vpn_gateway_all_params(self): assert response.status_code == 201 # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == vpn_gateway_prototype + assert req_body['certificate'] == certificate_instance_identity_model + assert req_body['client_authentication'] == [vpn_server_authentication_prototype_model] + assert req_body['client_ip_pool'] == '172.16.0.0/16' + assert req_body['subnets'] == [subnet_identity_model] + assert req_body['client_dns_server_ips'] == [ip_model] + assert req_body['client_idle_timeout'] == 600 + assert req_body['enable_split_tunneling'] == False + assert req_body['name'] == 'my-vpn-server' + assert req_body['port'] == 443 + assert req_body['protocol'] == 'udp' + assert req_body['resource_group'] == resource_group_identity_model + assert req_body['security_groups'] == [security_group_identity_model] - def test_create_vpn_gateway_all_params_with_retries(self): - # Enable retries and run test_create_vpn_gateway_all_params. + def test_create_vpn_server_all_params_with_retries(self): + # Enable retries and run test_create_vpn_server_all_params. _service.enable_retries() - self.test_create_vpn_gateway_all_params() + self.test_create_vpn_server_all_params() - # Disable retries and run test_create_vpn_gateway_all_params. + # Disable retries and run test_create_vpn_server_all_params. _service.disable_retries() - self.test_create_vpn_gateway_all_params() + self.test_create_vpn_server_all_params() @responses.activate - def test_create_vpn_gateway_value_error(self): + def test_create_vpn_server_value_error(self): """ - test_create_vpn_gateway_value_error() + test_create_vpn_server_value_error() """ # Set up mock - url = preprocess_url('/vpn_gateways') - mock_response = '{"connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "name": "my-vpn-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_gateway", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}' + url = preprocess_url('/vpn_servers') + mock_response = '{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "client_authentication": [{"method": "certificate", "identity_provider": {"provider_type": "iam"}}], "client_auto_delete": true, "client_auto_delete_timeout": 1, "client_dns_server_ips": [{"address": "192.168.3.4"}], "client_idle_timeout": 600, "client_ip_pool": "172.16.0.0/16", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "lifecycle_state": "stable", "name": "my-vpn-server", "port": 443, "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_server", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' responses.add(responses.POST, url, body=mock_response, content_type='application/json', status=201) - # Construct a dict representation of a ResourceGroupIdentityById model - resource_group_identity_model = {} - resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + # Construct a dict representation of a CertificateInstanceIdentityByCRN model + certificate_instance_identity_model = {} + certificate_instance_identity_model['crn'] = 'crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5' + + # Construct a dict representation of a VPNServerAuthenticationByUsernameIdProviderByIAM model + vpn_server_authentication_by_username_id_provider_model = {} + vpn_server_authentication_by_username_id_provider_model['provider_type'] = 'iam' + + # Construct a dict representation of a VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpn_server_authentication_prototype_model = {} + vpn_server_authentication_prototype_model['method'] = 'username' + vpn_server_authentication_prototype_model['identity_provider'] = vpn_server_authentication_by_username_id_provider_model # Construct a dict representation of a SubnetIdentityById model subnet_identity_model = {} subnet_identity_model['id'] = '7ec86020-1c6e-4889-b3f0-a15f2e50f87e' - # Construct a dict representation of a VPNGatewayPrototypeVPNGatewayRouteModePrototype model - vpn_gateway_prototype_model = {} - vpn_gateway_prototype_model['name'] = 'my-vpn-gateway' - vpn_gateway_prototype_model['resource_group'] = resource_group_identity_model - vpn_gateway_prototype_model['subnet'] = subnet_identity_model - vpn_gateway_prototype_model['mode'] = 'route' + # Construct a dict representation of a IP model + ip_model = {} + ip_model['address'] = '192.168.3.4' + + # Construct a dict representation of a ResourceGroupIdentityById model + resource_group_identity_model = {} + resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + + # Construct a dict representation of a SecurityGroupIdentityById model + security_group_identity_model = {} + security_group_identity_model['id'] = 'be5df5ca-12a0-494b-907e-aa6ec2bfa271' # Set up parameter values - vpn_gateway_prototype = vpn_gateway_prototype_model + certificate = certificate_instance_identity_model + client_authentication = [vpn_server_authentication_prototype_model] + client_ip_pool = '172.16.0.0/16' + subnets = [subnet_identity_model] + client_dns_server_ips = [ip_model] + client_idle_timeout = 600 + enable_split_tunneling = False + name = 'my-vpn-server' + port = 443 + protocol = 'udp' + resource_group = resource_group_identity_model + security_groups = [security_group_identity_model] # Pass in all but one required param and check for a ValueError req_param_dict = { - "vpn_gateway_prototype": vpn_gateway_prototype, + "certificate": certificate, + "client_authentication": client_authentication, + "client_ip_pool": client_ip_pool, + "subnets": subnets, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.create_vpn_gateway(**req_copy) + _service.create_vpn_server(**req_copy) - def test_create_vpn_gateway_value_error_with_retries(self): - # Enable retries and run test_create_vpn_gateway_value_error. + def test_create_vpn_server_value_error_with_retries(self): + # Enable retries and run test_create_vpn_server_value_error. _service.enable_retries() - self.test_create_vpn_gateway_value_error() + self.test_create_vpn_server_value_error() - # Disable retries and run test_create_vpn_gateway_value_error. + # Disable retries and run test_create_vpn_server_value_error. _service.disable_retries() - self.test_create_vpn_gateway_value_error() + self.test_create_vpn_server_value_error() -class TestDeleteVpnGateway(): +class TestDeleteVpnServer(): """ - Test Class for delete_vpn_gateway + Test Class for delete_vpn_server """ @responses.activate - def test_delete_vpn_gateway_all_params(self): + def test_delete_vpn_server_all_params(self): """ - delete_vpn_gateway() + delete_vpn_server() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString') + url = preprocess_url('/vpn_servers/testString') responses.add(responses.DELETE, url, status=202) # Set up parameter values id = 'testString' + if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"' # Invoke method - response = _service.delete_vpn_gateway( + response = _service.delete_vpn_server( id, + if_match=if_match, headers={} ) @@ -23151,22 +26167,22 @@ def test_delete_vpn_gateway_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 202 - def test_delete_vpn_gateway_all_params_with_retries(self): - # Enable retries and run test_delete_vpn_gateway_all_params. + def test_delete_vpn_server_all_params_with_retries(self): + # Enable retries and run test_delete_vpn_server_all_params. _service.enable_retries() - self.test_delete_vpn_gateway_all_params() + self.test_delete_vpn_server_all_params() - # Disable retries and run test_delete_vpn_gateway_all_params. + # Disable retries and run test_delete_vpn_server_all_params. _service.disable_retries() - self.test_delete_vpn_gateway_all_params() + self.test_delete_vpn_server_all_params() @responses.activate - def test_delete_vpn_gateway_value_error(self): + def test_delete_vpn_server_required_params(self): """ - test_delete_vpn_gateway_value_error() + test_delete_vpn_server_required_params() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString') + url = preprocess_url('/vpn_servers/testString') responses.add(responses.DELETE, url, status=202) @@ -23174,249 +26190,71 @@ def test_delete_vpn_gateway_value_error(self): # Set up parameter values id = 'testString' - # Pass in all but one required param and check for a ValueError - req_param_dict = { - "id": id, - } - for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} - with pytest.raises(ValueError): - _service.delete_vpn_gateway(**req_copy) - - - def test_delete_vpn_gateway_value_error_with_retries(self): - # Enable retries and run test_delete_vpn_gateway_value_error. - _service.enable_retries() - self.test_delete_vpn_gateway_value_error() - - # Disable retries and run test_delete_vpn_gateway_value_error. - _service.disable_retries() - self.test_delete_vpn_gateway_value_error() - -class TestGetVpnGateway(): - """ - Test Class for get_vpn_gateway - """ - - @responses.activate - def test_get_vpn_gateway_all_params(self): - """ - get_vpn_gateway() - """ - # Set up mock - url = preprocess_url('/vpn_gateways/testString') - mock_response = '{"connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "name": "my-vpn-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_gateway", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) - - # Set up parameter values - id = 'testString' - - # Invoke method - response = _service.get_vpn_gateway( - id, - headers={} - ) - - # Check for correct operation - assert len(responses.calls) == 1 - assert response.status_code == 200 - - def test_get_vpn_gateway_all_params_with_retries(self): - # Enable retries and run test_get_vpn_gateway_all_params. - _service.enable_retries() - self.test_get_vpn_gateway_all_params() - - # Disable retries and run test_get_vpn_gateway_all_params. - _service.disable_retries() - self.test_get_vpn_gateway_all_params() - - @responses.activate - def test_get_vpn_gateway_value_error(self): - """ - test_get_vpn_gateway_value_error() - """ - # Set up mock - url = preprocess_url('/vpn_gateways/testString') - mock_response = '{"connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "name": "my-vpn-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_gateway", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) - - # Set up parameter values - id = 'testString' - - # Pass in all but one required param and check for a ValueError - req_param_dict = { - "id": id, - } - for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} - with pytest.raises(ValueError): - _service.get_vpn_gateway(**req_copy) - - - def test_get_vpn_gateway_value_error_with_retries(self): - # Enable retries and run test_get_vpn_gateway_value_error. - _service.enable_retries() - self.test_get_vpn_gateway_value_error() - - # Disable retries and run test_get_vpn_gateway_value_error. - _service.disable_retries() - self.test_get_vpn_gateway_value_error() - -class TestUpdateVpnGateway(): - """ - Test Class for update_vpn_gateway - """ - - @responses.activate - def test_update_vpn_gateway_all_params(self): - """ - update_vpn_gateway() - """ - # Set up mock - url = preprocess_url('/vpn_gateways/testString') - mock_response = '{"connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "name": "my-vpn-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_gateway", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}' - responses.add(responses.PATCH, - url, - body=mock_response, - content_type='application/json', - status=200) - - # Construct a dict representation of a VPNGatewayPatch model - vpn_gateway_patch_model = {} - vpn_gateway_patch_model['name'] = 'my-vpn-gateway' - - # Set up parameter values - id = 'testString' - vpn_gateway_patch = vpn_gateway_patch_model - # Invoke method - response = _service.update_vpn_gateway( + response = _service.delete_vpn_server( id, - vpn_gateway_patch, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 200 - # Validate body params - req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == vpn_gateway_patch - - def test_update_vpn_gateway_all_params_with_retries(self): - # Enable retries and run test_update_vpn_gateway_all_params. - _service.enable_retries() - self.test_update_vpn_gateway_all_params() - - # Disable retries and run test_update_vpn_gateway_all_params. - _service.disable_retries() - self.test_update_vpn_gateway_all_params() - - @responses.activate - def test_update_vpn_gateway_value_error(self): - """ - test_update_vpn_gateway_value_error() - """ - # Set up mock - url = preprocess_url('/vpn_gateways/testString') - mock_response = '{"connections": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "name": "my-vpn-connection", "resource_type": "vpn_gateway_connection"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "name": "my-vpn-gateway", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_gateway", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}' - responses.add(responses.PATCH, - url, - body=mock_response, - content_type='application/json', - status=200) - - # Construct a dict representation of a VPNGatewayPatch model - vpn_gateway_patch_model = {} - vpn_gateway_patch_model['name'] = 'my-vpn-gateway' - - # Set up parameter values - id = 'testString' - vpn_gateway_patch = vpn_gateway_patch_model - - # Pass in all but one required param and check for a ValueError - req_param_dict = { - "id": id, - "vpn_gateway_patch": vpn_gateway_patch, - } - for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} - with pytest.raises(ValueError): - _service.update_vpn_gateway(**req_copy) - + assert response.status_code == 202 - def test_update_vpn_gateway_value_error_with_retries(self): - # Enable retries and run test_update_vpn_gateway_value_error. + def test_delete_vpn_server_required_params_with_retries(self): + # Enable retries and run test_delete_vpn_server_required_params. _service.enable_retries() - self.test_update_vpn_gateway_value_error() + self.test_delete_vpn_server_required_params() - # Disable retries and run test_update_vpn_gateway_value_error. + # Disable retries and run test_delete_vpn_server_required_params. _service.disable_retries() - self.test_update_vpn_gateway_value_error() - -class TestListVpnGatewayConnections(): - """ - Test Class for list_vpn_gateway_connections - """ + self.test_delete_vpn_server_required_params() @responses.activate - def test_list_vpn_gateway_connections_all_params(self): + def test_delete_vpn_server_value_error(self): """ - list_vpn_gateway_connections() + test_delete_vpn_server_value_error() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections') - mock_response = '{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}' - responses.add(responses.GET, + url = preprocess_url('/vpn_servers/testString') + responses.add(responses.DELETE, url, - body=mock_response, - content_type='application/json', - status=200) - - # Set up parameter values - vpn_gateway_id = 'testString' - status = 'testString' - - # Invoke method - response = _service.list_vpn_gateway_connections( - vpn_gateway_id, - status=status, - headers={} - ) + status=202) - # Check for correct operation - assert len(responses.calls) == 1 - assert response.status_code == 200 - # Validate query params - query_string = responses.calls[0].request.url.split('?',1)[1] - query_string = urllib.parse.unquote_plus(query_string) - assert 'status={}'.format(status) in query_string + # Set up parameter values + id = 'testString' - def test_list_vpn_gateway_connections_all_params_with_retries(self): - # Enable retries and run test_list_vpn_gateway_connections_all_params. + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "id": id, + } + for param in req_param_dict.keys(): + req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.delete_vpn_server(**req_copy) + + + def test_delete_vpn_server_value_error_with_retries(self): + # Enable retries and run test_delete_vpn_server_value_error. _service.enable_retries() - self.test_list_vpn_gateway_connections_all_params() + self.test_delete_vpn_server_value_error() - # Disable retries and run test_list_vpn_gateway_connections_all_params. + # Disable retries and run test_delete_vpn_server_value_error. _service.disable_retries() - self.test_list_vpn_gateway_connections_all_params() + self.test_delete_vpn_server_value_error() + +class TestGetVpnServer(): + """ + Test Class for get_vpn_server + """ @responses.activate - def test_list_vpn_gateway_connections_required_params(self): + def test_get_vpn_server_all_params(self): """ - test_list_vpn_gateway_connections_required_params() + get_vpn_server() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections') - mock_response = '{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}' + url = preprocess_url('/vpn_servers/testString') + mock_response = '{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "client_authentication": [{"method": "certificate", "identity_provider": {"provider_type": "iam"}}], "client_auto_delete": true, "client_auto_delete_timeout": 1, "client_dns_server_ips": [{"address": "192.168.3.4"}], "client_idle_timeout": 600, "client_ip_pool": "172.16.0.0/16", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "lifecycle_state": "stable", "name": "my-vpn-server", "port": 443, "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_server", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' responses.add(responses.GET, url, body=mock_response, @@ -23424,11 +26262,11 @@ def test_list_vpn_gateway_connections_required_params(self): status=200) # Set up parameter values - vpn_gateway_id = 'testString' + id = 'testString' # Invoke method - response = _service.list_vpn_gateway_connections( - vpn_gateway_id, + response = _service.get_vpn_server( + id, headers={} ) @@ -23436,23 +26274,23 @@ def test_list_vpn_gateway_connections_required_params(self): assert len(responses.calls) == 1 assert response.status_code == 200 - def test_list_vpn_gateway_connections_required_params_with_retries(self): - # Enable retries and run test_list_vpn_gateway_connections_required_params. + def test_get_vpn_server_all_params_with_retries(self): + # Enable retries and run test_get_vpn_server_all_params. _service.enable_retries() - self.test_list_vpn_gateway_connections_required_params() + self.test_get_vpn_server_all_params() - # Disable retries and run test_list_vpn_gateway_connections_required_params. + # Disable retries and run test_get_vpn_server_all_params. _service.disable_retries() - self.test_list_vpn_gateway_connections_required_params() + self.test_get_vpn_server_all_params() @responses.activate - def test_list_vpn_gateway_connections_value_error(self): + def test_get_vpn_server_value_error(self): """ - test_list_vpn_gateway_connections_value_error() + test_get_vpn_server_value_error() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections') - mock_response = '{"connections": [{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}' + url = preprocess_url('/vpn_servers/testString') + mock_response = '{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "client_authentication": [{"method": "certificate", "identity_provider": {"provider_type": "iam"}}], "client_auto_delete": true, "client_auto_delete_timeout": 1, "client_dns_server_ips": [{"address": "192.168.3.4"}], "client_idle_timeout": 600, "client_ip_pool": "172.16.0.0/16", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "lifecycle_state": "stable", "name": "my-vpn-server", "port": 443, "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_server", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' responses.add(responses.GET, url, body=mock_response, @@ -23460,262 +26298,280 @@ def test_list_vpn_gateway_connections_value_error(self): status=200) # Set up parameter values - vpn_gateway_id = 'testString' + id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "vpn_gateway_id": vpn_gateway_id, + "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_vpn_gateway_connections(**req_copy) + _service.get_vpn_server(**req_copy) - def test_list_vpn_gateway_connections_value_error_with_retries(self): - # Enable retries and run test_list_vpn_gateway_connections_value_error. + def test_get_vpn_server_value_error_with_retries(self): + # Enable retries and run test_get_vpn_server_value_error. _service.enable_retries() - self.test_list_vpn_gateway_connections_value_error() + self.test_get_vpn_server_value_error() - # Disable retries and run test_list_vpn_gateway_connections_value_error. + # Disable retries and run test_get_vpn_server_value_error. _service.disable_retries() - self.test_list_vpn_gateway_connections_value_error() + self.test_get_vpn_server_value_error() -class TestCreateVpnGatewayConnection(): +class TestUpdateVpnServer(): """ - Test Class for create_vpn_gateway_connection + Test Class for update_vpn_server """ @responses.activate - def test_create_vpn_gateway_connection_all_params(self): + def test_update_vpn_server_all_params(self): """ - create_vpn_gateway_connection() + update_vpn_server() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections') - mock_response = '{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}' - responses.add(responses.POST, + url = preprocess_url('/vpn_servers/testString') + mock_response = '{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "client_authentication": [{"method": "certificate", "identity_provider": {"provider_type": "iam"}}], "client_auto_delete": true, "client_auto_delete_timeout": 1, "client_dns_server_ips": [{"address": "192.168.3.4"}], "client_idle_timeout": 600, "client_ip_pool": "172.16.0.0/16", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "lifecycle_state": "stable", "name": "my-vpn-server", "port": 443, "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_server", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' + responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', - status=201) + status=200) - # Construct a dict representation of a VPNGatewayConnectionDPDPrototype model - vpn_gateway_connection_dpd_prototype_model = {} - vpn_gateway_connection_dpd_prototype_model['action'] = 'restart' - vpn_gateway_connection_dpd_prototype_model['interval'] = 30 - vpn_gateway_connection_dpd_prototype_model['timeout'] = 120 + # Construct a dict representation of a CertificateInstanceIdentityByCRN model + certificate_instance_identity_model = {} + certificate_instance_identity_model['crn'] = 'crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5' - # Construct a dict representation of a VPNGatewayConnectionIKEPolicyPrototypeIKEPolicyIdentityById model - vpn_gateway_connection_ike_policy_prototype_model = {} - vpn_gateway_connection_ike_policy_prototype_model['id'] = 'ddf51bec-3424-11e8-b467-0ed5f89f718b' + # Construct a dict representation of a VPNServerAuthenticationByUsernameIdProviderByIAM model + vpn_server_authentication_by_username_id_provider_model = {} + vpn_server_authentication_by_username_id_provider_model['provider_type'] = 'iam' - # Construct a dict representation of a VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityById model - vpn_gateway_connection_i_psec_policy_prototype_model = {} - vpn_gateway_connection_i_psec_policy_prototype_model['id'] = 'ddf51bec-3424-11e8-b467-0ed5f89f718b' + # Construct a dict representation of a VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpn_server_authentication_prototype_model = {} + vpn_server_authentication_prototype_model['method'] = 'username' + vpn_server_authentication_prototype_model['identity_provider'] = vpn_server_authentication_by_username_id_provider_model - # Construct a dict representation of a VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype model - vpn_gateway_connection_prototype_model = {} - vpn_gateway_connection_prototype_model['admin_state_up'] = True - vpn_gateway_connection_prototype_model['dead_peer_detection'] = vpn_gateway_connection_dpd_prototype_model - vpn_gateway_connection_prototype_model['ike_policy'] = vpn_gateway_connection_ike_policy_prototype_model - vpn_gateway_connection_prototype_model['ipsec_policy'] = vpn_gateway_connection_i_psec_policy_prototype_model - vpn_gateway_connection_prototype_model['name'] = 'my-vpn-connection' - vpn_gateway_connection_prototype_model['peer_address'] = '169.21.50.5' - vpn_gateway_connection_prototype_model['psk'] = 'lkj14b1oi0alcniejkso' - vpn_gateway_connection_prototype_model['routing_protocol'] = 'none' + # Construct a dict representation of a IP model + ip_model = {} + ip_model['address'] = '192.168.3.4' + + # Construct a dict representation of a SubnetIdentityById model + subnet_identity_model = {} + subnet_identity_model['id'] = '7ec86020-1c6e-4889-b3f0-a15f2e50f87e' + + # Construct a dict representation of a VPNServerPatch model + vpn_server_patch_model = {} + vpn_server_patch_model['certificate'] = certificate_instance_identity_model + vpn_server_patch_model['client_authentication'] = [vpn_server_authentication_prototype_model] + vpn_server_patch_model['client_dns_server_ips'] = [ip_model] + vpn_server_patch_model['client_idle_timeout'] = 600 + vpn_server_patch_model['client_ip_pool'] = '172.16.0.0/16' + vpn_server_patch_model['enable_split_tunneling'] = True + vpn_server_patch_model['name'] = 'my-vpn-server' + vpn_server_patch_model['port'] = 443 + vpn_server_patch_model['protocol'] = 'udp' + vpn_server_patch_model['subnets'] = [subnet_identity_model] # Set up parameter values - vpn_gateway_id = 'testString' - vpn_gateway_connection_prototype = vpn_gateway_connection_prototype_model + id = 'testString' + vpn_server_patch = vpn_server_patch_model + if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"' # Invoke method - response = _service.create_vpn_gateway_connection( - vpn_gateway_id, - vpn_gateway_connection_prototype, + response = _service.update_vpn_server( + id, + vpn_server_patch, + if_match=if_match, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 201 + assert response.status_code == 200 # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == vpn_gateway_connection_prototype + assert req_body == vpn_server_patch - def test_create_vpn_gateway_connection_all_params_with_retries(self): - # Enable retries and run test_create_vpn_gateway_connection_all_params. + def test_update_vpn_server_all_params_with_retries(self): + # Enable retries and run test_update_vpn_server_all_params. _service.enable_retries() - self.test_create_vpn_gateway_connection_all_params() + self.test_update_vpn_server_all_params() - # Disable retries and run test_create_vpn_gateway_connection_all_params. + # Disable retries and run test_update_vpn_server_all_params. _service.disable_retries() - self.test_create_vpn_gateway_connection_all_params() + self.test_update_vpn_server_all_params() @responses.activate - def test_create_vpn_gateway_connection_value_error(self): + def test_update_vpn_server_required_params(self): """ - test_create_vpn_gateway_connection_value_error() + test_update_vpn_server_required_params() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections') - mock_response = '{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}' - responses.add(responses.POST, + url = preprocess_url('/vpn_servers/testString') + mock_response = '{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "client_authentication": [{"method": "certificate", "identity_provider": {"provider_type": "iam"}}], "client_auto_delete": true, "client_auto_delete_timeout": 1, "client_dns_server_ips": [{"address": "192.168.3.4"}], "client_idle_timeout": 600, "client_ip_pool": "172.16.0.0/16", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "lifecycle_state": "stable", "name": "my-vpn-server", "port": 443, "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_server", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' + responses.add(responses.PATCH, url, body=mock_response, content_type='application/json', - status=201) - - # Construct a dict representation of a VPNGatewayConnectionDPDPrototype model - vpn_gateway_connection_dpd_prototype_model = {} - vpn_gateway_connection_dpd_prototype_model['action'] = 'restart' - vpn_gateway_connection_dpd_prototype_model['interval'] = 30 - vpn_gateway_connection_dpd_prototype_model['timeout'] = 120 - - # Construct a dict representation of a VPNGatewayConnectionIKEPolicyPrototypeIKEPolicyIdentityById model - vpn_gateway_connection_ike_policy_prototype_model = {} - vpn_gateway_connection_ike_policy_prototype_model['id'] = 'ddf51bec-3424-11e8-b467-0ed5f89f718b' - - # Construct a dict representation of a VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityById model - vpn_gateway_connection_i_psec_policy_prototype_model = {} - vpn_gateway_connection_i_psec_policy_prototype_model['id'] = 'ddf51bec-3424-11e8-b467-0ed5f89f718b' - - # Construct a dict representation of a VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype model - vpn_gateway_connection_prototype_model = {} - vpn_gateway_connection_prototype_model['admin_state_up'] = True - vpn_gateway_connection_prototype_model['dead_peer_detection'] = vpn_gateway_connection_dpd_prototype_model - vpn_gateway_connection_prototype_model['ike_policy'] = vpn_gateway_connection_ike_policy_prototype_model - vpn_gateway_connection_prototype_model['ipsec_policy'] = vpn_gateway_connection_i_psec_policy_prototype_model - vpn_gateway_connection_prototype_model['name'] = 'my-vpn-connection' - vpn_gateway_connection_prototype_model['peer_address'] = '169.21.50.5' - vpn_gateway_connection_prototype_model['psk'] = 'lkj14b1oi0alcniejkso' - vpn_gateway_connection_prototype_model['routing_protocol'] = 'none' - - # Set up parameter values - vpn_gateway_id = 'testString' - vpn_gateway_connection_prototype = vpn_gateway_connection_prototype_model + status=200) - # Pass in all but one required param and check for a ValueError - req_param_dict = { - "vpn_gateway_id": vpn_gateway_id, - "vpn_gateway_connection_prototype": vpn_gateway_connection_prototype, - } - for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} - with pytest.raises(ValueError): - _service.create_vpn_gateway_connection(**req_copy) + # Construct a dict representation of a CertificateInstanceIdentityByCRN model + certificate_instance_identity_model = {} + certificate_instance_identity_model['crn'] = 'crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5' + # Construct a dict representation of a VPNServerAuthenticationByUsernameIdProviderByIAM model + vpn_server_authentication_by_username_id_provider_model = {} + vpn_server_authentication_by_username_id_provider_model['provider_type'] = 'iam' - def test_create_vpn_gateway_connection_value_error_with_retries(self): - # Enable retries and run test_create_vpn_gateway_connection_value_error. - _service.enable_retries() - self.test_create_vpn_gateway_connection_value_error() + # Construct a dict representation of a VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpn_server_authentication_prototype_model = {} + vpn_server_authentication_prototype_model['method'] = 'username' + vpn_server_authentication_prototype_model['identity_provider'] = vpn_server_authentication_by_username_id_provider_model - # Disable retries and run test_create_vpn_gateway_connection_value_error. - _service.disable_retries() - self.test_create_vpn_gateway_connection_value_error() + # Construct a dict representation of a IP model + ip_model = {} + ip_model['address'] = '192.168.3.4' -class TestDeleteVpnGatewayConnection(): - """ - Test Class for delete_vpn_gateway_connection - """ + # Construct a dict representation of a SubnetIdentityById model + subnet_identity_model = {} + subnet_identity_model['id'] = '7ec86020-1c6e-4889-b3f0-a15f2e50f87e' - @responses.activate - def test_delete_vpn_gateway_connection_all_params(self): - """ - delete_vpn_gateway_connection() - """ - # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections/testString') - responses.add(responses.DELETE, - url, - status=202) + # Construct a dict representation of a VPNServerPatch model + vpn_server_patch_model = {} + vpn_server_patch_model['certificate'] = certificate_instance_identity_model + vpn_server_patch_model['client_authentication'] = [vpn_server_authentication_prototype_model] + vpn_server_patch_model['client_dns_server_ips'] = [ip_model] + vpn_server_patch_model['client_idle_timeout'] = 600 + vpn_server_patch_model['client_ip_pool'] = '172.16.0.0/16' + vpn_server_patch_model['enable_split_tunneling'] = True + vpn_server_patch_model['name'] = 'my-vpn-server' + vpn_server_patch_model['port'] = 443 + vpn_server_patch_model['protocol'] = 'udp' + vpn_server_patch_model['subnets'] = [subnet_identity_model] # Set up parameter values - vpn_gateway_id = 'testString' id = 'testString' + vpn_server_patch = vpn_server_patch_model # Invoke method - response = _service.delete_vpn_gateway_connection( - vpn_gateway_id, + response = _service.update_vpn_server( id, + vpn_server_patch, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 202 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body == vpn_server_patch - def test_delete_vpn_gateway_connection_all_params_with_retries(self): - # Enable retries and run test_delete_vpn_gateway_connection_all_params. + def test_update_vpn_server_required_params_with_retries(self): + # Enable retries and run test_update_vpn_server_required_params. _service.enable_retries() - self.test_delete_vpn_gateway_connection_all_params() + self.test_update_vpn_server_required_params() - # Disable retries and run test_delete_vpn_gateway_connection_all_params. + # Disable retries and run test_update_vpn_server_required_params. _service.disable_retries() - self.test_delete_vpn_gateway_connection_all_params() + self.test_update_vpn_server_required_params() @responses.activate - def test_delete_vpn_gateway_connection_value_error(self): + def test_update_vpn_server_value_error(self): """ - test_delete_vpn_gateway_connection_value_error() + test_update_vpn_server_value_error() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections/testString') - responses.add(responses.DELETE, + url = preprocess_url('/vpn_servers/testString') + mock_response = '{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "client_authentication": [{"method": "certificate", "identity_provider": {"provider_type": "iam"}}], "client_auto_delete": true, "client_auto_delete_timeout": 1, "client_dns_server_ips": [{"address": "192.168.3.4"}], "client_idle_timeout": 600, "client_ip_pool": "172.16.0.0/16", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "lifecycle_state": "stable", "name": "my-vpn-server", "port": 443, "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_server", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}' + responses.add(responses.PATCH, url, - status=202) + body=mock_response, + content_type='application/json', + status=200) + + # Construct a dict representation of a CertificateInstanceIdentityByCRN model + certificate_instance_identity_model = {} + certificate_instance_identity_model['crn'] = 'crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5' + + # Construct a dict representation of a VPNServerAuthenticationByUsernameIdProviderByIAM model + vpn_server_authentication_by_username_id_provider_model = {} + vpn_server_authentication_by_username_id_provider_model['provider_type'] = 'iam' + + # Construct a dict representation of a VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpn_server_authentication_prototype_model = {} + vpn_server_authentication_prototype_model['method'] = 'username' + vpn_server_authentication_prototype_model['identity_provider'] = vpn_server_authentication_by_username_id_provider_model + + # Construct a dict representation of a IP model + ip_model = {} + ip_model['address'] = '192.168.3.4' + + # Construct a dict representation of a SubnetIdentityById model + subnet_identity_model = {} + subnet_identity_model['id'] = '7ec86020-1c6e-4889-b3f0-a15f2e50f87e' + + # Construct a dict representation of a VPNServerPatch model + vpn_server_patch_model = {} + vpn_server_patch_model['certificate'] = certificate_instance_identity_model + vpn_server_patch_model['client_authentication'] = [vpn_server_authentication_prototype_model] + vpn_server_patch_model['client_dns_server_ips'] = [ip_model] + vpn_server_patch_model['client_idle_timeout'] = 600 + vpn_server_patch_model['client_ip_pool'] = '172.16.0.0/16' + vpn_server_patch_model['enable_split_tunneling'] = True + vpn_server_patch_model['name'] = 'my-vpn-server' + vpn_server_patch_model['port'] = 443 + vpn_server_patch_model['protocol'] = 'udp' + vpn_server_patch_model['subnets'] = [subnet_identity_model] # Set up parameter values - vpn_gateway_id = 'testString' id = 'testString' + vpn_server_patch = vpn_server_patch_model # Pass in all but one required param and check for a ValueError req_param_dict = { - "vpn_gateway_id": vpn_gateway_id, "id": id, + "vpn_server_patch": vpn_server_patch, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.delete_vpn_gateway_connection(**req_copy) + _service.update_vpn_server(**req_copy) - def test_delete_vpn_gateway_connection_value_error_with_retries(self): - # Enable retries and run test_delete_vpn_gateway_connection_value_error. + def test_update_vpn_server_value_error_with_retries(self): + # Enable retries and run test_update_vpn_server_value_error. _service.enable_retries() - self.test_delete_vpn_gateway_connection_value_error() + self.test_update_vpn_server_value_error() - # Disable retries and run test_delete_vpn_gateway_connection_value_error. + # Disable retries and run test_update_vpn_server_value_error. _service.disable_retries() - self.test_delete_vpn_gateway_connection_value_error() + self.test_update_vpn_server_value_error() -class TestGetVpnGatewayConnection(): +class TestGetVpnServerClientConfiguration(): """ - Test Class for get_vpn_gateway_connection + Test Class for get_vpn_server_client_configuration """ @responses.activate - def test_get_vpn_gateway_connection_all_params(self): + def test_get_vpn_server_client_configuration_all_params(self): """ - get_vpn_gateway_connection() + get_vpn_server_client_configuration() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections/testString') - mock_response = '{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}' + url = preprocess_url('/vpn_servers/testString/client_configuration') + mock_response = '"client\nproto udp\nremote a8506291.us-south.vpn-server.appdomain.cloud\nport 443\n\ndev tun\nnobind\n\n-----BEGIN CERTIFICATE-----\nxxxxxx\n-----END CERTIFICATE-----\n"' responses.add(responses.GET, url, body=mock_response, - content_type='application/json', + content_type='text/plain', status=200) # Set up parameter values - vpn_gateway_id = 'testString' id = 'testString' # Invoke method - response = _service.get_vpn_gateway_connection( - vpn_gateway_id, + response = _service.get_vpn_server_client_configuration( id, headers={} ) @@ -23724,854 +26580,879 @@ def test_get_vpn_gateway_connection_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 200 - def test_get_vpn_gateway_connection_all_params_with_retries(self): - # Enable retries and run test_get_vpn_gateway_connection_all_params. + def test_get_vpn_server_client_configuration_all_params_with_retries(self): + # Enable retries and run test_get_vpn_server_client_configuration_all_params. _service.enable_retries() - self.test_get_vpn_gateway_connection_all_params() + self.test_get_vpn_server_client_configuration_all_params() - # Disable retries and run test_get_vpn_gateway_connection_all_params. + # Disable retries and run test_get_vpn_server_client_configuration_all_params. _service.disable_retries() - self.test_get_vpn_gateway_connection_all_params() + self.test_get_vpn_server_client_configuration_all_params() @responses.activate - def test_get_vpn_gateway_connection_value_error(self): + def test_get_vpn_server_client_configuration_value_error(self): """ - test_get_vpn_gateway_connection_value_error() + test_get_vpn_server_client_configuration_value_error() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections/testString') - mock_response = '{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}' + url = preprocess_url('/vpn_servers/testString/client_configuration') + mock_response = '"client\nproto udp\nremote a8506291.us-south.vpn-server.appdomain.cloud\nport 443\n\ndev tun\nnobind\n\n-----BEGIN CERTIFICATE-----\nxxxxxx\n-----END CERTIFICATE-----\n"' responses.add(responses.GET, url, body=mock_response, - content_type='application/json', + content_type='text/plain', status=200) # Set up parameter values - vpn_gateway_id = 'testString' id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "vpn_gateway_id": vpn_gateway_id, "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.get_vpn_gateway_connection(**req_copy) + _service.get_vpn_server_client_configuration(**req_copy) - def test_get_vpn_gateway_connection_value_error_with_retries(self): - # Enable retries and run test_get_vpn_gateway_connection_value_error. + def test_get_vpn_server_client_configuration_value_error_with_retries(self): + # Enable retries and run test_get_vpn_server_client_configuration_value_error. _service.enable_retries() - self.test_get_vpn_gateway_connection_value_error() + self.test_get_vpn_server_client_configuration_value_error() - # Disable retries and run test_get_vpn_gateway_connection_value_error. + # Disable retries and run test_get_vpn_server_client_configuration_value_error. _service.disable_retries() - self.test_get_vpn_gateway_connection_value_error() + self.test_get_vpn_server_client_configuration_value_error() -class TestUpdateVpnGatewayConnection(): +class TestListVpnServerClients(): """ - Test Class for update_vpn_gateway_connection + Test Class for list_vpn_server_clients """ @responses.activate - def test_update_vpn_gateway_connection_all_params(self): + def test_list_vpn_server_clients_all_params(self): """ - update_vpn_gateway_connection() + list_vpn_server_clients() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections/testString') - mock_response = '{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}' - responses.add(responses.PATCH, + url = preprocess_url('/vpn_servers/testString/clients') + mock_response = '{"clients": [{"client_ip": {"address": "192.168.3.4"}, "common_name": "common_name", "created_at": "2019-01-01T12:00:00.000Z", "disconnected_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/8e454ead-0db7-48ac-9a8b-2698d8c470a7/clients/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "remote_ip": {"address": "192.168.3.4"}, "remote_port": 22, "resource_type": "vpn_server_client", "status": "connected", "username": "username"}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531/clients?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531/clients?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "total_count": 132}' + responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) - # Construct a dict representation of a VPNGatewayConnectionDPDPatch model - vpn_gateway_connection_dpd_patch_model = {} - vpn_gateway_connection_dpd_patch_model['action'] = 'restart' - vpn_gateway_connection_dpd_patch_model['interval'] = 30 - vpn_gateway_connection_dpd_patch_model['timeout'] = 120 - - # Construct a dict representation of a VPNGatewayConnectionIKEPolicyPatchIKEPolicyIdentityById model - vpn_gateway_connection_ike_policy_patch_model = {} - vpn_gateway_connection_ike_policy_patch_model['id'] = 'ddf51bec-3424-11e8-b467-0ed5f89f718b' - - # Construct a dict representation of a VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityById model - vpn_gateway_connection_i_psec_policy_patch_model = {} - vpn_gateway_connection_i_psec_policy_patch_model['id'] = 'ddf51bec-3424-11e8-b467-0ed5f89f718b' - - # Construct a dict representation of a VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch model - vpn_gateway_connection_patch_model = {} - vpn_gateway_connection_patch_model['admin_state_up'] = True - vpn_gateway_connection_patch_model['dead_peer_detection'] = vpn_gateway_connection_dpd_patch_model - vpn_gateway_connection_patch_model['ike_policy'] = vpn_gateway_connection_ike_policy_patch_model - vpn_gateway_connection_patch_model['ipsec_policy'] = vpn_gateway_connection_i_psec_policy_patch_model - vpn_gateway_connection_patch_model['name'] = 'my-vpn-connection' - vpn_gateway_connection_patch_model['peer_address'] = '169.21.50.5' - vpn_gateway_connection_patch_model['psk'] = 'lkj14b1oi0alcniejkso' - vpn_gateway_connection_patch_model['routing_protocol'] = 'none' - # Set up parameter values - vpn_gateway_id = 'testString' - id = 'testString' - vpn_gateway_connection_patch = vpn_gateway_connection_patch_model + vpn_server_id = 'testString' + start = 'testString' + limit = 1 + sort = 'created_at' # Invoke method - response = _service.update_vpn_gateway_connection( - vpn_gateway_id, - id, - vpn_gateway_connection_patch, + response = _service.list_vpn_server_clients( + vpn_server_id, + start=start, + limit=limit, + sort=sort, headers={} ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 - # Validate body params - req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body == vpn_gateway_connection_patch + # Validate query params + query_string = responses.calls[0].request.url.split('?',1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'start={}'.format(start) in query_string + assert 'limit={}'.format(limit) in query_string + assert 'sort={}'.format(sort) in query_string - def test_update_vpn_gateway_connection_all_params_with_retries(self): - # Enable retries and run test_update_vpn_gateway_connection_all_params. + def test_list_vpn_server_clients_all_params_with_retries(self): + # Enable retries and run test_list_vpn_server_clients_all_params. _service.enable_retries() - self.test_update_vpn_gateway_connection_all_params() + self.test_list_vpn_server_clients_all_params() - # Disable retries and run test_update_vpn_gateway_connection_all_params. + # Disable retries and run test_list_vpn_server_clients_all_params. _service.disable_retries() - self.test_update_vpn_gateway_connection_all_params() + self.test_list_vpn_server_clients_all_params() @responses.activate - def test_update_vpn_gateway_connection_value_error(self): + def test_list_vpn_server_clients_required_params(self): """ - test_update_vpn_gateway_connection_value_error() + test_list_vpn_server_clients_required_params() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections/testString') - mock_response = '{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b", "id": "a10a5771-dc23-442c-8460-c3601d8542f7", "ike_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ike-policy", "resource_type": "ike_policy"}, "ipsec_policy": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-ipsec-policy", "resource_type": "ipsec_policy"}, "mode": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}' - responses.add(responses.PATCH, + url = preprocess_url('/vpn_servers/testString/clients') + mock_response = '{"clients": [{"client_ip": {"address": "192.168.3.4"}, "common_name": "common_name", "created_at": "2019-01-01T12:00:00.000Z", "disconnected_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/8e454ead-0db7-48ac-9a8b-2698d8c470a7/clients/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "remote_ip": {"address": "192.168.3.4"}, "remote_port": 22, "resource_type": "vpn_server_client", "status": "connected", "username": "username"}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531/clients?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531/clients?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "total_count": 132}' + responses.add(responses.GET, url, body=mock_response, content_type='application/json', status=200) - # Construct a dict representation of a VPNGatewayConnectionDPDPatch model - vpn_gateway_connection_dpd_patch_model = {} - vpn_gateway_connection_dpd_patch_model['action'] = 'restart' - vpn_gateway_connection_dpd_patch_model['interval'] = 30 - vpn_gateway_connection_dpd_patch_model['timeout'] = 120 + # Set up parameter values + vpn_server_id = 'testString' - # Construct a dict representation of a VPNGatewayConnectionIKEPolicyPatchIKEPolicyIdentityById model - vpn_gateway_connection_ike_policy_patch_model = {} - vpn_gateway_connection_ike_policy_patch_model['id'] = 'ddf51bec-3424-11e8-b467-0ed5f89f718b' + # Invoke method + response = _service.list_vpn_server_clients( + vpn_server_id, + headers={} + ) - # Construct a dict representation of a VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityById model - vpn_gateway_connection_i_psec_policy_patch_model = {} - vpn_gateway_connection_i_psec_policy_patch_model['id'] = 'ddf51bec-3424-11e8-b467-0ed5f89f718b' + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 - # Construct a dict representation of a VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch model - vpn_gateway_connection_patch_model = {} - vpn_gateway_connection_patch_model['admin_state_up'] = True - vpn_gateway_connection_patch_model['dead_peer_detection'] = vpn_gateway_connection_dpd_patch_model - vpn_gateway_connection_patch_model['ike_policy'] = vpn_gateway_connection_ike_policy_patch_model - vpn_gateway_connection_patch_model['ipsec_policy'] = vpn_gateway_connection_i_psec_policy_patch_model - vpn_gateway_connection_patch_model['name'] = 'my-vpn-connection' - vpn_gateway_connection_patch_model['peer_address'] = '169.21.50.5' - vpn_gateway_connection_patch_model['psk'] = 'lkj14b1oi0alcniejkso' - vpn_gateway_connection_patch_model['routing_protocol'] = 'none' + def test_list_vpn_server_clients_required_params_with_retries(self): + # Enable retries and run test_list_vpn_server_clients_required_params. + _service.enable_retries() + self.test_list_vpn_server_clients_required_params() + + # Disable retries and run test_list_vpn_server_clients_required_params. + _service.disable_retries() + self.test_list_vpn_server_clients_required_params() + + @responses.activate + def test_list_vpn_server_clients_value_error(self): + """ + test_list_vpn_server_clients_value_error() + """ + # Set up mock + url = preprocess_url('/vpn_servers/testString/clients') + mock_response = '{"clients": [{"client_ip": {"address": "192.168.3.4"}, "common_name": "common_name", "created_at": "2019-01-01T12:00:00.000Z", "disconnected_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/8e454ead-0db7-48ac-9a8b-2698d8c470a7/clients/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "remote_ip": {"address": "192.168.3.4"}, "remote_port": 22, "resource_type": "vpn_server_client", "status": "connected", "username": "username"}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531/clients?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531/clients?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "total_count": 132}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) # Set up parameter values - vpn_gateway_id = 'testString' - id = 'testString' - vpn_gateway_connection_patch = vpn_gateway_connection_patch_model + vpn_server_id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "vpn_gateway_id": vpn_gateway_id, - "id": id, - "vpn_gateway_connection_patch": vpn_gateway_connection_patch, + "vpn_server_id": vpn_server_id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.update_vpn_gateway_connection(**req_copy) + _service.list_vpn_server_clients(**req_copy) - def test_update_vpn_gateway_connection_value_error_with_retries(self): - # Enable retries and run test_update_vpn_gateway_connection_value_error. + def test_list_vpn_server_clients_value_error_with_retries(self): + # Enable retries and run test_list_vpn_server_clients_value_error. _service.enable_retries() - self.test_update_vpn_gateway_connection_value_error() + self.test_list_vpn_server_clients_value_error() - # Disable retries and run test_update_vpn_gateway_connection_value_error. + # Disable retries and run test_list_vpn_server_clients_value_error. _service.disable_retries() - self.test_update_vpn_gateway_connection_value_error() + self.test_list_vpn_server_clients_value_error() -class TestListVpnGatewayConnectionLocalCidrs(): +class TestDeleteVpnServerClient(): """ - Test Class for list_vpn_gateway_connection_local_cidrs + Test Class for delete_vpn_server_client """ @responses.activate - def test_list_vpn_gateway_connection_local_cidrs_all_params(self): + def test_delete_vpn_server_client_all_params(self): """ - list_vpn_gateway_connection_local_cidrs() + delete_vpn_server_client() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections/testString/local_cidrs') - mock_response = '{"local_cidrs": ["192.168.1.0/24"]}' - responses.add(responses.GET, + url = preprocess_url('/vpn_servers/testString/clients/testString') + responses.add(responses.DELETE, url, - body=mock_response, - content_type='application/json', - status=200) + status=202) # Set up parameter values - vpn_gateway_id = 'testString' + vpn_server_id = 'testString' id = 'testString' # Invoke method - response = _service.list_vpn_gateway_connection_local_cidrs( - vpn_gateway_id, + response = _service.delete_vpn_server_client( + vpn_server_id, id, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 200 + assert response.status_code == 202 - def test_list_vpn_gateway_connection_local_cidrs_all_params_with_retries(self): - # Enable retries and run test_list_vpn_gateway_connection_local_cidrs_all_params. + def test_delete_vpn_server_client_all_params_with_retries(self): + # Enable retries and run test_delete_vpn_server_client_all_params. _service.enable_retries() - self.test_list_vpn_gateway_connection_local_cidrs_all_params() + self.test_delete_vpn_server_client_all_params() - # Disable retries and run test_list_vpn_gateway_connection_local_cidrs_all_params. + # Disable retries and run test_delete_vpn_server_client_all_params. _service.disable_retries() - self.test_list_vpn_gateway_connection_local_cidrs_all_params() + self.test_delete_vpn_server_client_all_params() @responses.activate - def test_list_vpn_gateway_connection_local_cidrs_value_error(self): + def test_delete_vpn_server_client_value_error(self): """ - test_list_vpn_gateway_connection_local_cidrs_value_error() + test_delete_vpn_server_client_value_error() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections/testString/local_cidrs') - mock_response = '{"local_cidrs": ["192.168.1.0/24"]}' - responses.add(responses.GET, + url = preprocess_url('/vpn_servers/testString/clients/testString') + responses.add(responses.DELETE, url, - body=mock_response, - content_type='application/json', - status=200) + status=202) # Set up parameter values - vpn_gateway_id = 'testString' + vpn_server_id = 'testString' id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "vpn_gateway_id": vpn_gateway_id, + "vpn_server_id": vpn_server_id, "id": id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_vpn_gateway_connection_local_cidrs(**req_copy) + _service.delete_vpn_server_client(**req_copy) - def test_list_vpn_gateway_connection_local_cidrs_value_error_with_retries(self): - # Enable retries and run test_list_vpn_gateway_connection_local_cidrs_value_error. + def test_delete_vpn_server_client_value_error_with_retries(self): + # Enable retries and run test_delete_vpn_server_client_value_error. _service.enable_retries() - self.test_list_vpn_gateway_connection_local_cidrs_value_error() + self.test_delete_vpn_server_client_value_error() - # Disable retries and run test_list_vpn_gateway_connection_local_cidrs_value_error. + # Disable retries and run test_delete_vpn_server_client_value_error. _service.disable_retries() - self.test_list_vpn_gateway_connection_local_cidrs_value_error() + self.test_delete_vpn_server_client_value_error() -class TestRemoveVpnGatewayConnectionLocalCidr(): +class TestGetVpnServerClient(): """ - Test Class for remove_vpn_gateway_connection_local_cidr + Test Class for get_vpn_server_client """ @responses.activate - def test_remove_vpn_gateway_connection_local_cidr_all_params(self): + def test_get_vpn_server_client_all_params(self): """ - remove_vpn_gateway_connection_local_cidr() + get_vpn_server_client() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections/testString/local_cidrs/testString/testString') - responses.add(responses.DELETE, + url = preprocess_url('/vpn_servers/testString/clients/testString') + mock_response = '{"client_ip": {"address": "192.168.3.4"}, "common_name": "common_name", "created_at": "2019-01-01T12:00:00.000Z", "disconnected_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/8e454ead-0db7-48ac-9a8b-2698d8c470a7/clients/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "remote_ip": {"address": "192.168.3.4"}, "remote_port": 22, "resource_type": "vpn_server_client", "status": "connected", "username": "username"}' + responses.add(responses.GET, url, - status=204) + body=mock_response, + content_type='application/json', + status=200) # Set up parameter values - vpn_gateway_id = 'testString' + vpn_server_id = 'testString' id = 'testString' - cidr_prefix = 'testString' - prefix_length = 'testString' # Invoke method - response = _service.remove_vpn_gateway_connection_local_cidr( - vpn_gateway_id, + response = _service.get_vpn_server_client( + vpn_server_id, id, - cidr_prefix, - prefix_length, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 204 + assert response.status_code == 200 - def test_remove_vpn_gateway_connection_local_cidr_all_params_with_retries(self): - # Enable retries and run test_remove_vpn_gateway_connection_local_cidr_all_params. + def test_get_vpn_server_client_all_params_with_retries(self): + # Enable retries and run test_get_vpn_server_client_all_params. _service.enable_retries() - self.test_remove_vpn_gateway_connection_local_cidr_all_params() + self.test_get_vpn_server_client_all_params() - # Disable retries and run test_remove_vpn_gateway_connection_local_cidr_all_params. + # Disable retries and run test_get_vpn_server_client_all_params. _service.disable_retries() - self.test_remove_vpn_gateway_connection_local_cidr_all_params() + self.test_get_vpn_server_client_all_params() @responses.activate - def test_remove_vpn_gateway_connection_local_cidr_value_error(self): + def test_get_vpn_server_client_value_error(self): """ - test_remove_vpn_gateway_connection_local_cidr_value_error() + test_get_vpn_server_client_value_error() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections/testString/local_cidrs/testString/testString') - responses.add(responses.DELETE, + url = preprocess_url('/vpn_servers/testString/clients/testString') + mock_response = '{"client_ip": {"address": "192.168.3.4"}, "common_name": "common_name", "created_at": "2019-01-01T12:00:00.000Z", "disconnected_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/8e454ead-0db7-48ac-9a8b-2698d8c470a7/clients/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "remote_ip": {"address": "192.168.3.4"}, "remote_port": 22, "resource_type": "vpn_server_client", "status": "connected", "username": "username"}' + responses.add(responses.GET, url, - status=204) + body=mock_response, + content_type='application/json', + status=200) # Set up parameter values - vpn_gateway_id = 'testString' + vpn_server_id = 'testString' id = 'testString' - cidr_prefix = 'testString' - prefix_length = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "vpn_gateway_id": vpn_gateway_id, + "vpn_server_id": vpn_server_id, "id": id, - "cidr_prefix": cidr_prefix, - "prefix_length": prefix_length, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.remove_vpn_gateway_connection_local_cidr(**req_copy) + _service.get_vpn_server_client(**req_copy) - def test_remove_vpn_gateway_connection_local_cidr_value_error_with_retries(self): - # Enable retries and run test_remove_vpn_gateway_connection_local_cidr_value_error. + def test_get_vpn_server_client_value_error_with_retries(self): + # Enable retries and run test_get_vpn_server_client_value_error. _service.enable_retries() - self.test_remove_vpn_gateway_connection_local_cidr_value_error() + self.test_get_vpn_server_client_value_error() - # Disable retries and run test_remove_vpn_gateway_connection_local_cidr_value_error. + # Disable retries and run test_get_vpn_server_client_value_error. _service.disable_retries() - self.test_remove_vpn_gateway_connection_local_cidr_value_error() + self.test_get_vpn_server_client_value_error() -class TestCheckVpnGatewayConnectionLocalCidr(): +class TestDisconnectVpnClient(): """ - Test Class for check_vpn_gateway_connection_local_cidr + Test Class for disconnect_vpn_client """ @responses.activate - def test_check_vpn_gateway_connection_local_cidr_all_params(self): + def test_disconnect_vpn_client_all_params(self): """ - check_vpn_gateway_connection_local_cidr() + disconnect_vpn_client() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections/testString/local_cidrs/testString/testString') - responses.add(responses.GET, + url = preprocess_url('/vpn_servers/testString/clients/testString/disconnect') + responses.add(responses.POST, url, - status=204) + status=202) # Set up parameter values - vpn_gateway_id = 'testString' + vpn_server_id = 'testString' id = 'testString' - cidr_prefix = 'testString' - prefix_length = 'testString' # Invoke method - response = _service.check_vpn_gateway_connection_local_cidr( - vpn_gateway_id, + response = _service.disconnect_vpn_client( + vpn_server_id, id, - cidr_prefix, - prefix_length, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 204 + assert response.status_code == 202 - def test_check_vpn_gateway_connection_local_cidr_all_params_with_retries(self): - # Enable retries and run test_check_vpn_gateway_connection_local_cidr_all_params. + def test_disconnect_vpn_client_all_params_with_retries(self): + # Enable retries and run test_disconnect_vpn_client_all_params. _service.enable_retries() - self.test_check_vpn_gateway_connection_local_cidr_all_params() + self.test_disconnect_vpn_client_all_params() - # Disable retries and run test_check_vpn_gateway_connection_local_cidr_all_params. + # Disable retries and run test_disconnect_vpn_client_all_params. _service.disable_retries() - self.test_check_vpn_gateway_connection_local_cidr_all_params() + self.test_disconnect_vpn_client_all_params() @responses.activate - def test_check_vpn_gateway_connection_local_cidr_value_error(self): + def test_disconnect_vpn_client_value_error(self): """ - test_check_vpn_gateway_connection_local_cidr_value_error() + test_disconnect_vpn_client_value_error() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections/testString/local_cidrs/testString/testString') - responses.add(responses.GET, + url = preprocess_url('/vpn_servers/testString/clients/testString/disconnect') + responses.add(responses.POST, url, - status=204) + status=202) # Set up parameter values - vpn_gateway_id = 'testString' + vpn_server_id = 'testString' id = 'testString' - cidr_prefix = 'testString' - prefix_length = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "vpn_gateway_id": vpn_gateway_id, + "vpn_server_id": vpn_server_id, "id": id, - "cidr_prefix": cidr_prefix, - "prefix_length": prefix_length, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.check_vpn_gateway_connection_local_cidr(**req_copy) + _service.disconnect_vpn_client(**req_copy) + + + def test_disconnect_vpn_client_value_error_with_retries(self): + # Enable retries and run test_disconnect_vpn_client_value_error. + _service.enable_retries() + self.test_disconnect_vpn_client_value_error() + + # Disable retries and run test_disconnect_vpn_client_value_error. + _service.disable_retries() + self.test_disconnect_vpn_client_value_error() + +class TestListVpnServerRoutes(): + """ + Test Class for list_vpn_server_routes + """ + + @responses.activate + def test_list_vpn_server_routes_all_params(self): + """ + list_vpn_server_routes() + """ + # Set up mock + url = preprocess_url('/vpn_servers/testString/routes') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}], "total_count": 132}' + responses.add(responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200) + # Set up parameter values + vpn_server_id = 'testString' + start = 'testString' + limit = 1 + sort = 'name' - def test_check_vpn_gateway_connection_local_cidr_value_error_with_retries(self): - # Enable retries and run test_check_vpn_gateway_connection_local_cidr_value_error. + # Invoke method + response = _service.list_vpn_server_routes( + vpn_server_id, + start=start, + limit=limit, + sort=sort, + headers={} + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?',1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'start={}'.format(start) in query_string + assert 'limit={}'.format(limit) in query_string + assert 'sort={}'.format(sort) in query_string + + def test_list_vpn_server_routes_all_params_with_retries(self): + # Enable retries and run test_list_vpn_server_routes_all_params. _service.enable_retries() - self.test_check_vpn_gateway_connection_local_cidr_value_error() + self.test_list_vpn_server_routes_all_params() - # Disable retries and run test_check_vpn_gateway_connection_local_cidr_value_error. + # Disable retries and run test_list_vpn_server_routes_all_params. _service.disable_retries() - self.test_check_vpn_gateway_connection_local_cidr_value_error() - -class TestAddVpnGatewayConnectionLocalCidr(): - """ - Test Class for add_vpn_gateway_connection_local_cidr - """ + self.test_list_vpn_server_routes_all_params() @responses.activate - def test_add_vpn_gateway_connection_local_cidr_all_params(self): + def test_list_vpn_server_routes_required_params(self): """ - add_vpn_gateway_connection_local_cidr() + test_list_vpn_server_routes_required_params() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections/testString/local_cidrs/testString/testString') - responses.add(responses.PUT, + url = preprocess_url('/vpn_servers/testString/routes') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}], "total_count": 132}' + responses.add(responses.GET, url, - status=204) + body=mock_response, + content_type='application/json', + status=200) # Set up parameter values - vpn_gateway_id = 'testString' - id = 'testString' - cidr_prefix = 'testString' - prefix_length = 'testString' + vpn_server_id = 'testString' # Invoke method - response = _service.add_vpn_gateway_connection_local_cidr( - vpn_gateway_id, - id, - cidr_prefix, - prefix_length, + response = _service.list_vpn_server_routes( + vpn_server_id, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 204 + assert response.status_code == 200 - def test_add_vpn_gateway_connection_local_cidr_all_params_with_retries(self): - # Enable retries and run test_add_vpn_gateway_connection_local_cidr_all_params. + def test_list_vpn_server_routes_required_params_with_retries(self): + # Enable retries and run test_list_vpn_server_routes_required_params. _service.enable_retries() - self.test_add_vpn_gateway_connection_local_cidr_all_params() + self.test_list_vpn_server_routes_required_params() - # Disable retries and run test_add_vpn_gateway_connection_local_cidr_all_params. + # Disable retries and run test_list_vpn_server_routes_required_params. _service.disable_retries() - self.test_add_vpn_gateway_connection_local_cidr_all_params() + self.test_list_vpn_server_routes_required_params() @responses.activate - def test_add_vpn_gateway_connection_local_cidr_value_error(self): + def test_list_vpn_server_routes_value_error(self): """ - test_add_vpn_gateway_connection_local_cidr_value_error() + test_list_vpn_server_routes_value_error() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections/testString/local_cidrs/testString/testString') - responses.add(responses.PUT, + url = preprocess_url('/vpn_servers/testString/routes') + mock_response = '{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}], "total_count": 132}' + responses.add(responses.GET, url, - status=204) + body=mock_response, + content_type='application/json', + status=200) # Set up parameter values - vpn_gateway_id = 'testString' - id = 'testString' - cidr_prefix = 'testString' - prefix_length = 'testString' + vpn_server_id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "vpn_gateway_id": vpn_gateway_id, - "id": id, - "cidr_prefix": cidr_prefix, - "prefix_length": prefix_length, + "vpn_server_id": vpn_server_id, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.add_vpn_gateway_connection_local_cidr(**req_copy) + _service.list_vpn_server_routes(**req_copy) - def test_add_vpn_gateway_connection_local_cidr_value_error_with_retries(self): - # Enable retries and run test_add_vpn_gateway_connection_local_cidr_value_error. + def test_list_vpn_server_routes_value_error_with_retries(self): + # Enable retries and run test_list_vpn_server_routes_value_error. _service.enable_retries() - self.test_add_vpn_gateway_connection_local_cidr_value_error() + self.test_list_vpn_server_routes_value_error() - # Disable retries and run test_add_vpn_gateway_connection_local_cidr_value_error. + # Disable retries and run test_list_vpn_server_routes_value_error. _service.disable_retries() - self.test_add_vpn_gateway_connection_local_cidr_value_error() + self.test_list_vpn_server_routes_value_error() -class TestListVpnGatewayConnectionPeerCidrs(): +class TestCreateVpnServerRoute(): """ - Test Class for list_vpn_gateway_connection_peer_cidrs + Test Class for create_vpn_server_route """ @responses.activate - def test_list_vpn_gateway_connection_peer_cidrs_all_params(self): + def test_create_vpn_server_route_all_params(self): """ - list_vpn_gateway_connection_peer_cidrs() + create_vpn_server_route() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections/testString/peer_cidrs') - mock_response = '{"peer_cidrs": ["10.45.1.0/24"]}' - responses.add(responses.GET, + url = preprocess_url('/vpn_servers/testString/routes') + mock_response = '{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}' + responses.add(responses.POST, url, body=mock_response, content_type='application/json', - status=200) + status=201) # Set up parameter values - vpn_gateway_id = 'testString' - id = 'testString' + vpn_server_id = 'testString' + destination = '172.16.0.0/16' + action = 'deliver' + name = 'my-vpn-route-2' # Invoke method - response = _service.list_vpn_gateway_connection_peer_cidrs( - vpn_gateway_id, - id, + response = _service.create_vpn_server_route( + vpn_server_id, + destination, + action=action, + name=name, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 200 + assert response.status_code == 201 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['destination'] == '172.16.0.0/16' + assert req_body['action'] == 'deliver' + assert req_body['name'] == 'my-vpn-route-2' - def test_list_vpn_gateway_connection_peer_cidrs_all_params_with_retries(self): - # Enable retries and run test_list_vpn_gateway_connection_peer_cidrs_all_params. + def test_create_vpn_server_route_all_params_with_retries(self): + # Enable retries and run test_create_vpn_server_route_all_params. _service.enable_retries() - self.test_list_vpn_gateway_connection_peer_cidrs_all_params() + self.test_create_vpn_server_route_all_params() - # Disable retries and run test_list_vpn_gateway_connection_peer_cidrs_all_params. + # Disable retries and run test_create_vpn_server_route_all_params. _service.disable_retries() - self.test_list_vpn_gateway_connection_peer_cidrs_all_params() + self.test_create_vpn_server_route_all_params() @responses.activate - def test_list_vpn_gateway_connection_peer_cidrs_value_error(self): + def test_create_vpn_server_route_value_error(self): """ - test_list_vpn_gateway_connection_peer_cidrs_value_error() + test_create_vpn_server_route_value_error() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections/testString/peer_cidrs') - mock_response = '{"peer_cidrs": ["10.45.1.0/24"]}' - responses.add(responses.GET, + url = preprocess_url('/vpn_servers/testString/routes') + mock_response = '{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}' + responses.add(responses.POST, url, body=mock_response, content_type='application/json', - status=200) + status=201) # Set up parameter values - vpn_gateway_id = 'testString' - id = 'testString' + vpn_server_id = 'testString' + destination = '172.16.0.0/16' + action = 'deliver' + name = 'my-vpn-route-2' # Pass in all but one required param and check for a ValueError req_param_dict = { - "vpn_gateway_id": vpn_gateway_id, - "id": id, + "vpn_server_id": vpn_server_id, + "destination": destination, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_vpn_gateway_connection_peer_cidrs(**req_copy) + _service.create_vpn_server_route(**req_copy) - def test_list_vpn_gateway_connection_peer_cidrs_value_error_with_retries(self): - # Enable retries and run test_list_vpn_gateway_connection_peer_cidrs_value_error. + def test_create_vpn_server_route_value_error_with_retries(self): + # Enable retries and run test_create_vpn_server_route_value_error. _service.enable_retries() - self.test_list_vpn_gateway_connection_peer_cidrs_value_error() + self.test_create_vpn_server_route_value_error() - # Disable retries and run test_list_vpn_gateway_connection_peer_cidrs_value_error. + # Disable retries and run test_create_vpn_server_route_value_error. _service.disable_retries() - self.test_list_vpn_gateway_connection_peer_cidrs_value_error() + self.test_create_vpn_server_route_value_error() -class TestRemoveVpnGatewayConnectionPeerCidr(): +class TestDeleteVpnServerRoute(): """ - Test Class for remove_vpn_gateway_connection_peer_cidr + Test Class for delete_vpn_server_route """ @responses.activate - def test_remove_vpn_gateway_connection_peer_cidr_all_params(self): + def test_delete_vpn_server_route_all_params(self): """ - remove_vpn_gateway_connection_peer_cidr() + delete_vpn_server_route() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections/testString/peer_cidrs/testString/testString') + url = preprocess_url('/vpn_servers/testString/routes/testString') responses.add(responses.DELETE, url, - status=204) + status=202) # Set up parameter values - vpn_gateway_id = 'testString' + vpn_server_id = 'testString' id = 'testString' - cidr_prefix = 'testString' - prefix_length = 'testString' # Invoke method - response = _service.remove_vpn_gateway_connection_peer_cidr( - vpn_gateway_id, + response = _service.delete_vpn_server_route( + vpn_server_id, id, - cidr_prefix, - prefix_length, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 204 + assert response.status_code == 202 - def test_remove_vpn_gateway_connection_peer_cidr_all_params_with_retries(self): - # Enable retries and run test_remove_vpn_gateway_connection_peer_cidr_all_params. + def test_delete_vpn_server_route_all_params_with_retries(self): + # Enable retries and run test_delete_vpn_server_route_all_params. _service.enable_retries() - self.test_remove_vpn_gateway_connection_peer_cidr_all_params() + self.test_delete_vpn_server_route_all_params() - # Disable retries and run test_remove_vpn_gateway_connection_peer_cidr_all_params. + # Disable retries and run test_delete_vpn_server_route_all_params. _service.disable_retries() - self.test_remove_vpn_gateway_connection_peer_cidr_all_params() + self.test_delete_vpn_server_route_all_params() @responses.activate - def test_remove_vpn_gateway_connection_peer_cidr_value_error(self): + def test_delete_vpn_server_route_value_error(self): """ - test_remove_vpn_gateway_connection_peer_cidr_value_error() + test_delete_vpn_server_route_value_error() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections/testString/peer_cidrs/testString/testString') + url = preprocess_url('/vpn_servers/testString/routes/testString') responses.add(responses.DELETE, url, - status=204) + status=202) # Set up parameter values - vpn_gateway_id = 'testString' + vpn_server_id = 'testString' id = 'testString' - cidr_prefix = 'testString' - prefix_length = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "vpn_gateway_id": vpn_gateway_id, + "vpn_server_id": vpn_server_id, "id": id, - "cidr_prefix": cidr_prefix, - "prefix_length": prefix_length, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.remove_vpn_gateway_connection_peer_cidr(**req_copy) + _service.delete_vpn_server_route(**req_copy) - def test_remove_vpn_gateway_connection_peer_cidr_value_error_with_retries(self): - # Enable retries and run test_remove_vpn_gateway_connection_peer_cidr_value_error. + def test_delete_vpn_server_route_value_error_with_retries(self): + # Enable retries and run test_delete_vpn_server_route_value_error. _service.enable_retries() - self.test_remove_vpn_gateway_connection_peer_cidr_value_error() + self.test_delete_vpn_server_route_value_error() - # Disable retries and run test_remove_vpn_gateway_connection_peer_cidr_value_error. + # Disable retries and run test_delete_vpn_server_route_value_error. _service.disable_retries() - self.test_remove_vpn_gateway_connection_peer_cidr_value_error() + self.test_delete_vpn_server_route_value_error() -class TestCheckVpnGatewayConnectionPeerCidr(): +class TestGetVpnServerRoute(): """ - Test Class for check_vpn_gateway_connection_peer_cidr + Test Class for get_vpn_server_route """ @responses.activate - def test_check_vpn_gateway_connection_peer_cidr_all_params(self): + def test_get_vpn_server_route_all_params(self): """ - check_vpn_gateway_connection_peer_cidr() + get_vpn_server_route() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections/testString/peer_cidrs/testString/testString') + url = preprocess_url('/vpn_servers/testString/routes/testString') + mock_response = '{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}' responses.add(responses.GET, url, - status=204) + body=mock_response, + content_type='application/json', + status=200) # Set up parameter values - vpn_gateway_id = 'testString' + vpn_server_id = 'testString' id = 'testString' - cidr_prefix = 'testString' - prefix_length = 'testString' # Invoke method - response = _service.check_vpn_gateway_connection_peer_cidr( - vpn_gateway_id, + response = _service.get_vpn_server_route( + vpn_server_id, id, - cidr_prefix, - prefix_length, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 204 + assert response.status_code == 200 - def test_check_vpn_gateway_connection_peer_cidr_all_params_with_retries(self): - # Enable retries and run test_check_vpn_gateway_connection_peer_cidr_all_params. + def test_get_vpn_server_route_all_params_with_retries(self): + # Enable retries and run test_get_vpn_server_route_all_params. _service.enable_retries() - self.test_check_vpn_gateway_connection_peer_cidr_all_params() + self.test_get_vpn_server_route_all_params() - # Disable retries and run test_check_vpn_gateway_connection_peer_cidr_all_params. + # Disable retries and run test_get_vpn_server_route_all_params. _service.disable_retries() - self.test_check_vpn_gateway_connection_peer_cidr_all_params() + self.test_get_vpn_server_route_all_params() @responses.activate - def test_check_vpn_gateway_connection_peer_cidr_value_error(self): + def test_get_vpn_server_route_value_error(self): """ - test_check_vpn_gateway_connection_peer_cidr_value_error() + test_get_vpn_server_route_value_error() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections/testString/peer_cidrs/testString/testString') + url = preprocess_url('/vpn_servers/testString/routes/testString') + mock_response = '{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}' responses.add(responses.GET, url, - status=204) + body=mock_response, + content_type='application/json', + status=200) # Set up parameter values - vpn_gateway_id = 'testString' + vpn_server_id = 'testString' id = 'testString' - cidr_prefix = 'testString' - prefix_length = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { - "vpn_gateway_id": vpn_gateway_id, + "vpn_server_id": vpn_server_id, "id": id, - "cidr_prefix": cidr_prefix, - "prefix_length": prefix_length, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.check_vpn_gateway_connection_peer_cidr(**req_copy) + _service.get_vpn_server_route(**req_copy) - def test_check_vpn_gateway_connection_peer_cidr_value_error_with_retries(self): - # Enable retries and run test_check_vpn_gateway_connection_peer_cidr_value_error. + def test_get_vpn_server_route_value_error_with_retries(self): + # Enable retries and run test_get_vpn_server_route_value_error. _service.enable_retries() - self.test_check_vpn_gateway_connection_peer_cidr_value_error() + self.test_get_vpn_server_route_value_error() - # Disable retries and run test_check_vpn_gateway_connection_peer_cidr_value_error. + # Disable retries and run test_get_vpn_server_route_value_error. _service.disable_retries() - self.test_check_vpn_gateway_connection_peer_cidr_value_error() + self.test_get_vpn_server_route_value_error() -class TestAddVpnGatewayConnectionPeerCidr(): +class TestUpdateVpnServerRoute(): """ - Test Class for add_vpn_gateway_connection_peer_cidr + Test Class for update_vpn_server_route """ @responses.activate - def test_add_vpn_gateway_connection_peer_cidr_all_params(self): + def test_update_vpn_server_route_all_params(self): """ - add_vpn_gateway_connection_peer_cidr() + update_vpn_server_route() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections/testString/peer_cidrs/testString/testString') - responses.add(responses.PUT, + url = preprocess_url('/vpn_servers/testString/routes/testString') + mock_response = '{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}' + responses.add(responses.PATCH, url, - status=204) + body=mock_response, + content_type='application/json', + status=200) + + # Construct a dict representation of a VPNServerRoutePatch model + vpn_server_route_patch_model = {} + vpn_server_route_patch_model['name'] = 'my-vpn-route-2' # Set up parameter values - vpn_gateway_id = 'testString' + vpn_server_id = 'testString' id = 'testString' - cidr_prefix = 'testString' - prefix_length = 'testString' + vpn_server_route_patch = vpn_server_route_patch_model # Invoke method - response = _service.add_vpn_gateway_connection_peer_cidr( - vpn_gateway_id, + response = _service.update_vpn_server_route( + vpn_server_id, id, - cidr_prefix, - prefix_length, + vpn_server_route_patch, headers={} ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 204 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body == vpn_server_route_patch - def test_add_vpn_gateway_connection_peer_cidr_all_params_with_retries(self): - # Enable retries and run test_add_vpn_gateway_connection_peer_cidr_all_params. + def test_update_vpn_server_route_all_params_with_retries(self): + # Enable retries and run test_update_vpn_server_route_all_params. _service.enable_retries() - self.test_add_vpn_gateway_connection_peer_cidr_all_params() + self.test_update_vpn_server_route_all_params() - # Disable retries and run test_add_vpn_gateway_connection_peer_cidr_all_params. + # Disable retries and run test_update_vpn_server_route_all_params. _service.disable_retries() - self.test_add_vpn_gateway_connection_peer_cidr_all_params() + self.test_update_vpn_server_route_all_params() @responses.activate - def test_add_vpn_gateway_connection_peer_cidr_value_error(self): + def test_update_vpn_server_route_value_error(self): """ - test_add_vpn_gateway_connection_peer_cidr_value_error() + test_update_vpn_server_route_value_error() """ # Set up mock - url = preprocess_url('/vpn_gateways/testString/connections/testString/peer_cidrs/testString/testString') - responses.add(responses.PUT, + url = preprocess_url('/vpn_servers/testString/routes/testString') + mock_response = '{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}' + responses.add(responses.PATCH, url, - status=204) + body=mock_response, + content_type='application/json', + status=200) + + # Construct a dict representation of a VPNServerRoutePatch model + vpn_server_route_patch_model = {} + vpn_server_route_patch_model['name'] = 'my-vpn-route-2' # Set up parameter values - vpn_gateway_id = 'testString' + vpn_server_id = 'testString' id = 'testString' - cidr_prefix = 'testString' - prefix_length = 'testString' + vpn_server_route_patch = vpn_server_route_patch_model # Pass in all but one required param and check for a ValueError req_param_dict = { - "vpn_gateway_id": vpn_gateway_id, + "vpn_server_id": vpn_server_id, "id": id, - "cidr_prefix": cidr_prefix, - "prefix_length": prefix_length, + "vpn_server_route_patch": vpn_server_route_patch, } for param in req_param_dict.keys(): req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.add_vpn_gateway_connection_peer_cidr(**req_copy) + _service.update_vpn_server_route(**req_copy) - def test_add_vpn_gateway_connection_peer_cidr_value_error_with_retries(self): - # Enable retries and run test_add_vpn_gateway_connection_peer_cidr_value_error. + def test_update_vpn_server_route_value_error_with_retries(self): + # Enable retries and run test_update_vpn_server_route_value_error. _service.enable_retries() - self.test_add_vpn_gateway_connection_peer_cidr_value_error() + self.test_update_vpn_server_route_value_error() - # Disable retries and run test_add_vpn_gateway_connection_peer_cidr_value_error. + # Disable retries and run test_update_vpn_server_route_value_error. _service.disable_retries() - self.test_add_vpn_gateway_connection_peer_cidr_value_error() + self.test_update_vpn_server_route_value_error() # endregion ############################################################################## -# End of Service: VPNGateways +# End of Service: VPNServers ############################################################################## ############################################################################## @@ -29798,6 +32679,551 @@ def test_address_prefix_patch_serialization(self): address_prefix_patch_model_json2 = address_prefix_patch_model.to_dict() assert address_prefix_patch_model_json2 == address_prefix_patch_model_json +class TestModel_BackupPolicy(): + """ + Test Class for BackupPolicy + """ + + def test_backup_policy_serialization(self): + """ + Test serialization/deserialization for BackupPolicy + """ + + # Construct dict forms of any model objects needed in order to build this model. + + backup_policy_plan_reference_deleted_model = {} # BackupPolicyPlanReferenceDeleted + backup_policy_plan_reference_deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + + backup_policy_plan_reference_model = {} # BackupPolicyPlanReference + backup_policy_plan_reference_model['deleted'] = backup_policy_plan_reference_deleted_model + backup_policy_plan_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178' + backup_policy_plan_reference_model['id'] = 'r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178' + backup_policy_plan_reference_model['name'] = 'my-policy-plan' + backup_policy_plan_reference_model['resource_type'] = 'backup_policy_plan' + + resource_group_reference_model = {} # ResourceGroupReference + resource_group_reference_model['href'] = 'https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345' + resource_group_reference_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + resource_group_reference_model['name'] = 'my-resource-group' + + # Construct a json representation of a BackupPolicy model + backup_policy_model_json = {} + backup_policy_model_json['created_at'] = '2019-01-01T12:00:00Z' + backup_policy_model_json['crn'] = 'crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6' + backup_policy_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6' + backup_policy_model_json['id'] = 'r134-076191ba-49c2-4763-94fd-c70de73ee2e6' + backup_policy_model_json['last_job_completed_at'] = '2019-01-01T12:00:00Z' + backup_policy_model_json['lifecycle_state'] = 'stable' + backup_policy_model_json['match_resource_types'] = ['volume'] + backup_policy_model_json['match_user_tags'] = ['my-daily-backup-policy'] + backup_policy_model_json['name'] = 'my-backup-policy' + backup_policy_model_json['plans'] = [backup_policy_plan_reference_model] + backup_policy_model_json['resource_group'] = resource_group_reference_model + backup_policy_model_json['resource_type'] = 'backup_policy' + + # Construct a model instance of BackupPolicy by calling from_dict on the json representation + backup_policy_model = BackupPolicy.from_dict(backup_policy_model_json) + assert backup_policy_model != False + + # Construct a model instance of BackupPolicy by calling from_dict on the json representation + backup_policy_model_dict = BackupPolicy.from_dict(backup_policy_model_json).__dict__ + backup_policy_model2 = BackupPolicy(**backup_policy_model_dict) + + # Verify the model instances are equivalent + assert backup_policy_model == backup_policy_model2 + + # Convert model instance back to dict and verify no loss of data + backup_policy_model_json2 = backup_policy_model.to_dict() + assert backup_policy_model_json2 == backup_policy_model_json + +class TestModel_BackupPolicyCollection(): + """ + Test Class for BackupPolicyCollection + """ + + def test_backup_policy_collection_serialization(self): + """ + Test serialization/deserialization for BackupPolicyCollection + """ + + # Construct dict forms of any model objects needed in order to build this model. + + backup_policy_plan_reference_deleted_model = {} # BackupPolicyPlanReferenceDeleted + backup_policy_plan_reference_deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + + backup_policy_plan_reference_model = {} # BackupPolicyPlanReference + backup_policy_plan_reference_model['deleted'] = backup_policy_plan_reference_deleted_model + backup_policy_plan_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178' + backup_policy_plan_reference_model['id'] = 'r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178' + backup_policy_plan_reference_model['name'] = 'my-policy-plan' + backup_policy_plan_reference_model['resource_type'] = 'backup_policy_plan' + + resource_group_reference_model = {} # ResourceGroupReference + resource_group_reference_model['href'] = 'https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345' + resource_group_reference_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + resource_group_reference_model['name'] = 'my-resource-group' + + backup_policy_model = {} # BackupPolicy + backup_policy_model['created_at'] = '2019-01-01T12:00:00Z' + backup_policy_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6' + backup_policy_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6' + backup_policy_model['id'] = 'r134-076191ba-49c2-4763-94fd-c70de73ee2e6' + backup_policy_model['last_job_completed_at'] = '2019-01-01T12:00:00Z' + backup_policy_model['lifecycle_state'] = 'stable' + backup_policy_model['match_resource_types'] = ['volume'] + backup_policy_model['match_user_tags'] = ['my-daily-backup-policy'] + backup_policy_model['name'] = 'my-backup-policy' + backup_policy_model['plans'] = [backup_policy_plan_reference_model] + backup_policy_model['resource_group'] = resource_group_reference_model + backup_policy_model['resource_type'] = 'backup_policy' + + backup_policy_collection_first_model = {} # BackupPolicyCollectionFirst + backup_policy_collection_first_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/backup_policies?limit=20' + + backup_policy_collection_next_model = {} # BackupPolicyCollectionNext + backup_policy_collection_next_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/backup_policies?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20' + + # Construct a json representation of a BackupPolicyCollection model + backup_policy_collection_model_json = {} + backup_policy_collection_model_json['backup_policies'] = [backup_policy_model] + backup_policy_collection_model_json['first'] = backup_policy_collection_first_model + backup_policy_collection_model_json['limit'] = 20 + backup_policy_collection_model_json['next'] = backup_policy_collection_next_model + backup_policy_collection_model_json['total_count'] = 132 + + # Construct a model instance of BackupPolicyCollection by calling from_dict on the json representation + backup_policy_collection_model = BackupPolicyCollection.from_dict(backup_policy_collection_model_json) + assert backup_policy_collection_model != False + + # Construct a model instance of BackupPolicyCollection by calling from_dict on the json representation + backup_policy_collection_model_dict = BackupPolicyCollection.from_dict(backup_policy_collection_model_json).__dict__ + backup_policy_collection_model2 = BackupPolicyCollection(**backup_policy_collection_model_dict) + + # Verify the model instances are equivalent + assert backup_policy_collection_model == backup_policy_collection_model2 + + # Convert model instance back to dict and verify no loss of data + backup_policy_collection_model_json2 = backup_policy_collection_model.to_dict() + assert backup_policy_collection_model_json2 == backup_policy_collection_model_json + +class TestModel_BackupPolicyCollectionFirst(): + """ + Test Class for BackupPolicyCollectionFirst + """ + + def test_backup_policy_collection_first_serialization(self): + """ + Test serialization/deserialization for BackupPolicyCollectionFirst + """ + + # Construct a json representation of a BackupPolicyCollectionFirst model + backup_policy_collection_first_model_json = {} + backup_policy_collection_first_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/backup_policies?limit=20' + + # Construct a model instance of BackupPolicyCollectionFirst by calling from_dict on the json representation + backup_policy_collection_first_model = BackupPolicyCollectionFirst.from_dict(backup_policy_collection_first_model_json) + assert backup_policy_collection_first_model != False + + # Construct a model instance of BackupPolicyCollectionFirst by calling from_dict on the json representation + backup_policy_collection_first_model_dict = BackupPolicyCollectionFirst.from_dict(backup_policy_collection_first_model_json).__dict__ + backup_policy_collection_first_model2 = BackupPolicyCollectionFirst(**backup_policy_collection_first_model_dict) + + # Verify the model instances are equivalent + assert backup_policy_collection_first_model == backup_policy_collection_first_model2 + + # Convert model instance back to dict and verify no loss of data + backup_policy_collection_first_model_json2 = backup_policy_collection_first_model.to_dict() + assert backup_policy_collection_first_model_json2 == backup_policy_collection_first_model_json + +class TestModel_BackupPolicyCollectionNext(): + """ + Test Class for BackupPolicyCollectionNext + """ + + def test_backup_policy_collection_next_serialization(self): + """ + Test serialization/deserialization for BackupPolicyCollectionNext + """ + + # Construct a json representation of a BackupPolicyCollectionNext model + backup_policy_collection_next_model_json = {} + backup_policy_collection_next_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/backup_policies?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20' + + # Construct a model instance of BackupPolicyCollectionNext by calling from_dict on the json representation + backup_policy_collection_next_model = BackupPolicyCollectionNext.from_dict(backup_policy_collection_next_model_json) + assert backup_policy_collection_next_model != False + + # Construct a model instance of BackupPolicyCollectionNext by calling from_dict on the json representation + backup_policy_collection_next_model_dict = BackupPolicyCollectionNext.from_dict(backup_policy_collection_next_model_json).__dict__ + backup_policy_collection_next_model2 = BackupPolicyCollectionNext(**backup_policy_collection_next_model_dict) + + # Verify the model instances are equivalent + assert backup_policy_collection_next_model == backup_policy_collection_next_model2 + + # Convert model instance back to dict and verify no loss of data + backup_policy_collection_next_model_json2 = backup_policy_collection_next_model.to_dict() + assert backup_policy_collection_next_model_json2 == backup_policy_collection_next_model_json + +class TestModel_BackupPolicyPatch(): + """ + Test Class for BackupPolicyPatch + """ + + def test_backup_policy_patch_serialization(self): + """ + Test serialization/deserialization for BackupPolicyPatch + """ + + # Construct a json representation of a BackupPolicyPatch model + backup_policy_patch_model_json = {} + backup_policy_patch_model_json['match_user_tags'] = ['my-daily-backup-policy'] + backup_policy_patch_model_json['name'] = 'my-backup-policy' + + # Construct a model instance of BackupPolicyPatch by calling from_dict on the json representation + backup_policy_patch_model = BackupPolicyPatch.from_dict(backup_policy_patch_model_json) + assert backup_policy_patch_model != False + + # Construct a model instance of BackupPolicyPatch by calling from_dict on the json representation + backup_policy_patch_model_dict = BackupPolicyPatch.from_dict(backup_policy_patch_model_json).__dict__ + backup_policy_patch_model2 = BackupPolicyPatch(**backup_policy_patch_model_dict) + + # Verify the model instances are equivalent + assert backup_policy_patch_model == backup_policy_patch_model2 + + # Convert model instance back to dict and verify no loss of data + backup_policy_patch_model_json2 = backup_policy_patch_model.to_dict() + assert backup_policy_patch_model_json2 == backup_policy_patch_model_json + +class TestModel_BackupPolicyPlan(): + """ + Test Class for BackupPolicyPlan + """ + + def test_backup_policy_plan_serialization(self): + """ + Test serialization/deserialization for BackupPolicyPlan + """ + + # Construct dict forms of any model objects needed in order to build this model. + + backup_policy_plan_deletion_trigger_model = {} # BackupPolicyPlanDeletionTrigger + backup_policy_plan_deletion_trigger_model['delete_after'] = 20 + backup_policy_plan_deletion_trigger_model['delete_over_count'] = 20 + + # Construct a json representation of a BackupPolicyPlan model + backup_policy_plan_model_json = {} + backup_policy_plan_model_json['active'] = True + backup_policy_plan_model_json['attach_user_tags'] = ['my-daily-backup-plan'] + backup_policy_plan_model_json['copy_user_tags'] = True + backup_policy_plan_model_json['created_at'] = '2019-01-01T12:00:00Z' + backup_policy_plan_model_json['cron_spec'] = '*/5 1,2,3 * * *' + backup_policy_plan_model_json['deletion_trigger'] = backup_policy_plan_deletion_trigger_model + backup_policy_plan_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178' + backup_policy_plan_model_json['id'] = 'r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178' + backup_policy_plan_model_json['lifecycle_state'] = 'stable' + backup_policy_plan_model_json['name'] = 'my-policy-plan' + backup_policy_plan_model_json['resource_type'] = 'backup_policy_plan' + + # Construct a model instance of BackupPolicyPlan by calling from_dict on the json representation + backup_policy_plan_model = BackupPolicyPlan.from_dict(backup_policy_plan_model_json) + assert backup_policy_plan_model != False + + # Construct a model instance of BackupPolicyPlan by calling from_dict on the json representation + backup_policy_plan_model_dict = BackupPolicyPlan.from_dict(backup_policy_plan_model_json).__dict__ + backup_policy_plan_model2 = BackupPolicyPlan(**backup_policy_plan_model_dict) + + # Verify the model instances are equivalent + assert backup_policy_plan_model == backup_policy_plan_model2 + + # Convert model instance back to dict and verify no loss of data + backup_policy_plan_model_json2 = backup_policy_plan_model.to_dict() + assert backup_policy_plan_model_json2 == backup_policy_plan_model_json + +class TestModel_BackupPolicyPlanCollection(): + """ + Test Class for BackupPolicyPlanCollection + """ + + def test_backup_policy_plan_collection_serialization(self): + """ + Test serialization/deserialization for BackupPolicyPlanCollection + """ + + # Construct dict forms of any model objects needed in order to build this model. + + backup_policy_plan_deletion_trigger_model = {} # BackupPolicyPlanDeletionTrigger + backup_policy_plan_deletion_trigger_model['delete_after'] = 20 + backup_policy_plan_deletion_trigger_model['delete_over_count'] = 20 + + backup_policy_plan_model = {} # BackupPolicyPlan + backup_policy_plan_model['active'] = True + backup_policy_plan_model['attach_user_tags'] = ['my-daily-backup-plan'] + backup_policy_plan_model['copy_user_tags'] = True + backup_policy_plan_model['created_at'] = '2019-01-01T12:00:00Z' + backup_policy_plan_model['cron_spec'] = '*/5 1,2,3 * * *' + backup_policy_plan_model['deletion_trigger'] = backup_policy_plan_deletion_trigger_model + backup_policy_plan_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178' + backup_policy_plan_model['id'] = 'r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178' + backup_policy_plan_model['lifecycle_state'] = 'stable' + backup_policy_plan_model['name'] = 'my-policy-plan' + backup_policy_plan_model['resource_type'] = 'backup_policy_plan' + + # Construct a json representation of a BackupPolicyPlanCollection model + backup_policy_plan_collection_model_json = {} + backup_policy_plan_collection_model_json['plans'] = [backup_policy_plan_model] + + # Construct a model instance of BackupPolicyPlanCollection by calling from_dict on the json representation + backup_policy_plan_collection_model = BackupPolicyPlanCollection.from_dict(backup_policy_plan_collection_model_json) + assert backup_policy_plan_collection_model != False + + # Construct a model instance of BackupPolicyPlanCollection by calling from_dict on the json representation + backup_policy_plan_collection_model_dict = BackupPolicyPlanCollection.from_dict(backup_policy_plan_collection_model_json).__dict__ + backup_policy_plan_collection_model2 = BackupPolicyPlanCollection(**backup_policy_plan_collection_model_dict) + + # Verify the model instances are equivalent + assert backup_policy_plan_collection_model == backup_policy_plan_collection_model2 + + # Convert model instance back to dict and verify no loss of data + backup_policy_plan_collection_model_json2 = backup_policy_plan_collection_model.to_dict() + assert backup_policy_plan_collection_model_json2 == backup_policy_plan_collection_model_json + +class TestModel_BackupPolicyPlanDeletionTrigger(): + """ + Test Class for BackupPolicyPlanDeletionTrigger + """ + + def test_backup_policy_plan_deletion_trigger_serialization(self): + """ + Test serialization/deserialization for BackupPolicyPlanDeletionTrigger + """ + + # Construct a json representation of a BackupPolicyPlanDeletionTrigger model + backup_policy_plan_deletion_trigger_model_json = {} + backup_policy_plan_deletion_trigger_model_json['delete_after'] = 20 + backup_policy_plan_deletion_trigger_model_json['delete_over_count'] = 20 + + # Construct a model instance of BackupPolicyPlanDeletionTrigger by calling from_dict on the json representation + backup_policy_plan_deletion_trigger_model = BackupPolicyPlanDeletionTrigger.from_dict(backup_policy_plan_deletion_trigger_model_json) + assert backup_policy_plan_deletion_trigger_model != False + + # Construct a model instance of BackupPolicyPlanDeletionTrigger by calling from_dict on the json representation + backup_policy_plan_deletion_trigger_model_dict = BackupPolicyPlanDeletionTrigger.from_dict(backup_policy_plan_deletion_trigger_model_json).__dict__ + backup_policy_plan_deletion_trigger_model2 = BackupPolicyPlanDeletionTrigger(**backup_policy_plan_deletion_trigger_model_dict) + + # Verify the model instances are equivalent + assert backup_policy_plan_deletion_trigger_model == backup_policy_plan_deletion_trigger_model2 + + # Convert model instance back to dict and verify no loss of data + backup_policy_plan_deletion_trigger_model_json2 = backup_policy_plan_deletion_trigger_model.to_dict() + assert backup_policy_plan_deletion_trigger_model_json2 == backup_policy_plan_deletion_trigger_model_json + +class TestModel_BackupPolicyPlanDeletionTriggerPatch(): + """ + Test Class for BackupPolicyPlanDeletionTriggerPatch + """ + + def test_backup_policy_plan_deletion_trigger_patch_serialization(self): + """ + Test serialization/deserialization for BackupPolicyPlanDeletionTriggerPatch + """ + + # Construct a json representation of a BackupPolicyPlanDeletionTriggerPatch model + backup_policy_plan_deletion_trigger_patch_model_json = {} + backup_policy_plan_deletion_trigger_patch_model_json['delete_after'] = 20 + backup_policy_plan_deletion_trigger_patch_model_json['delete_over_count'] = 38 + + # Construct a model instance of BackupPolicyPlanDeletionTriggerPatch by calling from_dict on the json representation + backup_policy_plan_deletion_trigger_patch_model = BackupPolicyPlanDeletionTriggerPatch.from_dict(backup_policy_plan_deletion_trigger_patch_model_json) + assert backup_policy_plan_deletion_trigger_patch_model != False + + # Construct a model instance of BackupPolicyPlanDeletionTriggerPatch by calling from_dict on the json representation + backup_policy_plan_deletion_trigger_patch_model_dict = BackupPolicyPlanDeletionTriggerPatch.from_dict(backup_policy_plan_deletion_trigger_patch_model_json).__dict__ + backup_policy_plan_deletion_trigger_patch_model2 = BackupPolicyPlanDeletionTriggerPatch(**backup_policy_plan_deletion_trigger_patch_model_dict) + + # Verify the model instances are equivalent + assert backup_policy_plan_deletion_trigger_patch_model == backup_policy_plan_deletion_trigger_patch_model2 + + # Convert model instance back to dict and verify no loss of data + backup_policy_plan_deletion_trigger_patch_model_json2 = backup_policy_plan_deletion_trigger_patch_model.to_dict() + assert backup_policy_plan_deletion_trigger_patch_model_json2 == backup_policy_plan_deletion_trigger_patch_model_json + +class TestModel_BackupPolicyPlanDeletionTriggerPrototype(): + """ + Test Class for BackupPolicyPlanDeletionTriggerPrototype + """ + + def test_backup_policy_plan_deletion_trigger_prototype_serialization(self): + """ + Test serialization/deserialization for BackupPolicyPlanDeletionTriggerPrototype + """ + + # Construct a json representation of a BackupPolicyPlanDeletionTriggerPrototype model + backup_policy_plan_deletion_trigger_prototype_model_json = {} + backup_policy_plan_deletion_trigger_prototype_model_json['delete_after'] = 20 + backup_policy_plan_deletion_trigger_prototype_model_json['delete_over_count'] = 20 + + # Construct a model instance of BackupPolicyPlanDeletionTriggerPrototype by calling from_dict on the json representation + backup_policy_plan_deletion_trigger_prototype_model = BackupPolicyPlanDeletionTriggerPrototype.from_dict(backup_policy_plan_deletion_trigger_prototype_model_json) + assert backup_policy_plan_deletion_trigger_prototype_model != False + + # Construct a model instance of BackupPolicyPlanDeletionTriggerPrototype by calling from_dict on the json representation + backup_policy_plan_deletion_trigger_prototype_model_dict = BackupPolicyPlanDeletionTriggerPrototype.from_dict(backup_policy_plan_deletion_trigger_prototype_model_json).__dict__ + backup_policy_plan_deletion_trigger_prototype_model2 = BackupPolicyPlanDeletionTriggerPrototype(**backup_policy_plan_deletion_trigger_prototype_model_dict) + + # Verify the model instances are equivalent + assert backup_policy_plan_deletion_trigger_prototype_model == backup_policy_plan_deletion_trigger_prototype_model2 + + # Convert model instance back to dict and verify no loss of data + backup_policy_plan_deletion_trigger_prototype_model_json2 = backup_policy_plan_deletion_trigger_prototype_model.to_dict() + assert backup_policy_plan_deletion_trigger_prototype_model_json2 == backup_policy_plan_deletion_trigger_prototype_model_json + +class TestModel_BackupPolicyPlanPatch(): + """ + Test Class for BackupPolicyPlanPatch + """ + + def test_backup_policy_plan_patch_serialization(self): + """ + Test serialization/deserialization for BackupPolicyPlanPatch + """ + + # Construct dict forms of any model objects needed in order to build this model. + + backup_policy_plan_deletion_trigger_patch_model = {} # BackupPolicyPlanDeletionTriggerPatch + backup_policy_plan_deletion_trigger_patch_model['delete_after'] = 20 + backup_policy_plan_deletion_trigger_patch_model['delete_over_count'] = 38 + + # Construct a json representation of a BackupPolicyPlanPatch model + backup_policy_plan_patch_model_json = {} + backup_policy_plan_patch_model_json['active'] = True + backup_policy_plan_patch_model_json['attach_user_tags'] = ['my-daily-backup-plan'] + backup_policy_plan_patch_model_json['copy_user_tags'] = True + backup_policy_plan_patch_model_json['cron_spec'] = '*/5 1,2,3 * * *' + backup_policy_plan_patch_model_json['deletion_trigger'] = backup_policy_plan_deletion_trigger_patch_model + backup_policy_plan_patch_model_json['name'] = 'my-policy-plan' + + # Construct a model instance of BackupPolicyPlanPatch by calling from_dict on the json representation + backup_policy_plan_patch_model = BackupPolicyPlanPatch.from_dict(backup_policy_plan_patch_model_json) + assert backup_policy_plan_patch_model != False + + # Construct a model instance of BackupPolicyPlanPatch by calling from_dict on the json representation + backup_policy_plan_patch_model_dict = BackupPolicyPlanPatch.from_dict(backup_policy_plan_patch_model_json).__dict__ + backup_policy_plan_patch_model2 = BackupPolicyPlanPatch(**backup_policy_plan_patch_model_dict) + + # Verify the model instances are equivalent + assert backup_policy_plan_patch_model == backup_policy_plan_patch_model2 + + # Convert model instance back to dict and verify no loss of data + backup_policy_plan_patch_model_json2 = backup_policy_plan_patch_model.to_dict() + assert backup_policy_plan_patch_model_json2 == backup_policy_plan_patch_model_json + +class TestModel_BackupPolicyPlanPrototype(): + """ + Test Class for BackupPolicyPlanPrototype + """ + + def test_backup_policy_plan_prototype_serialization(self): + """ + Test serialization/deserialization for BackupPolicyPlanPrototype + """ + + # Construct dict forms of any model objects needed in order to build this model. + + backup_policy_plan_deletion_trigger_prototype_model = {} # BackupPolicyPlanDeletionTriggerPrototype + backup_policy_plan_deletion_trigger_prototype_model['delete_after'] = 20 + backup_policy_plan_deletion_trigger_prototype_model['delete_over_count'] = 20 + + # Construct a json representation of a BackupPolicyPlanPrototype model + backup_policy_plan_prototype_model_json = {} + backup_policy_plan_prototype_model_json['active'] = True + backup_policy_plan_prototype_model_json['attach_user_tags'] = ['my-daily-backup-plan'] + backup_policy_plan_prototype_model_json['copy_user_tags'] = True + backup_policy_plan_prototype_model_json['cron_spec'] = '*/5 1,2,3 * * *' + backup_policy_plan_prototype_model_json['deletion_trigger'] = backup_policy_plan_deletion_trigger_prototype_model + backup_policy_plan_prototype_model_json['name'] = 'my-policy-plan' + + # Construct a model instance of BackupPolicyPlanPrototype by calling from_dict on the json representation + backup_policy_plan_prototype_model = BackupPolicyPlanPrototype.from_dict(backup_policy_plan_prototype_model_json) + assert backup_policy_plan_prototype_model != False + + # Construct a model instance of BackupPolicyPlanPrototype by calling from_dict on the json representation + backup_policy_plan_prototype_model_dict = BackupPolicyPlanPrototype.from_dict(backup_policy_plan_prototype_model_json).__dict__ + backup_policy_plan_prototype_model2 = BackupPolicyPlanPrototype(**backup_policy_plan_prototype_model_dict) + + # Verify the model instances are equivalent + assert backup_policy_plan_prototype_model == backup_policy_plan_prototype_model2 + + # Convert model instance back to dict and verify no loss of data + backup_policy_plan_prototype_model_json2 = backup_policy_plan_prototype_model.to_dict() + assert backup_policy_plan_prototype_model_json2 == backup_policy_plan_prototype_model_json + +class TestModel_BackupPolicyPlanReference(): + """ + Test Class for BackupPolicyPlanReference + """ + + def test_backup_policy_plan_reference_serialization(self): + """ + Test serialization/deserialization for BackupPolicyPlanReference + """ + + # Construct dict forms of any model objects needed in order to build this model. + + backup_policy_plan_reference_deleted_model = {} # BackupPolicyPlanReferenceDeleted + backup_policy_plan_reference_deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + + # Construct a json representation of a BackupPolicyPlanReference model + backup_policy_plan_reference_model_json = {} + backup_policy_plan_reference_model_json['deleted'] = backup_policy_plan_reference_deleted_model + backup_policy_plan_reference_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178' + backup_policy_plan_reference_model_json['id'] = 'r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178' + backup_policy_plan_reference_model_json['name'] = 'my-policy-plan' + backup_policy_plan_reference_model_json['resource_type'] = 'backup_policy_plan' + + # Construct a model instance of BackupPolicyPlanReference by calling from_dict on the json representation + backup_policy_plan_reference_model = BackupPolicyPlanReference.from_dict(backup_policy_plan_reference_model_json) + assert backup_policy_plan_reference_model != False + + # Construct a model instance of BackupPolicyPlanReference by calling from_dict on the json representation + backup_policy_plan_reference_model_dict = BackupPolicyPlanReference.from_dict(backup_policy_plan_reference_model_json).__dict__ + backup_policy_plan_reference_model2 = BackupPolicyPlanReference(**backup_policy_plan_reference_model_dict) + + # Verify the model instances are equivalent + assert backup_policy_plan_reference_model == backup_policy_plan_reference_model2 + + # Convert model instance back to dict and verify no loss of data + backup_policy_plan_reference_model_json2 = backup_policy_plan_reference_model.to_dict() + assert backup_policy_plan_reference_model_json2 == backup_policy_plan_reference_model_json + +class TestModel_BackupPolicyPlanReferenceDeleted(): + """ + Test Class for BackupPolicyPlanReferenceDeleted + """ + + def test_backup_policy_plan_reference_deleted_serialization(self): + """ + Test serialization/deserialization for BackupPolicyPlanReferenceDeleted + """ + + # Construct a json representation of a BackupPolicyPlanReferenceDeleted model + backup_policy_plan_reference_deleted_model_json = {} + backup_policy_plan_reference_deleted_model_json['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + + # Construct a model instance of BackupPolicyPlanReferenceDeleted by calling from_dict on the json representation + backup_policy_plan_reference_deleted_model = BackupPolicyPlanReferenceDeleted.from_dict(backup_policy_plan_reference_deleted_model_json) + assert backup_policy_plan_reference_deleted_model != False + + # Construct a model instance of BackupPolicyPlanReferenceDeleted by calling from_dict on the json representation + backup_policy_plan_reference_deleted_model_dict = BackupPolicyPlanReferenceDeleted.from_dict(backup_policy_plan_reference_deleted_model_json).__dict__ + backup_policy_plan_reference_deleted_model2 = BackupPolicyPlanReferenceDeleted(**backup_policy_plan_reference_deleted_model_dict) + + # Verify the model instances are equivalent + assert backup_policy_plan_reference_deleted_model == backup_policy_plan_reference_deleted_model2 + + # Convert model instance back to dict and verify no loss of data + backup_policy_plan_reference_deleted_model_json2 = backup_policy_plan_reference_deleted_model.to_dict() + assert backup_policy_plan_reference_deleted_model_json2 == backup_policy_plan_reference_deleted_model_json + class TestModel_BareMetalServer(): """ Test Class for BareMetalServer @@ -32710,6 +36136,9 @@ def test_default_routing_table_serialization(self): # Construct dict forms of any model objects needed in order to build this model. + resource_filter_model = {} # ResourceFilter + resource_filter_model['resource_type'] = 'vpn_server' + route_reference_deleted_model = {} # RouteReferenceDeleted route_reference_deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' @@ -32732,6 +36161,7 @@ def test_default_routing_table_serialization(self): # Construct a json representation of a DefaultRoutingTable model default_routing_table_model_json = {} + default_routing_table_model_json['accept_routes_from'] = [resource_filter_model] default_routing_table_model_json['created_at'] = '2019-01-01T12:00:00Z' default_routing_table_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840' default_routing_table_model_json['id'] = '1a15dca5-7e33-45e1-b7c5-bc690e569531' @@ -43436,6 +46866,35 @@ def test_reserved_ip_reference_deleted_serialization(self): reserved_ip_reference_deleted_model_json2 = reserved_ip_reference_deleted_model.to_dict() assert reserved_ip_reference_deleted_model_json2 == reserved_ip_reference_deleted_model_json +class TestModel_ResourceFilter(): + """ + Test Class for ResourceFilter + """ + + def test_resource_filter_serialization(self): + """ + Test serialization/deserialization for ResourceFilter + """ + + # Construct a json representation of a ResourceFilter model + resource_filter_model_json = {} + resource_filter_model_json['resource_type'] = 'vpn_gateway' + + # Construct a model instance of ResourceFilter by calling from_dict on the json representation + resource_filter_model = ResourceFilter.from_dict(resource_filter_model_json) + assert resource_filter_model != False + + # Construct a model instance of ResourceFilter by calling from_dict on the json representation + resource_filter_model_dict = ResourceFilter.from_dict(resource_filter_model_json).__dict__ + resource_filter_model2 = ResourceFilter(**resource_filter_model_dict) + + # Verify the model instances are equivalent + assert resource_filter_model == resource_filter_model2 + + # Convert model instance back to dict and verify no loss of data + resource_filter_model_json2 = resource_filter_model.to_dict() + assert resource_filter_model_json2 == resource_filter_model_json + class TestModel_ResourceGroupReference(): """ Test Class for ResourceGroupReference @@ -43479,6 +46938,17 @@ def test_route_serialization(self): # Construct dict forms of any model objects needed in order to build this model. + vpn_gateway_reference_deleted_model = {} # VPNGatewayReferenceDeleted + vpn_gateway_reference_deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + + route_creator_model = {} # RouteCreatorVPNGatewayReference + route_creator_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b' + route_creator_model['deleted'] = vpn_gateway_reference_deleted_model + route_creator_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b' + route_creator_model['id'] = 'ddf51bec-3424-11e8-b467-0ed5f89f718b' + route_creator_model['name'] = 'my-vpn-gateway' + route_creator_model['resource_type'] = 'vpn_gateway' + route_next_hop_model = {} # RouteNextHopIP route_next_hop_model['address'] = '192.168.3.4' @@ -43490,12 +46960,14 @@ def test_route_serialization(self): route_model_json = {} route_model_json['action'] = 'delegate' route_model_json['created_at'] = '2019-01-01T12:00:00Z' + route_model_json['creator'] = route_creator_model route_model_json['destination'] = '192.168.3.0/24' route_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531' route_model_json['id'] = '1a15dca5-7e33-45e1-b7c5-bc690e569531' route_model_json['lifecycle_state'] = 'stable' route_model_json['name'] = 'my-route-1' route_model_json['next_hop'] = route_next_hop_model + route_model_json['origin'] = 'service' route_model_json['zone'] = zone_reference_model # Construct a model instance of Route by calling from_dict on the json representation @@ -43531,6 +47003,17 @@ def test_route_collection_serialization(self): route_collection_next_model = {} # RouteCollectionNext route_collection_next_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20' + vpn_gateway_reference_deleted_model = {} # VPNGatewayReferenceDeleted + vpn_gateway_reference_deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + + route_creator_model = {} # RouteCreatorVPNGatewayReference + route_creator_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b' + route_creator_model['deleted'] = vpn_gateway_reference_deleted_model + route_creator_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b' + route_creator_model['id'] = 'ddf51bec-3424-11e8-b467-0ed5f89f718b' + route_creator_model['name'] = 'my-vpn-gateway' + route_creator_model['resource_type'] = 'vpn_gateway' + route_next_hop_model = {} # RouteNextHopIP route_next_hop_model['address'] = '192.168.3.4' @@ -43541,12 +47024,14 @@ def test_route_collection_serialization(self): route_model = {} # Route route_model['action'] = 'delegate' route_model['created_at'] = '2019-01-01T12:00:00Z' + route_model['creator'] = route_creator_model route_model['destination'] = '192.168.3.0/24' route_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531' route_model['id'] = '1a15dca5-7e33-45e1-b7c5-bc690e569531' route_model['lifecycle_state'] = 'stable' route_model['name'] = 'my-route-1' route_model['next_hop'] = route_next_hop_model + route_model['origin'] = 'service' route_model['zone'] = zone_reference_model # Construct a json representation of a RouteCollection model @@ -43671,8 +47156,8 @@ def test_route_prototype_serialization(self): # Construct dict forms of any model objects needed in order to build this model. - route_next_hop_prototype_model = {} # RouteNextHopPrototypeRouteNextHopIP - route_next_hop_prototype_model['address'] = '192.168.3.4' + route_prototype_next_hop_model = {} # RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP + route_prototype_next_hop_model['address'] = '192.168.3.4' zone_identity_model = {} # ZoneIdentityByName zone_identity_model['name'] = 'us-south-1' @@ -43681,8 +47166,8 @@ def test_route_prototype_serialization(self): route_prototype_model_json = {} route_prototype_model_json['action'] = 'deliver' route_prototype_model_json['destination'] = '192.168.3.0/24' - route_prototype_model_json['name'] = 'my-route-2' - route_prototype_model_json['next_hop'] = route_next_hop_prototype_model + route_prototype_model_json['name'] = 'my-route-1' + route_prototype_model_json['next_hop'] = route_prototype_next_hop_model route_prototype_model_json['zone'] = zone_identity_model # Construct a model instance of RoutePrototype by calling from_dict on the json representation @@ -43778,6 +47263,9 @@ def test_routing_table_serialization(self): # Construct dict forms of any model objects needed in order to build this model. + resource_filter_model = {} # ResourceFilter + resource_filter_model['resource_type'] = 'vpn_server' + route_reference_deleted_model = {} # RouteReferenceDeleted route_reference_deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' @@ -43800,6 +47288,7 @@ def test_routing_table_serialization(self): # Construct a json representation of a RoutingTable model routing_table_model_json = {} + routing_table_model_json['accept_routes_from'] = [resource_filter_model] routing_table_model_json['created_at'] = '2019-01-01T12:00:00Z' routing_table_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840' routing_table_model_json['id'] = '1a15dca5-7e33-45e1-b7c5-bc690e569531' @@ -43846,6 +47335,9 @@ def test_routing_table_collection_serialization(self): routing_table_collection_next_model = {} # RoutingTableCollectionNext routing_table_collection_next_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20' + resource_filter_model = {} # ResourceFilter + resource_filter_model['resource_type'] = 'vpn_server' + route_reference_deleted_model = {} # RouteReferenceDeleted route_reference_deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' @@ -43867,6 +47359,7 @@ def test_routing_table_collection_serialization(self): subnet_reference_model['resource_type'] = 'subnet' routing_table_model = {} # RoutingTable + routing_table_model['accept_routes_from'] = [resource_filter_model] routing_table_model['created_at'] = '2019-01-01T12:00:00Z' routing_table_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840' routing_table_model['id'] = '1a15dca5-7e33-45e1-b7c5-bc690e569531' @@ -43971,8 +47464,14 @@ def test_routing_table_patch_serialization(self): Test serialization/deserialization for RoutingTablePatch """ + # Construct dict forms of any model objects needed in order to build this model. + + resource_filter_model = {} # ResourceFilter + resource_filter_model['resource_type'] = 'vpn_server' + # Construct a json representation of a RoutingTablePatch model routing_table_patch_model_json = {} + routing_table_patch_model_json['accept_routes_from'] = [resource_filter_model] routing_table_patch_model_json['name'] = 'my-routing-table-2' routing_table_patch_model_json['route_direct_link_ingress'] = True routing_table_patch_model_json['route_transit_gateway_ingress'] = True @@ -44582,6 +48081,16 @@ def test_snapshot_serialization(self): # Construct dict forms of any model objects needed in order to build this model. + backup_policy_plan_reference_deleted_model = {} # BackupPolicyPlanReferenceDeleted + backup_policy_plan_reference_deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + + backup_policy_plan_reference_model = {} # BackupPolicyPlanReference + backup_policy_plan_reference_model['deleted'] = backup_policy_plan_reference_deleted_model + backup_policy_plan_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178' + backup_policy_plan_reference_model['id'] = 'r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178' + backup_policy_plan_reference_model['name'] = 'my-policy-plan' + backup_policy_plan_reference_model['resource_type'] = 'backup_policy_plan' + encryption_key_reference_model = {} # EncryptionKeyReference encryption_key_reference_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179' @@ -44622,6 +48131,7 @@ def test_snapshot_serialization(self): # Construct a json representation of a Snapshot model snapshot_model_json = {} + snapshot_model_json['backup_policy_plan'] = backup_policy_plan_reference_model snapshot_model_json['bootable'] = True snapshot_model_json['captured_at'] = '2019-01-01T12:00:00Z' snapshot_model_json['created_at'] = '2019-01-01T12:00:00Z' @@ -44676,6 +48186,16 @@ def test_snapshot_collection_serialization(self): snapshot_collection_next_model = {} # SnapshotCollectionNext snapshot_collection_next_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/snapshots?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20' + backup_policy_plan_reference_deleted_model = {} # BackupPolicyPlanReferenceDeleted + backup_policy_plan_reference_deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + + backup_policy_plan_reference_model = {} # BackupPolicyPlanReference + backup_policy_plan_reference_model['deleted'] = backup_policy_plan_reference_deleted_model + backup_policy_plan_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178' + backup_policy_plan_reference_model['id'] = 'r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178' + backup_policy_plan_reference_model['name'] = 'my-policy-plan' + backup_policy_plan_reference_model['resource_type'] = 'backup_policy_plan' + encryption_key_reference_model = {} # EncryptionKeyReference encryption_key_reference_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179' @@ -44715,6 +48235,7 @@ def test_snapshot_collection_serialization(self): volume_reference_model['name'] = 'my-volume' snapshot_model = {} # Snapshot + snapshot_model['backup_policy_plan'] = backup_policy_plan_reference_model snapshot_model['bootable'] = True snapshot_model['captured_at'] = '2019-01-01T12:00:00Z' snapshot_model['created_at'] = '2019-01-01T12:00:00Z' @@ -45949,372 +49470,1091 @@ def test_vpn_gateway_connection_collection_serialization(self): vpn_gateway_connection_model['routing_protocol'] = 'none' vpn_gateway_connection_model['tunnels'] = [vpn_gateway_connection_static_route_mode_tunnel_model] - # Construct a json representation of a VPNGatewayConnectionCollection model - vpn_gateway_connection_collection_model_json = {} - vpn_gateway_connection_collection_model_json['connections'] = [vpn_gateway_connection_model] + # Construct a json representation of a VPNGatewayConnectionCollection model + vpn_gateway_connection_collection_model_json = {} + vpn_gateway_connection_collection_model_json['connections'] = [vpn_gateway_connection_model] + + # Construct a model instance of VPNGatewayConnectionCollection by calling from_dict on the json representation + vpn_gateway_connection_collection_model = VPNGatewayConnectionCollection.from_dict(vpn_gateway_connection_collection_model_json) + assert vpn_gateway_connection_collection_model != False + + # Construct a model instance of VPNGatewayConnectionCollection by calling from_dict on the json representation + vpn_gateway_connection_collection_model_dict = VPNGatewayConnectionCollection.from_dict(vpn_gateway_connection_collection_model_json).__dict__ + vpn_gateway_connection_collection_model2 = VPNGatewayConnectionCollection(**vpn_gateway_connection_collection_model_dict) + + # Verify the model instances are equivalent + assert vpn_gateway_connection_collection_model == vpn_gateway_connection_collection_model2 + + # Convert model instance back to dict and verify no loss of data + vpn_gateway_connection_collection_model_json2 = vpn_gateway_connection_collection_model.to_dict() + assert vpn_gateway_connection_collection_model_json2 == vpn_gateway_connection_collection_model_json + +class TestModel_VPNGatewayConnectionDPD(): + """ + Test Class for VPNGatewayConnectionDPD + """ + + def test_vpn_gateway_connection_dpd_serialization(self): + """ + Test serialization/deserialization for VPNGatewayConnectionDPD + """ + + # Construct a json representation of a VPNGatewayConnectionDPD model + vpn_gateway_connection_dpd_model_json = {} + vpn_gateway_connection_dpd_model_json['action'] = 'restart' + vpn_gateway_connection_dpd_model_json['interval'] = 30 + vpn_gateway_connection_dpd_model_json['timeout'] = 120 + + # Construct a model instance of VPNGatewayConnectionDPD by calling from_dict on the json representation + vpn_gateway_connection_dpd_model = VPNGatewayConnectionDPD.from_dict(vpn_gateway_connection_dpd_model_json) + assert vpn_gateway_connection_dpd_model != False + + # Construct a model instance of VPNGatewayConnectionDPD by calling from_dict on the json representation + vpn_gateway_connection_dpd_model_dict = VPNGatewayConnectionDPD.from_dict(vpn_gateway_connection_dpd_model_json).__dict__ + vpn_gateway_connection_dpd_model2 = VPNGatewayConnectionDPD(**vpn_gateway_connection_dpd_model_dict) + + # Verify the model instances are equivalent + assert vpn_gateway_connection_dpd_model == vpn_gateway_connection_dpd_model2 + + # Convert model instance back to dict and verify no loss of data + vpn_gateway_connection_dpd_model_json2 = vpn_gateway_connection_dpd_model.to_dict() + assert vpn_gateway_connection_dpd_model_json2 == vpn_gateway_connection_dpd_model_json + +class TestModel_VPNGatewayConnectionDPDPatch(): + """ + Test Class for VPNGatewayConnectionDPDPatch + """ + + def test_vpn_gateway_connection_dpd_patch_serialization(self): + """ + Test serialization/deserialization for VPNGatewayConnectionDPDPatch + """ + + # Construct a json representation of a VPNGatewayConnectionDPDPatch model + vpn_gateway_connection_dpd_patch_model_json = {} + vpn_gateway_connection_dpd_patch_model_json['action'] = 'restart' + vpn_gateway_connection_dpd_patch_model_json['interval'] = 30 + vpn_gateway_connection_dpd_patch_model_json['timeout'] = 120 + + # Construct a model instance of VPNGatewayConnectionDPDPatch by calling from_dict on the json representation + vpn_gateway_connection_dpd_patch_model = VPNGatewayConnectionDPDPatch.from_dict(vpn_gateway_connection_dpd_patch_model_json) + assert vpn_gateway_connection_dpd_patch_model != False + + # Construct a model instance of VPNGatewayConnectionDPDPatch by calling from_dict on the json representation + vpn_gateway_connection_dpd_patch_model_dict = VPNGatewayConnectionDPDPatch.from_dict(vpn_gateway_connection_dpd_patch_model_json).__dict__ + vpn_gateway_connection_dpd_patch_model2 = VPNGatewayConnectionDPDPatch(**vpn_gateway_connection_dpd_patch_model_dict) + + # Verify the model instances are equivalent + assert vpn_gateway_connection_dpd_patch_model == vpn_gateway_connection_dpd_patch_model2 + + # Convert model instance back to dict and verify no loss of data + vpn_gateway_connection_dpd_patch_model_json2 = vpn_gateway_connection_dpd_patch_model.to_dict() + assert vpn_gateway_connection_dpd_patch_model_json2 == vpn_gateway_connection_dpd_patch_model_json + +class TestModel_VPNGatewayConnectionDPDPrototype(): + """ + Test Class for VPNGatewayConnectionDPDPrototype + """ + + def test_vpn_gateway_connection_dpd_prototype_serialization(self): + """ + Test serialization/deserialization for VPNGatewayConnectionDPDPrototype + """ + + # Construct a json representation of a VPNGatewayConnectionDPDPrototype model + vpn_gateway_connection_dpd_prototype_model_json = {} + vpn_gateway_connection_dpd_prototype_model_json['action'] = 'restart' + vpn_gateway_connection_dpd_prototype_model_json['interval'] = 30 + vpn_gateway_connection_dpd_prototype_model_json['timeout'] = 120 + + # Construct a model instance of VPNGatewayConnectionDPDPrototype by calling from_dict on the json representation + vpn_gateway_connection_dpd_prototype_model = VPNGatewayConnectionDPDPrototype.from_dict(vpn_gateway_connection_dpd_prototype_model_json) + assert vpn_gateway_connection_dpd_prototype_model != False + + # Construct a model instance of VPNGatewayConnectionDPDPrototype by calling from_dict on the json representation + vpn_gateway_connection_dpd_prototype_model_dict = VPNGatewayConnectionDPDPrototype.from_dict(vpn_gateway_connection_dpd_prototype_model_json).__dict__ + vpn_gateway_connection_dpd_prototype_model2 = VPNGatewayConnectionDPDPrototype(**vpn_gateway_connection_dpd_prototype_model_dict) + + # Verify the model instances are equivalent + assert vpn_gateway_connection_dpd_prototype_model == vpn_gateway_connection_dpd_prototype_model2 + + # Convert model instance back to dict and verify no loss of data + vpn_gateway_connection_dpd_prototype_model_json2 = vpn_gateway_connection_dpd_prototype_model.to_dict() + assert vpn_gateway_connection_dpd_prototype_model_json2 == vpn_gateway_connection_dpd_prototype_model_json + +class TestModel_VPNGatewayConnectionLocalCIDRs(): + """ + Test Class for VPNGatewayConnectionLocalCIDRs + """ + + def test_vpn_gateway_connection_local_cid_rs_serialization(self): + """ + Test serialization/deserialization for VPNGatewayConnectionLocalCIDRs + """ + + # Construct a json representation of a VPNGatewayConnectionLocalCIDRs model + vpn_gateway_connection_local_cid_rs_model_json = {} + vpn_gateway_connection_local_cid_rs_model_json['local_cidrs'] = ['192.168.1.0/24'] + + # Construct a model instance of VPNGatewayConnectionLocalCIDRs by calling from_dict on the json representation + vpn_gateway_connection_local_cid_rs_model = VPNGatewayConnectionLocalCIDRs.from_dict(vpn_gateway_connection_local_cid_rs_model_json) + assert vpn_gateway_connection_local_cid_rs_model != False + + # Construct a model instance of VPNGatewayConnectionLocalCIDRs by calling from_dict on the json representation + vpn_gateway_connection_local_cid_rs_model_dict = VPNGatewayConnectionLocalCIDRs.from_dict(vpn_gateway_connection_local_cid_rs_model_json).__dict__ + vpn_gateway_connection_local_cid_rs_model2 = VPNGatewayConnectionLocalCIDRs(**vpn_gateway_connection_local_cid_rs_model_dict) + + # Verify the model instances are equivalent + assert vpn_gateway_connection_local_cid_rs_model == vpn_gateway_connection_local_cid_rs_model2 + + # Convert model instance back to dict and verify no loss of data + vpn_gateway_connection_local_cid_rs_model_json2 = vpn_gateway_connection_local_cid_rs_model.to_dict() + assert vpn_gateway_connection_local_cid_rs_model_json2 == vpn_gateway_connection_local_cid_rs_model_json + +class TestModel_VPNGatewayConnectionPeerCIDRs(): + """ + Test Class for VPNGatewayConnectionPeerCIDRs + """ + + def test_vpn_gateway_connection_peer_cid_rs_serialization(self): + """ + Test serialization/deserialization for VPNGatewayConnectionPeerCIDRs + """ + + # Construct a json representation of a VPNGatewayConnectionPeerCIDRs model + vpn_gateway_connection_peer_cid_rs_model_json = {} + vpn_gateway_connection_peer_cid_rs_model_json['peer_cidrs'] = ['10.45.1.0/24'] + + # Construct a model instance of VPNGatewayConnectionPeerCIDRs by calling from_dict on the json representation + vpn_gateway_connection_peer_cid_rs_model = VPNGatewayConnectionPeerCIDRs.from_dict(vpn_gateway_connection_peer_cid_rs_model_json) + assert vpn_gateway_connection_peer_cid_rs_model != False + + # Construct a model instance of VPNGatewayConnectionPeerCIDRs by calling from_dict on the json representation + vpn_gateway_connection_peer_cid_rs_model_dict = VPNGatewayConnectionPeerCIDRs.from_dict(vpn_gateway_connection_peer_cid_rs_model_json).__dict__ + vpn_gateway_connection_peer_cid_rs_model2 = VPNGatewayConnectionPeerCIDRs(**vpn_gateway_connection_peer_cid_rs_model_dict) + + # Verify the model instances are equivalent + assert vpn_gateway_connection_peer_cid_rs_model == vpn_gateway_connection_peer_cid_rs_model2 + + # Convert model instance back to dict and verify no loss of data + vpn_gateway_connection_peer_cid_rs_model_json2 = vpn_gateway_connection_peer_cid_rs_model.to_dict() + assert vpn_gateway_connection_peer_cid_rs_model_json2 == vpn_gateway_connection_peer_cid_rs_model_json + +class TestModel_VPNGatewayConnectionReference(): + """ + Test Class for VPNGatewayConnectionReference + """ + + def test_vpn_gateway_connection_reference_serialization(self): + """ + Test serialization/deserialization for VPNGatewayConnectionReference + """ + + # Construct dict forms of any model objects needed in order to build this model. + + vpn_gateway_connection_reference_deleted_model = {} # VPNGatewayConnectionReferenceDeleted + vpn_gateway_connection_reference_deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + + # Construct a json representation of a VPNGatewayConnectionReference model + vpn_gateway_connection_reference_model_json = {} + vpn_gateway_connection_reference_model_json['deleted'] = vpn_gateway_connection_reference_deleted_model + vpn_gateway_connection_reference_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b' + vpn_gateway_connection_reference_model_json['id'] = 'a10a5771-dc23-442c-8460-c3601d8542f7' + vpn_gateway_connection_reference_model_json['name'] = 'my-vpn-connection' + vpn_gateway_connection_reference_model_json['resource_type'] = 'vpn_gateway_connection' + + # Construct a model instance of VPNGatewayConnectionReference by calling from_dict on the json representation + vpn_gateway_connection_reference_model = VPNGatewayConnectionReference.from_dict(vpn_gateway_connection_reference_model_json) + assert vpn_gateway_connection_reference_model != False + + # Construct a model instance of VPNGatewayConnectionReference by calling from_dict on the json representation + vpn_gateway_connection_reference_model_dict = VPNGatewayConnectionReference.from_dict(vpn_gateway_connection_reference_model_json).__dict__ + vpn_gateway_connection_reference_model2 = VPNGatewayConnectionReference(**vpn_gateway_connection_reference_model_dict) + + # Verify the model instances are equivalent + assert vpn_gateway_connection_reference_model == vpn_gateway_connection_reference_model2 + + # Convert model instance back to dict and verify no loss of data + vpn_gateway_connection_reference_model_json2 = vpn_gateway_connection_reference_model.to_dict() + assert vpn_gateway_connection_reference_model_json2 == vpn_gateway_connection_reference_model_json + +class TestModel_VPNGatewayConnectionReferenceDeleted(): + """ + Test Class for VPNGatewayConnectionReferenceDeleted + """ + + def test_vpn_gateway_connection_reference_deleted_serialization(self): + """ + Test serialization/deserialization for VPNGatewayConnectionReferenceDeleted + """ + + # Construct a json representation of a VPNGatewayConnectionReferenceDeleted model + vpn_gateway_connection_reference_deleted_model_json = {} + vpn_gateway_connection_reference_deleted_model_json['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + + # Construct a model instance of VPNGatewayConnectionReferenceDeleted by calling from_dict on the json representation + vpn_gateway_connection_reference_deleted_model = VPNGatewayConnectionReferenceDeleted.from_dict(vpn_gateway_connection_reference_deleted_model_json) + assert vpn_gateway_connection_reference_deleted_model != False + + # Construct a model instance of VPNGatewayConnectionReferenceDeleted by calling from_dict on the json representation + vpn_gateway_connection_reference_deleted_model_dict = VPNGatewayConnectionReferenceDeleted.from_dict(vpn_gateway_connection_reference_deleted_model_json).__dict__ + vpn_gateway_connection_reference_deleted_model2 = VPNGatewayConnectionReferenceDeleted(**vpn_gateway_connection_reference_deleted_model_dict) + + # Verify the model instances are equivalent + assert vpn_gateway_connection_reference_deleted_model == vpn_gateway_connection_reference_deleted_model2 + + # Convert model instance back to dict and verify no loss of data + vpn_gateway_connection_reference_deleted_model_json2 = vpn_gateway_connection_reference_deleted_model.to_dict() + assert vpn_gateway_connection_reference_deleted_model_json2 == vpn_gateway_connection_reference_deleted_model_json + +class TestModel_VPNGatewayConnectionStaticRouteModeTunnel(): + """ + Test Class for VPNGatewayConnectionStaticRouteModeTunnel + """ + + def test_vpn_gateway_connection_static_route_mode_tunnel_serialization(self): + """ + Test serialization/deserialization for VPNGatewayConnectionStaticRouteModeTunnel + """ + + # Construct dict forms of any model objects needed in order to build this model. + + ip_model = {} # IP + ip_model['address'] = '192.168.3.4' + + # Construct a json representation of a VPNGatewayConnectionStaticRouteModeTunnel model + vpn_gateway_connection_static_route_mode_tunnel_model_json = {} + vpn_gateway_connection_static_route_mode_tunnel_model_json['public_ip'] = ip_model + vpn_gateway_connection_static_route_mode_tunnel_model_json['status'] = 'down' + + # Construct a model instance of VPNGatewayConnectionStaticRouteModeTunnel by calling from_dict on the json representation + vpn_gateway_connection_static_route_mode_tunnel_model = VPNGatewayConnectionStaticRouteModeTunnel.from_dict(vpn_gateway_connection_static_route_mode_tunnel_model_json) + assert vpn_gateway_connection_static_route_mode_tunnel_model != False + + # Construct a model instance of VPNGatewayConnectionStaticRouteModeTunnel by calling from_dict on the json representation + vpn_gateway_connection_static_route_mode_tunnel_model_dict = VPNGatewayConnectionStaticRouteModeTunnel.from_dict(vpn_gateway_connection_static_route_mode_tunnel_model_json).__dict__ + vpn_gateway_connection_static_route_mode_tunnel_model2 = VPNGatewayConnectionStaticRouteModeTunnel(**vpn_gateway_connection_static_route_mode_tunnel_model_dict) + + # Verify the model instances are equivalent + assert vpn_gateway_connection_static_route_mode_tunnel_model == vpn_gateway_connection_static_route_mode_tunnel_model2 + + # Convert model instance back to dict and verify no loss of data + vpn_gateway_connection_static_route_mode_tunnel_model_json2 = vpn_gateway_connection_static_route_mode_tunnel_model.to_dict() + assert vpn_gateway_connection_static_route_mode_tunnel_model_json2 == vpn_gateway_connection_static_route_mode_tunnel_model_json + +class TestModel_VPNGatewayMember(): + """ + Test Class for VPNGatewayMember + """ + + def test_vpn_gateway_member_serialization(self): + """ + Test serialization/deserialization for VPNGatewayMember + """ + + # Construct dict forms of any model objects needed in order to build this model. + + ip_model = {} # IP + ip_model['address'] = '192.168.3.4' + + # Construct a json representation of a VPNGatewayMember model + vpn_gateway_member_model_json = {} + vpn_gateway_member_model_json['private_ip'] = ip_model + vpn_gateway_member_model_json['public_ip'] = ip_model + vpn_gateway_member_model_json['role'] = 'active' + vpn_gateway_member_model_json['status'] = 'available' + + # Construct a model instance of VPNGatewayMember by calling from_dict on the json representation + vpn_gateway_member_model = VPNGatewayMember.from_dict(vpn_gateway_member_model_json) + assert vpn_gateway_member_model != False + + # Construct a model instance of VPNGatewayMember by calling from_dict on the json representation + vpn_gateway_member_model_dict = VPNGatewayMember.from_dict(vpn_gateway_member_model_json).__dict__ + vpn_gateway_member_model2 = VPNGatewayMember(**vpn_gateway_member_model_dict) + + # Verify the model instances are equivalent + assert vpn_gateway_member_model == vpn_gateway_member_model2 + + # Convert model instance back to dict and verify no loss of data + vpn_gateway_member_model_json2 = vpn_gateway_member_model.to_dict() + assert vpn_gateway_member_model_json2 == vpn_gateway_member_model_json + +class TestModel_VPNGatewayPatch(): + """ + Test Class for VPNGatewayPatch + """ + + def test_vpn_gateway_patch_serialization(self): + """ + Test serialization/deserialization for VPNGatewayPatch + """ + + # Construct a json representation of a VPNGatewayPatch model + vpn_gateway_patch_model_json = {} + vpn_gateway_patch_model_json['name'] = 'my-vpn-gateway' + + # Construct a model instance of VPNGatewayPatch by calling from_dict on the json representation + vpn_gateway_patch_model = VPNGatewayPatch.from_dict(vpn_gateway_patch_model_json) + assert vpn_gateway_patch_model != False + + # Construct a model instance of VPNGatewayPatch by calling from_dict on the json representation + vpn_gateway_patch_model_dict = VPNGatewayPatch.from_dict(vpn_gateway_patch_model_json).__dict__ + vpn_gateway_patch_model2 = VPNGatewayPatch(**vpn_gateway_patch_model_dict) + + # Verify the model instances are equivalent + assert vpn_gateway_patch_model == vpn_gateway_patch_model2 + + # Convert model instance back to dict and verify no loss of data + vpn_gateway_patch_model_json2 = vpn_gateway_patch_model.to_dict() + assert vpn_gateway_patch_model_json2 == vpn_gateway_patch_model_json + +class TestModel_VPNGatewayReferenceDeleted(): + """ + Test Class for VPNGatewayReferenceDeleted + """ + + def test_vpn_gateway_reference_deleted_serialization(self): + """ + Test serialization/deserialization for VPNGatewayReferenceDeleted + """ + + # Construct a json representation of a VPNGatewayReferenceDeleted model + vpn_gateway_reference_deleted_model_json = {} + vpn_gateway_reference_deleted_model_json['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + + # Construct a model instance of VPNGatewayReferenceDeleted by calling from_dict on the json representation + vpn_gateway_reference_deleted_model = VPNGatewayReferenceDeleted.from_dict(vpn_gateway_reference_deleted_model_json) + assert vpn_gateway_reference_deleted_model != False + + # Construct a model instance of VPNGatewayReferenceDeleted by calling from_dict on the json representation + vpn_gateway_reference_deleted_model_dict = VPNGatewayReferenceDeleted.from_dict(vpn_gateway_reference_deleted_model_json).__dict__ + vpn_gateway_reference_deleted_model2 = VPNGatewayReferenceDeleted(**vpn_gateway_reference_deleted_model_dict) + + # Verify the model instances are equivalent + assert vpn_gateway_reference_deleted_model == vpn_gateway_reference_deleted_model2 + + # Convert model instance back to dict and verify no loss of data + vpn_gateway_reference_deleted_model_json2 = vpn_gateway_reference_deleted_model.to_dict() + assert vpn_gateway_reference_deleted_model_json2 == vpn_gateway_reference_deleted_model_json + +class TestModel_VPNServer(): + """ + Test Class for VPNServer + """ + + def test_vpn_server_serialization(self): + """ + Test serialization/deserialization for VPNServer + """ + + # Construct dict forms of any model objects needed in order to build this model. + + certificate_instance_reference_model = {} # CertificateInstanceReference + certificate_instance_reference_model['crn'] = 'crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5' + + vpn_server_authentication_by_username_id_provider_model = {} # VPNServerAuthenticationByUsernameIdProviderByIAM + vpn_server_authentication_by_username_id_provider_model['provider_type'] = 'iam' + + vpn_server_authentication_model = {} # VPNServerAuthenticationByUsername + vpn_server_authentication_model['method'] = 'certificate' + vpn_server_authentication_model['identity_provider'] = vpn_server_authentication_by_username_id_provider_model + + ip_model = {} # IP + ip_model['address'] = '192.168.3.4' + + reserved_ip_reference_deleted_model = {} # ReservedIPReferenceDeleted + reserved_ip_reference_deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + + reserved_ip_reference_model = {} # ReservedIPReference + reserved_ip_reference_model['address'] = '192.168.3.4' + reserved_ip_reference_model['deleted'] = reserved_ip_reference_deleted_model + reserved_ip_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb' + reserved_ip_reference_model['id'] = '6d353a0f-aeb1-4ae1-832e-1110d10981bb' + reserved_ip_reference_model['name'] = 'my-reserved-ip' + reserved_ip_reference_model['resource_type'] = 'subnet_reserved_ip' + + resource_group_reference_model = {} # ResourceGroupReference + resource_group_reference_model['href'] = 'https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345' + resource_group_reference_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + resource_group_reference_model['name'] = 'my-resource-group' + + security_group_reference_deleted_model = {} # SecurityGroupReferenceDeleted + security_group_reference_deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + + security_group_reference_model = {} # SecurityGroupReference + security_group_reference_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271' + security_group_reference_model['deleted'] = security_group_reference_deleted_model + security_group_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271' + security_group_reference_model['id'] = 'be5df5ca-12a0-494b-907e-aa6ec2bfa271' + security_group_reference_model['name'] = 'my-security-group' + + subnet_reference_deleted_model = {} # SubnetReferenceDeleted + subnet_reference_deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + + subnet_reference_model = {} # SubnetReference + subnet_reference_model['crn'] = 'crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e' + subnet_reference_model['deleted'] = subnet_reference_deleted_model + subnet_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e' + subnet_reference_model['id'] = '7ec86020-1c6e-4889-b3f0-a15f2e50f87e' + subnet_reference_model['name'] = 'my-subnet' + subnet_reference_model['resource_type'] = 'subnet' + + vpc_reference_deleted_model = {} # VPCReferenceDeleted + vpc_reference_deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + + vpc_reference_model = {} # VPCReference + vpc_reference_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b' + vpc_reference_model['deleted'] = vpc_reference_deleted_model + vpc_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b' + vpc_reference_model['id'] = '4727d842-f94f-4a2d-824a-9bc9b02c523b' + vpc_reference_model['name'] = 'my-vpc' + vpc_reference_model['resource_type'] = 'vpc' + + # Construct a json representation of a VPNServer model + vpn_server_model_json = {} + vpn_server_model_json['certificate'] = certificate_instance_reference_model + vpn_server_model_json['client_authentication'] = [vpn_server_authentication_model] + vpn_server_model_json['client_auto_delete'] = True + vpn_server_model_json['client_auto_delete_timeout'] = 1 + vpn_server_model_json['client_dns_server_ips'] = [ip_model] + vpn_server_model_json['client_idle_timeout'] = 600 + vpn_server_model_json['client_ip_pool'] = '172.16.0.0/16' + vpn_server_model_json['created_at'] = '2019-01-01T12:00:00Z' + vpn_server_model_json['crn'] = 'crn:v1:bluemix:public:is:us-south:a/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5' + vpn_server_model_json['enable_split_tunneling'] = True + vpn_server_model_json['health_state'] = 'ok' + vpn_server_model_json['hostname'] = 'a8506291.us-south.vpn-server.appdomain.cloud' + vpn_server_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5' + vpn_server_model_json['id'] = 'r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5' + vpn_server_model_json['lifecycle_state'] = 'stable' + vpn_server_model_json['name'] = 'my-vpn-server' + vpn_server_model_json['port'] = 443 + vpn_server_model_json['private_ips'] = [reserved_ip_reference_model] + vpn_server_model_json['protocol'] = 'udp' + vpn_server_model_json['resource_group'] = resource_group_reference_model + vpn_server_model_json['resource_type'] = 'vpn_server' + vpn_server_model_json['security_groups'] = [security_group_reference_model] + vpn_server_model_json['subnets'] = [subnet_reference_model] + vpn_server_model_json['vpc'] = vpc_reference_model + + # Construct a model instance of VPNServer by calling from_dict on the json representation + vpn_server_model = VPNServer.from_dict(vpn_server_model_json) + assert vpn_server_model != False + + # Construct a model instance of VPNServer by calling from_dict on the json representation + vpn_server_model_dict = VPNServer.from_dict(vpn_server_model_json).__dict__ + vpn_server_model2 = VPNServer(**vpn_server_model_dict) + + # Verify the model instances are equivalent + assert vpn_server_model == vpn_server_model2 + + # Convert model instance back to dict and verify no loss of data + vpn_server_model_json2 = vpn_server_model.to_dict() + assert vpn_server_model_json2 == vpn_server_model_json + +class TestModel_VPNServerClient(): + """ + Test Class for VPNServerClient + """ + + def test_vpn_server_client_serialization(self): + """ + Test serialization/deserialization for VPNServerClient + """ + + # Construct dict forms of any model objects needed in order to build this model. + + ip_model = {} # IP + ip_model['address'] = '192.168.3.4' + + # Construct a json representation of a VPNServerClient model + vpn_server_client_model_json = {} + vpn_server_client_model_json['client_ip'] = ip_model + vpn_server_client_model_json['common_name'] = 'testString' + vpn_server_client_model_json['created_at'] = '2019-01-01T12:00:00Z' + vpn_server_client_model_json['disconnected_at'] = '2019-01-01T12:00:00Z' + vpn_server_client_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/8e454ead-0db7-48ac-9a8b-2698d8c470a7/clients/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531' + vpn_server_client_model_json['id'] = 'r006-1a15dca5-7e33-45e1-b7c5-bc690e569531' + vpn_server_client_model_json['remote_ip'] = ip_model + vpn_server_client_model_json['remote_port'] = 22 + vpn_server_client_model_json['resource_type'] = 'vpn_server_client' + vpn_server_client_model_json['status'] = 'connected' + vpn_server_client_model_json['username'] = 'testString' + + # Construct a model instance of VPNServerClient by calling from_dict on the json representation + vpn_server_client_model = VPNServerClient.from_dict(vpn_server_client_model_json) + assert vpn_server_client_model != False + + # Construct a model instance of VPNServerClient by calling from_dict on the json representation + vpn_server_client_model_dict = VPNServerClient.from_dict(vpn_server_client_model_json).__dict__ + vpn_server_client_model2 = VPNServerClient(**vpn_server_client_model_dict) + + # Verify the model instances are equivalent + assert vpn_server_client_model == vpn_server_client_model2 + + # Convert model instance back to dict and verify no loss of data + vpn_server_client_model_json2 = vpn_server_client_model.to_dict() + assert vpn_server_client_model_json2 == vpn_server_client_model_json + +class TestModel_VPNServerClientCollection(): + """ + Test Class for VPNServerClientCollection + """ + + def test_vpn_server_client_collection_serialization(self): + """ + Test serialization/deserialization for VPNServerClientCollection + """ - # Construct a model instance of VPNGatewayConnectionCollection by calling from_dict on the json representation - vpn_gateway_connection_collection_model = VPNGatewayConnectionCollection.from_dict(vpn_gateway_connection_collection_model_json) - assert vpn_gateway_connection_collection_model != False + # Construct dict forms of any model objects needed in order to build this model. - # Construct a model instance of VPNGatewayConnectionCollection by calling from_dict on the json representation - vpn_gateway_connection_collection_model_dict = VPNGatewayConnectionCollection.from_dict(vpn_gateway_connection_collection_model_json).__dict__ - vpn_gateway_connection_collection_model2 = VPNGatewayConnectionCollection(**vpn_gateway_connection_collection_model_dict) + ip_model = {} # IP + ip_model['address'] = '192.168.3.4' + + vpn_server_client_model = {} # VPNServerClient + vpn_server_client_model['client_ip'] = ip_model + vpn_server_client_model['common_name'] = 'testString' + vpn_server_client_model['created_at'] = '2019-01-01T12:00:00Z' + vpn_server_client_model['disconnected_at'] = '2019-01-01T12:00:00Z' + vpn_server_client_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/8e454ead-0db7-48ac-9a8b-2698d8c470a7/clients/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531' + vpn_server_client_model['id'] = 'r006-1a15dca5-7e33-45e1-b7c5-bc690e569531' + vpn_server_client_model['remote_ip'] = ip_model + vpn_server_client_model['remote_port'] = 22 + vpn_server_client_model['resource_type'] = 'vpn_server_client' + vpn_server_client_model['status'] = 'connected' + vpn_server_client_model['username'] = 'testString' + + vpn_server_client_collection_first_model = {} # VPNServerClientCollectionFirst + vpn_server_client_collection_first_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531/clients?limit=20' + + vpn_server_client_collection_next_model = {} # VPNServerClientCollectionNext + vpn_server_client_collection_next_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531/clients?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20' + + # Construct a json representation of a VPNServerClientCollection model + vpn_server_client_collection_model_json = {} + vpn_server_client_collection_model_json['clients'] = [vpn_server_client_model] + vpn_server_client_collection_model_json['first'] = vpn_server_client_collection_first_model + vpn_server_client_collection_model_json['limit'] = 20 + vpn_server_client_collection_model_json['next'] = vpn_server_client_collection_next_model + vpn_server_client_collection_model_json['total_count'] = 132 + + # Construct a model instance of VPNServerClientCollection by calling from_dict on the json representation + vpn_server_client_collection_model = VPNServerClientCollection.from_dict(vpn_server_client_collection_model_json) + assert vpn_server_client_collection_model != False + + # Construct a model instance of VPNServerClientCollection by calling from_dict on the json representation + vpn_server_client_collection_model_dict = VPNServerClientCollection.from_dict(vpn_server_client_collection_model_json).__dict__ + vpn_server_client_collection_model2 = VPNServerClientCollection(**vpn_server_client_collection_model_dict) # Verify the model instances are equivalent - assert vpn_gateway_connection_collection_model == vpn_gateway_connection_collection_model2 + assert vpn_server_client_collection_model == vpn_server_client_collection_model2 # Convert model instance back to dict and verify no loss of data - vpn_gateway_connection_collection_model_json2 = vpn_gateway_connection_collection_model.to_dict() - assert vpn_gateway_connection_collection_model_json2 == vpn_gateway_connection_collection_model_json + vpn_server_client_collection_model_json2 = vpn_server_client_collection_model.to_dict() + assert vpn_server_client_collection_model_json2 == vpn_server_client_collection_model_json -class TestModel_VPNGatewayConnectionDPD(): +class TestModel_VPNServerClientCollectionFirst(): """ - Test Class for VPNGatewayConnectionDPD + Test Class for VPNServerClientCollectionFirst """ - def test_vpn_gateway_connection_dpd_serialization(self): + def test_vpn_server_client_collection_first_serialization(self): """ - Test serialization/deserialization for VPNGatewayConnectionDPD + Test serialization/deserialization for VPNServerClientCollectionFirst """ - # Construct a json representation of a VPNGatewayConnectionDPD model - vpn_gateway_connection_dpd_model_json = {} - vpn_gateway_connection_dpd_model_json['action'] = 'restart' - vpn_gateway_connection_dpd_model_json['interval'] = 30 - vpn_gateway_connection_dpd_model_json['timeout'] = 120 + # Construct a json representation of a VPNServerClientCollectionFirst model + vpn_server_client_collection_first_model_json = {} + vpn_server_client_collection_first_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531/clients?limit=20' - # Construct a model instance of VPNGatewayConnectionDPD by calling from_dict on the json representation - vpn_gateway_connection_dpd_model = VPNGatewayConnectionDPD.from_dict(vpn_gateway_connection_dpd_model_json) - assert vpn_gateway_connection_dpd_model != False + # Construct a model instance of VPNServerClientCollectionFirst by calling from_dict on the json representation + vpn_server_client_collection_first_model = VPNServerClientCollectionFirst.from_dict(vpn_server_client_collection_first_model_json) + assert vpn_server_client_collection_first_model != False - # Construct a model instance of VPNGatewayConnectionDPD by calling from_dict on the json representation - vpn_gateway_connection_dpd_model_dict = VPNGatewayConnectionDPD.from_dict(vpn_gateway_connection_dpd_model_json).__dict__ - vpn_gateway_connection_dpd_model2 = VPNGatewayConnectionDPD(**vpn_gateway_connection_dpd_model_dict) + # Construct a model instance of VPNServerClientCollectionFirst by calling from_dict on the json representation + vpn_server_client_collection_first_model_dict = VPNServerClientCollectionFirst.from_dict(vpn_server_client_collection_first_model_json).__dict__ + vpn_server_client_collection_first_model2 = VPNServerClientCollectionFirst(**vpn_server_client_collection_first_model_dict) # Verify the model instances are equivalent - assert vpn_gateway_connection_dpd_model == vpn_gateway_connection_dpd_model2 + assert vpn_server_client_collection_first_model == vpn_server_client_collection_first_model2 # Convert model instance back to dict and verify no loss of data - vpn_gateway_connection_dpd_model_json2 = vpn_gateway_connection_dpd_model.to_dict() - assert vpn_gateway_connection_dpd_model_json2 == vpn_gateway_connection_dpd_model_json + vpn_server_client_collection_first_model_json2 = vpn_server_client_collection_first_model.to_dict() + assert vpn_server_client_collection_first_model_json2 == vpn_server_client_collection_first_model_json -class TestModel_VPNGatewayConnectionDPDPatch(): +class TestModel_VPNServerClientCollectionNext(): """ - Test Class for VPNGatewayConnectionDPDPatch + Test Class for VPNServerClientCollectionNext """ - def test_vpn_gateway_connection_dpd_patch_serialization(self): + def test_vpn_server_client_collection_next_serialization(self): """ - Test serialization/deserialization for VPNGatewayConnectionDPDPatch + Test serialization/deserialization for VPNServerClientCollectionNext """ - # Construct a json representation of a VPNGatewayConnectionDPDPatch model - vpn_gateway_connection_dpd_patch_model_json = {} - vpn_gateway_connection_dpd_patch_model_json['action'] = 'restart' - vpn_gateway_connection_dpd_patch_model_json['interval'] = 30 - vpn_gateway_connection_dpd_patch_model_json['timeout'] = 120 + # Construct a json representation of a VPNServerClientCollectionNext model + vpn_server_client_collection_next_model_json = {} + vpn_server_client_collection_next_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531/clients?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20' - # Construct a model instance of VPNGatewayConnectionDPDPatch by calling from_dict on the json representation - vpn_gateway_connection_dpd_patch_model = VPNGatewayConnectionDPDPatch.from_dict(vpn_gateway_connection_dpd_patch_model_json) - assert vpn_gateway_connection_dpd_patch_model != False + # Construct a model instance of VPNServerClientCollectionNext by calling from_dict on the json representation + vpn_server_client_collection_next_model = VPNServerClientCollectionNext.from_dict(vpn_server_client_collection_next_model_json) + assert vpn_server_client_collection_next_model != False - # Construct a model instance of VPNGatewayConnectionDPDPatch by calling from_dict on the json representation - vpn_gateway_connection_dpd_patch_model_dict = VPNGatewayConnectionDPDPatch.from_dict(vpn_gateway_connection_dpd_patch_model_json).__dict__ - vpn_gateway_connection_dpd_patch_model2 = VPNGatewayConnectionDPDPatch(**vpn_gateway_connection_dpd_patch_model_dict) + # Construct a model instance of VPNServerClientCollectionNext by calling from_dict on the json representation + vpn_server_client_collection_next_model_dict = VPNServerClientCollectionNext.from_dict(vpn_server_client_collection_next_model_json).__dict__ + vpn_server_client_collection_next_model2 = VPNServerClientCollectionNext(**vpn_server_client_collection_next_model_dict) # Verify the model instances are equivalent - assert vpn_gateway_connection_dpd_patch_model == vpn_gateway_connection_dpd_patch_model2 + assert vpn_server_client_collection_next_model == vpn_server_client_collection_next_model2 # Convert model instance back to dict and verify no loss of data - vpn_gateway_connection_dpd_patch_model_json2 = vpn_gateway_connection_dpd_patch_model.to_dict() - assert vpn_gateway_connection_dpd_patch_model_json2 == vpn_gateway_connection_dpd_patch_model_json + vpn_server_client_collection_next_model_json2 = vpn_server_client_collection_next_model.to_dict() + assert vpn_server_client_collection_next_model_json2 == vpn_server_client_collection_next_model_json -class TestModel_VPNGatewayConnectionDPDPrototype(): +class TestModel_VPNServerCollection(): """ - Test Class for VPNGatewayConnectionDPDPrototype + Test Class for VPNServerCollection """ - def test_vpn_gateway_connection_dpd_prototype_serialization(self): + def test_vpn_server_collection_serialization(self): """ - Test serialization/deserialization for VPNGatewayConnectionDPDPrototype + Test serialization/deserialization for VPNServerCollection """ - # Construct a json representation of a VPNGatewayConnectionDPDPrototype model - vpn_gateway_connection_dpd_prototype_model_json = {} - vpn_gateway_connection_dpd_prototype_model_json['action'] = 'restart' - vpn_gateway_connection_dpd_prototype_model_json['interval'] = 30 - vpn_gateway_connection_dpd_prototype_model_json['timeout'] = 120 + # Construct dict forms of any model objects needed in order to build this model. - # Construct a model instance of VPNGatewayConnectionDPDPrototype by calling from_dict on the json representation - vpn_gateway_connection_dpd_prototype_model = VPNGatewayConnectionDPDPrototype.from_dict(vpn_gateway_connection_dpd_prototype_model_json) - assert vpn_gateway_connection_dpd_prototype_model != False + vpn_server_collection_first_model = {} # VPNServerCollectionFirst + vpn_server_collection_first_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_servers?limit=20' - # Construct a model instance of VPNGatewayConnectionDPDPrototype by calling from_dict on the json representation - vpn_gateway_connection_dpd_prototype_model_dict = VPNGatewayConnectionDPDPrototype.from_dict(vpn_gateway_connection_dpd_prototype_model_json).__dict__ - vpn_gateway_connection_dpd_prototype_model2 = VPNGatewayConnectionDPDPrototype(**vpn_gateway_connection_dpd_prototype_model_dict) + vpn_server_collection_next_model = {} # VPNServerCollectionNext + vpn_server_collection_next_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_servers?start=ffd653466e284937896724b2dd044c9c&limit=20' + + certificate_instance_reference_model = {} # CertificateInstanceReference + certificate_instance_reference_model['crn'] = 'crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5' + + vpn_server_authentication_by_username_id_provider_model = {} # VPNServerAuthenticationByUsernameIdProviderByIAM + vpn_server_authentication_by_username_id_provider_model['provider_type'] = 'iam' + + vpn_server_authentication_model = {} # VPNServerAuthenticationByUsername + vpn_server_authentication_model['method'] = 'certificate' + vpn_server_authentication_model['identity_provider'] = vpn_server_authentication_by_username_id_provider_model + + ip_model = {} # IP + ip_model['address'] = '192.168.3.4' + + reserved_ip_reference_deleted_model = {} # ReservedIPReferenceDeleted + reserved_ip_reference_deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + + reserved_ip_reference_model = {} # ReservedIPReference + reserved_ip_reference_model['address'] = '192.168.3.4' + reserved_ip_reference_model['deleted'] = reserved_ip_reference_deleted_model + reserved_ip_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb' + reserved_ip_reference_model['id'] = '6d353a0f-aeb1-4ae1-832e-1110d10981bb' + reserved_ip_reference_model['name'] = 'my-reserved-ip' + reserved_ip_reference_model['resource_type'] = 'subnet_reserved_ip' + + resource_group_reference_model = {} # ResourceGroupReference + resource_group_reference_model['href'] = 'https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345' + resource_group_reference_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + resource_group_reference_model['name'] = 'my-resource-group' + + security_group_reference_deleted_model = {} # SecurityGroupReferenceDeleted + security_group_reference_deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + + security_group_reference_model = {} # SecurityGroupReference + security_group_reference_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271' + security_group_reference_model['deleted'] = security_group_reference_deleted_model + security_group_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271' + security_group_reference_model['id'] = 'be5df5ca-12a0-494b-907e-aa6ec2bfa271' + security_group_reference_model['name'] = 'my-security-group' + + subnet_reference_deleted_model = {} # SubnetReferenceDeleted + subnet_reference_deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + + subnet_reference_model = {} # SubnetReference + subnet_reference_model['crn'] = 'crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e' + subnet_reference_model['deleted'] = subnet_reference_deleted_model + subnet_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e' + subnet_reference_model['id'] = '7ec86020-1c6e-4889-b3f0-a15f2e50f87e' + subnet_reference_model['name'] = 'my-subnet' + subnet_reference_model['resource_type'] = 'subnet' + + vpc_reference_deleted_model = {} # VPCReferenceDeleted + vpc_reference_deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + + vpc_reference_model = {} # VPCReference + vpc_reference_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b' + vpc_reference_model['deleted'] = vpc_reference_deleted_model + vpc_reference_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b' + vpc_reference_model['id'] = '4727d842-f94f-4a2d-824a-9bc9b02c523b' + vpc_reference_model['name'] = 'my-vpc' + vpc_reference_model['resource_type'] = 'vpc' + + vpn_server_model = {} # VPNServer + vpn_server_model['certificate'] = certificate_instance_reference_model + vpn_server_model['client_authentication'] = [vpn_server_authentication_model] + vpn_server_model['client_auto_delete'] = True + vpn_server_model['client_auto_delete_timeout'] = 1 + vpn_server_model['client_dns_server_ips'] = [ip_model] + vpn_server_model['client_idle_timeout'] = 600 + vpn_server_model['client_ip_pool'] = '172.16.0.0/16' + vpn_server_model['created_at'] = '2019-01-01T12:00:00Z' + vpn_server_model['crn'] = 'crn:v1:bluemix:public:is:us-south:a/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5' + vpn_server_model['enable_split_tunneling'] = True + vpn_server_model['health_state'] = 'ok' + vpn_server_model['hostname'] = 'a8506291.us-south.vpn-server.appdomain.cloud' + vpn_server_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5' + vpn_server_model['id'] = 'r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5' + vpn_server_model['lifecycle_state'] = 'stable' + vpn_server_model['name'] = 'my-vpn-server' + vpn_server_model['port'] = 443 + vpn_server_model['private_ips'] = [reserved_ip_reference_model] + vpn_server_model['protocol'] = 'udp' + vpn_server_model['resource_group'] = resource_group_reference_model + vpn_server_model['resource_type'] = 'vpn_server' + vpn_server_model['security_groups'] = [security_group_reference_model] + vpn_server_model['subnets'] = [subnet_reference_model] + vpn_server_model['vpc'] = vpc_reference_model + + # Construct a json representation of a VPNServerCollection model + vpn_server_collection_model_json = {} + vpn_server_collection_model_json['first'] = vpn_server_collection_first_model + vpn_server_collection_model_json['limit'] = 20 + vpn_server_collection_model_json['next'] = vpn_server_collection_next_model + vpn_server_collection_model_json['total_count'] = 132 + vpn_server_collection_model_json['vpn_servers'] = [vpn_server_model] + + # Construct a model instance of VPNServerCollection by calling from_dict on the json representation + vpn_server_collection_model = VPNServerCollection.from_dict(vpn_server_collection_model_json) + assert vpn_server_collection_model != False + + # Construct a model instance of VPNServerCollection by calling from_dict on the json representation + vpn_server_collection_model_dict = VPNServerCollection.from_dict(vpn_server_collection_model_json).__dict__ + vpn_server_collection_model2 = VPNServerCollection(**vpn_server_collection_model_dict) # Verify the model instances are equivalent - assert vpn_gateway_connection_dpd_prototype_model == vpn_gateway_connection_dpd_prototype_model2 + assert vpn_server_collection_model == vpn_server_collection_model2 # Convert model instance back to dict and verify no loss of data - vpn_gateway_connection_dpd_prototype_model_json2 = vpn_gateway_connection_dpd_prototype_model.to_dict() - assert vpn_gateway_connection_dpd_prototype_model_json2 == vpn_gateway_connection_dpd_prototype_model_json + vpn_server_collection_model_json2 = vpn_server_collection_model.to_dict() + assert vpn_server_collection_model_json2 == vpn_server_collection_model_json -class TestModel_VPNGatewayConnectionLocalCIDRs(): +class TestModel_VPNServerCollectionFirst(): """ - Test Class for VPNGatewayConnectionLocalCIDRs + Test Class for VPNServerCollectionFirst """ - def test_vpn_gateway_connection_local_cid_rs_serialization(self): + def test_vpn_server_collection_first_serialization(self): """ - Test serialization/deserialization for VPNGatewayConnectionLocalCIDRs + Test serialization/deserialization for VPNServerCollectionFirst """ - # Construct a json representation of a VPNGatewayConnectionLocalCIDRs model - vpn_gateway_connection_local_cid_rs_model_json = {} - vpn_gateway_connection_local_cid_rs_model_json['local_cidrs'] = ['192.168.1.0/24'] + # Construct a json representation of a VPNServerCollectionFirst model + vpn_server_collection_first_model_json = {} + vpn_server_collection_first_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_servers?limit=20' - # Construct a model instance of VPNGatewayConnectionLocalCIDRs by calling from_dict on the json representation - vpn_gateway_connection_local_cid_rs_model = VPNGatewayConnectionLocalCIDRs.from_dict(vpn_gateway_connection_local_cid_rs_model_json) - assert vpn_gateway_connection_local_cid_rs_model != False + # Construct a model instance of VPNServerCollectionFirst by calling from_dict on the json representation + vpn_server_collection_first_model = VPNServerCollectionFirst.from_dict(vpn_server_collection_first_model_json) + assert vpn_server_collection_first_model != False - # Construct a model instance of VPNGatewayConnectionLocalCIDRs by calling from_dict on the json representation - vpn_gateway_connection_local_cid_rs_model_dict = VPNGatewayConnectionLocalCIDRs.from_dict(vpn_gateway_connection_local_cid_rs_model_json).__dict__ - vpn_gateway_connection_local_cid_rs_model2 = VPNGatewayConnectionLocalCIDRs(**vpn_gateway_connection_local_cid_rs_model_dict) + # Construct a model instance of VPNServerCollectionFirst by calling from_dict on the json representation + vpn_server_collection_first_model_dict = VPNServerCollectionFirst.from_dict(vpn_server_collection_first_model_json).__dict__ + vpn_server_collection_first_model2 = VPNServerCollectionFirst(**vpn_server_collection_first_model_dict) # Verify the model instances are equivalent - assert vpn_gateway_connection_local_cid_rs_model == vpn_gateway_connection_local_cid_rs_model2 + assert vpn_server_collection_first_model == vpn_server_collection_first_model2 # Convert model instance back to dict and verify no loss of data - vpn_gateway_connection_local_cid_rs_model_json2 = vpn_gateway_connection_local_cid_rs_model.to_dict() - assert vpn_gateway_connection_local_cid_rs_model_json2 == vpn_gateway_connection_local_cid_rs_model_json + vpn_server_collection_first_model_json2 = vpn_server_collection_first_model.to_dict() + assert vpn_server_collection_first_model_json2 == vpn_server_collection_first_model_json -class TestModel_VPNGatewayConnectionPeerCIDRs(): +class TestModel_VPNServerCollectionNext(): """ - Test Class for VPNGatewayConnectionPeerCIDRs + Test Class for VPNServerCollectionNext """ - def test_vpn_gateway_connection_peer_cid_rs_serialization(self): + def test_vpn_server_collection_next_serialization(self): """ - Test serialization/deserialization for VPNGatewayConnectionPeerCIDRs + Test serialization/deserialization for VPNServerCollectionNext """ - # Construct a json representation of a VPNGatewayConnectionPeerCIDRs model - vpn_gateway_connection_peer_cid_rs_model_json = {} - vpn_gateway_connection_peer_cid_rs_model_json['peer_cidrs'] = ['10.45.1.0/24'] + # Construct a json representation of a VPNServerCollectionNext model + vpn_server_collection_next_model_json = {} + vpn_server_collection_next_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_servers?start=ffd653466e284937896724b2dd044c9c&limit=20' - # Construct a model instance of VPNGatewayConnectionPeerCIDRs by calling from_dict on the json representation - vpn_gateway_connection_peer_cid_rs_model = VPNGatewayConnectionPeerCIDRs.from_dict(vpn_gateway_connection_peer_cid_rs_model_json) - assert vpn_gateway_connection_peer_cid_rs_model != False + # Construct a model instance of VPNServerCollectionNext by calling from_dict on the json representation + vpn_server_collection_next_model = VPNServerCollectionNext.from_dict(vpn_server_collection_next_model_json) + assert vpn_server_collection_next_model != False - # Construct a model instance of VPNGatewayConnectionPeerCIDRs by calling from_dict on the json representation - vpn_gateway_connection_peer_cid_rs_model_dict = VPNGatewayConnectionPeerCIDRs.from_dict(vpn_gateway_connection_peer_cid_rs_model_json).__dict__ - vpn_gateway_connection_peer_cid_rs_model2 = VPNGatewayConnectionPeerCIDRs(**vpn_gateway_connection_peer_cid_rs_model_dict) + # Construct a model instance of VPNServerCollectionNext by calling from_dict on the json representation + vpn_server_collection_next_model_dict = VPNServerCollectionNext.from_dict(vpn_server_collection_next_model_json).__dict__ + vpn_server_collection_next_model2 = VPNServerCollectionNext(**vpn_server_collection_next_model_dict) # Verify the model instances are equivalent - assert vpn_gateway_connection_peer_cid_rs_model == vpn_gateway_connection_peer_cid_rs_model2 + assert vpn_server_collection_next_model == vpn_server_collection_next_model2 # Convert model instance back to dict and verify no loss of data - vpn_gateway_connection_peer_cid_rs_model_json2 = vpn_gateway_connection_peer_cid_rs_model.to_dict() - assert vpn_gateway_connection_peer_cid_rs_model_json2 == vpn_gateway_connection_peer_cid_rs_model_json + vpn_server_collection_next_model_json2 = vpn_server_collection_next_model.to_dict() + assert vpn_server_collection_next_model_json2 == vpn_server_collection_next_model_json -class TestModel_VPNGatewayConnectionReference(): +class TestModel_VPNServerPatch(): """ - Test Class for VPNGatewayConnectionReference + Test Class for VPNServerPatch """ - def test_vpn_gateway_connection_reference_serialization(self): + def test_vpn_server_patch_serialization(self): """ - Test serialization/deserialization for VPNGatewayConnectionReference + Test serialization/deserialization for VPNServerPatch """ # Construct dict forms of any model objects needed in order to build this model. - vpn_gateway_connection_reference_deleted_model = {} # VPNGatewayConnectionReferenceDeleted - vpn_gateway_connection_reference_deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + certificate_instance_identity_model = {} # CertificateInstanceIdentityByCRN + certificate_instance_identity_model['crn'] = 'crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5' - # Construct a json representation of a VPNGatewayConnectionReference model - vpn_gateway_connection_reference_model_json = {} - vpn_gateway_connection_reference_model_json['deleted'] = vpn_gateway_connection_reference_deleted_model - vpn_gateway_connection_reference_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b' - vpn_gateway_connection_reference_model_json['id'] = 'a10a5771-dc23-442c-8460-c3601d8542f7' - vpn_gateway_connection_reference_model_json['name'] = 'my-vpn-connection' - vpn_gateway_connection_reference_model_json['resource_type'] = 'vpn_gateway_connection' + vpn_server_authentication_by_username_id_provider_model = {} # VPNServerAuthenticationByUsernameIdProviderByIAM + vpn_server_authentication_by_username_id_provider_model['provider_type'] = 'iam' - # Construct a model instance of VPNGatewayConnectionReference by calling from_dict on the json representation - vpn_gateway_connection_reference_model = VPNGatewayConnectionReference.from_dict(vpn_gateway_connection_reference_model_json) - assert vpn_gateway_connection_reference_model != False + vpn_server_authentication_prototype_model = {} # VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype + vpn_server_authentication_prototype_model['method'] = 'username' + vpn_server_authentication_prototype_model['identity_provider'] = vpn_server_authentication_by_username_id_provider_model - # Construct a model instance of VPNGatewayConnectionReference by calling from_dict on the json representation - vpn_gateway_connection_reference_model_dict = VPNGatewayConnectionReference.from_dict(vpn_gateway_connection_reference_model_json).__dict__ - vpn_gateway_connection_reference_model2 = VPNGatewayConnectionReference(**vpn_gateway_connection_reference_model_dict) + ip_model = {} # IP + ip_model['address'] = '192.168.3.4' + + subnet_identity_model = {} # SubnetIdentityById + subnet_identity_model['id'] = '7ec86020-1c6e-4889-b3f0-a15f2e50f87e' + + # Construct a json representation of a VPNServerPatch model + vpn_server_patch_model_json = {} + vpn_server_patch_model_json['certificate'] = certificate_instance_identity_model + vpn_server_patch_model_json['client_authentication'] = [vpn_server_authentication_prototype_model] + vpn_server_patch_model_json['client_dns_server_ips'] = [ip_model] + vpn_server_patch_model_json['client_idle_timeout'] = 600 + vpn_server_patch_model_json['client_ip_pool'] = '172.16.0.0/16' + vpn_server_patch_model_json['enable_split_tunneling'] = True + vpn_server_patch_model_json['name'] = 'my-vpn-server' + vpn_server_patch_model_json['port'] = 443 + vpn_server_patch_model_json['protocol'] = 'udp' + vpn_server_patch_model_json['subnets'] = [subnet_identity_model] + + # Construct a model instance of VPNServerPatch by calling from_dict on the json representation + vpn_server_patch_model = VPNServerPatch.from_dict(vpn_server_patch_model_json) + assert vpn_server_patch_model != False + + # Construct a model instance of VPNServerPatch by calling from_dict on the json representation + vpn_server_patch_model_dict = VPNServerPatch.from_dict(vpn_server_patch_model_json).__dict__ + vpn_server_patch_model2 = VPNServerPatch(**vpn_server_patch_model_dict) # Verify the model instances are equivalent - assert vpn_gateway_connection_reference_model == vpn_gateway_connection_reference_model2 + assert vpn_server_patch_model == vpn_server_patch_model2 # Convert model instance back to dict and verify no loss of data - vpn_gateway_connection_reference_model_json2 = vpn_gateway_connection_reference_model.to_dict() - assert vpn_gateway_connection_reference_model_json2 == vpn_gateway_connection_reference_model_json + vpn_server_patch_model_json2 = vpn_server_patch_model.to_dict() + assert vpn_server_patch_model_json2 == vpn_server_patch_model_json -class TestModel_VPNGatewayConnectionReferenceDeleted(): +class TestModel_VPNServerReferenceDeleted(): """ - Test Class for VPNGatewayConnectionReferenceDeleted + Test Class for VPNServerReferenceDeleted """ - def test_vpn_gateway_connection_reference_deleted_serialization(self): + def test_vpn_server_reference_deleted_serialization(self): """ - Test serialization/deserialization for VPNGatewayConnectionReferenceDeleted + Test serialization/deserialization for VPNServerReferenceDeleted """ - # Construct a json representation of a VPNGatewayConnectionReferenceDeleted model - vpn_gateway_connection_reference_deleted_model_json = {} - vpn_gateway_connection_reference_deleted_model_json['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + # Construct a json representation of a VPNServerReferenceDeleted model + vpn_server_reference_deleted_model_json = {} + vpn_server_reference_deleted_model_json['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' - # Construct a model instance of VPNGatewayConnectionReferenceDeleted by calling from_dict on the json representation - vpn_gateway_connection_reference_deleted_model = VPNGatewayConnectionReferenceDeleted.from_dict(vpn_gateway_connection_reference_deleted_model_json) - assert vpn_gateway_connection_reference_deleted_model != False + # Construct a model instance of VPNServerReferenceDeleted by calling from_dict on the json representation + vpn_server_reference_deleted_model = VPNServerReferenceDeleted.from_dict(vpn_server_reference_deleted_model_json) + assert vpn_server_reference_deleted_model != False - # Construct a model instance of VPNGatewayConnectionReferenceDeleted by calling from_dict on the json representation - vpn_gateway_connection_reference_deleted_model_dict = VPNGatewayConnectionReferenceDeleted.from_dict(vpn_gateway_connection_reference_deleted_model_json).__dict__ - vpn_gateway_connection_reference_deleted_model2 = VPNGatewayConnectionReferenceDeleted(**vpn_gateway_connection_reference_deleted_model_dict) + # Construct a model instance of VPNServerReferenceDeleted by calling from_dict on the json representation + vpn_server_reference_deleted_model_dict = VPNServerReferenceDeleted.from_dict(vpn_server_reference_deleted_model_json).__dict__ + vpn_server_reference_deleted_model2 = VPNServerReferenceDeleted(**vpn_server_reference_deleted_model_dict) # Verify the model instances are equivalent - assert vpn_gateway_connection_reference_deleted_model == vpn_gateway_connection_reference_deleted_model2 + assert vpn_server_reference_deleted_model == vpn_server_reference_deleted_model2 # Convert model instance back to dict and verify no loss of data - vpn_gateway_connection_reference_deleted_model_json2 = vpn_gateway_connection_reference_deleted_model.to_dict() - assert vpn_gateway_connection_reference_deleted_model_json2 == vpn_gateway_connection_reference_deleted_model_json + vpn_server_reference_deleted_model_json2 = vpn_server_reference_deleted_model.to_dict() + assert vpn_server_reference_deleted_model_json2 == vpn_server_reference_deleted_model_json -class TestModel_VPNGatewayConnectionStaticRouteModeTunnel(): +class TestModel_VPNServerRoute(): """ - Test Class for VPNGatewayConnectionStaticRouteModeTunnel + Test Class for VPNServerRoute """ - def test_vpn_gateway_connection_static_route_mode_tunnel_serialization(self): + def test_vpn_server_route_serialization(self): """ - Test serialization/deserialization for VPNGatewayConnectionStaticRouteModeTunnel + Test serialization/deserialization for VPNServerRoute """ - # Construct dict forms of any model objects needed in order to build this model. - - ip_model = {} # IP - ip_model['address'] = '192.168.3.4' - - # Construct a json representation of a VPNGatewayConnectionStaticRouteModeTunnel model - vpn_gateway_connection_static_route_mode_tunnel_model_json = {} - vpn_gateway_connection_static_route_mode_tunnel_model_json['public_ip'] = ip_model - vpn_gateway_connection_static_route_mode_tunnel_model_json['status'] = 'down' + # Construct a json representation of a VPNServerRoute model + vpn_server_route_model_json = {} + vpn_server_route_model_json['action'] = 'deliver' + vpn_server_route_model_json['created_at'] = '2019-01-01T12:00:00Z' + vpn_server_route_model_json['destination'] = '192.168.3.0/24' + vpn_server_route_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531' + vpn_server_route_model_json['id'] = 'r006-1a15dca5-7e33-45e1-b7c5-bc690e569531' + vpn_server_route_model_json['lifecycle_state'] = 'stable' + vpn_server_route_model_json['name'] = 'my-vpn-route-1' + vpn_server_route_model_json['resource_type'] = 'vpn_server_route' - # Construct a model instance of VPNGatewayConnectionStaticRouteModeTunnel by calling from_dict on the json representation - vpn_gateway_connection_static_route_mode_tunnel_model = VPNGatewayConnectionStaticRouteModeTunnel.from_dict(vpn_gateway_connection_static_route_mode_tunnel_model_json) - assert vpn_gateway_connection_static_route_mode_tunnel_model != False + # Construct a model instance of VPNServerRoute by calling from_dict on the json representation + vpn_server_route_model = VPNServerRoute.from_dict(vpn_server_route_model_json) + assert vpn_server_route_model != False - # Construct a model instance of VPNGatewayConnectionStaticRouteModeTunnel by calling from_dict on the json representation - vpn_gateway_connection_static_route_mode_tunnel_model_dict = VPNGatewayConnectionStaticRouteModeTunnel.from_dict(vpn_gateway_connection_static_route_mode_tunnel_model_json).__dict__ - vpn_gateway_connection_static_route_mode_tunnel_model2 = VPNGatewayConnectionStaticRouteModeTunnel(**vpn_gateway_connection_static_route_mode_tunnel_model_dict) + # Construct a model instance of VPNServerRoute by calling from_dict on the json representation + vpn_server_route_model_dict = VPNServerRoute.from_dict(vpn_server_route_model_json).__dict__ + vpn_server_route_model2 = VPNServerRoute(**vpn_server_route_model_dict) # Verify the model instances are equivalent - assert vpn_gateway_connection_static_route_mode_tunnel_model == vpn_gateway_connection_static_route_mode_tunnel_model2 + assert vpn_server_route_model == vpn_server_route_model2 # Convert model instance back to dict and verify no loss of data - vpn_gateway_connection_static_route_mode_tunnel_model_json2 = vpn_gateway_connection_static_route_mode_tunnel_model.to_dict() - assert vpn_gateway_connection_static_route_mode_tunnel_model_json2 == vpn_gateway_connection_static_route_mode_tunnel_model_json + vpn_server_route_model_json2 = vpn_server_route_model.to_dict() + assert vpn_server_route_model_json2 == vpn_server_route_model_json -class TestModel_VPNGatewayMember(): +class TestModel_VPNServerRouteCollection(): """ - Test Class for VPNGatewayMember + Test Class for VPNServerRouteCollection """ - def test_vpn_gateway_member_serialization(self): + def test_vpn_server_route_collection_serialization(self): """ - Test serialization/deserialization for VPNGatewayMember + Test serialization/deserialization for VPNServerRouteCollection """ # Construct dict forms of any model objects needed in order to build this model. - ip_model = {} # IP - ip_model['address'] = '192.168.3.4' + vpn_server_route_collection_first_model = {} # VPNServerRouteCollectionFirst + vpn_server_route_collection_first_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routes?limit=20' - # Construct a json representation of a VPNGatewayMember model - vpn_gateway_member_model_json = {} - vpn_gateway_member_model_json['private_ip'] = ip_model - vpn_gateway_member_model_json['public_ip'] = ip_model - vpn_gateway_member_model_json['role'] = 'active' - vpn_gateway_member_model_json['status'] = 'available' + vpn_server_route_collection_next_model = {} # VPNServerRouteCollectionNext + vpn_server_route_collection_next_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20' - # Construct a model instance of VPNGatewayMember by calling from_dict on the json representation - vpn_gateway_member_model = VPNGatewayMember.from_dict(vpn_gateway_member_model_json) - assert vpn_gateway_member_model != False + vpn_server_route_model = {} # VPNServerRoute + vpn_server_route_model['action'] = 'deliver' + vpn_server_route_model['created_at'] = '2019-01-01T12:00:00Z' + vpn_server_route_model['destination'] = '192.168.3.0/24' + vpn_server_route_model['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531' + vpn_server_route_model['id'] = 'r006-1a15dca5-7e33-45e1-b7c5-bc690e569531' + vpn_server_route_model['lifecycle_state'] = 'stable' + vpn_server_route_model['name'] = 'my-vpn-route-1' + vpn_server_route_model['resource_type'] = 'vpn_server_route' - # Construct a model instance of VPNGatewayMember by calling from_dict on the json representation - vpn_gateway_member_model_dict = VPNGatewayMember.from_dict(vpn_gateway_member_model_json).__dict__ - vpn_gateway_member_model2 = VPNGatewayMember(**vpn_gateway_member_model_dict) + # Construct a json representation of a VPNServerRouteCollection model + vpn_server_route_collection_model_json = {} + vpn_server_route_collection_model_json['first'] = vpn_server_route_collection_first_model + vpn_server_route_collection_model_json['limit'] = 20 + vpn_server_route_collection_model_json['next'] = vpn_server_route_collection_next_model + vpn_server_route_collection_model_json['routes'] = [vpn_server_route_model] + vpn_server_route_collection_model_json['total_count'] = 132 + + # Construct a model instance of VPNServerRouteCollection by calling from_dict on the json representation + vpn_server_route_collection_model = VPNServerRouteCollection.from_dict(vpn_server_route_collection_model_json) + assert vpn_server_route_collection_model != False + + # Construct a model instance of VPNServerRouteCollection by calling from_dict on the json representation + vpn_server_route_collection_model_dict = VPNServerRouteCollection.from_dict(vpn_server_route_collection_model_json).__dict__ + vpn_server_route_collection_model2 = VPNServerRouteCollection(**vpn_server_route_collection_model_dict) # Verify the model instances are equivalent - assert vpn_gateway_member_model == vpn_gateway_member_model2 + assert vpn_server_route_collection_model == vpn_server_route_collection_model2 # Convert model instance back to dict and verify no loss of data - vpn_gateway_member_model_json2 = vpn_gateway_member_model.to_dict() - assert vpn_gateway_member_model_json2 == vpn_gateway_member_model_json + vpn_server_route_collection_model_json2 = vpn_server_route_collection_model.to_dict() + assert vpn_server_route_collection_model_json2 == vpn_server_route_collection_model_json -class TestModel_VPNGatewayPatch(): +class TestModel_VPNServerRouteCollectionFirst(): """ - Test Class for VPNGatewayPatch + Test Class for VPNServerRouteCollectionFirst """ - def test_vpn_gateway_patch_serialization(self): + def test_vpn_server_route_collection_first_serialization(self): """ - Test serialization/deserialization for VPNGatewayPatch + Test serialization/deserialization for VPNServerRouteCollectionFirst """ - # Construct a json representation of a VPNGatewayPatch model - vpn_gateway_patch_model_json = {} - vpn_gateway_patch_model_json['name'] = 'my-vpn-gateway' + # Construct a json representation of a VPNServerRouteCollectionFirst model + vpn_server_route_collection_first_model_json = {} + vpn_server_route_collection_first_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routes?limit=20' - # Construct a model instance of VPNGatewayPatch by calling from_dict on the json representation - vpn_gateway_patch_model = VPNGatewayPatch.from_dict(vpn_gateway_patch_model_json) - assert vpn_gateway_patch_model != False + # Construct a model instance of VPNServerRouteCollectionFirst by calling from_dict on the json representation + vpn_server_route_collection_first_model = VPNServerRouteCollectionFirst.from_dict(vpn_server_route_collection_first_model_json) + assert vpn_server_route_collection_first_model != False - # Construct a model instance of VPNGatewayPatch by calling from_dict on the json representation - vpn_gateway_patch_model_dict = VPNGatewayPatch.from_dict(vpn_gateway_patch_model_json).__dict__ - vpn_gateway_patch_model2 = VPNGatewayPatch(**vpn_gateway_patch_model_dict) + # Construct a model instance of VPNServerRouteCollectionFirst by calling from_dict on the json representation + vpn_server_route_collection_first_model_dict = VPNServerRouteCollectionFirst.from_dict(vpn_server_route_collection_first_model_json).__dict__ + vpn_server_route_collection_first_model2 = VPNServerRouteCollectionFirst(**vpn_server_route_collection_first_model_dict) # Verify the model instances are equivalent - assert vpn_gateway_patch_model == vpn_gateway_patch_model2 + assert vpn_server_route_collection_first_model == vpn_server_route_collection_first_model2 # Convert model instance back to dict and verify no loss of data - vpn_gateway_patch_model_json2 = vpn_gateway_patch_model.to_dict() - assert vpn_gateway_patch_model_json2 == vpn_gateway_patch_model_json + vpn_server_route_collection_first_model_json2 = vpn_server_route_collection_first_model.to_dict() + assert vpn_server_route_collection_first_model_json2 == vpn_server_route_collection_first_model_json -class TestModel_VPNGatewayReferenceDeleted(): +class TestModel_VPNServerRouteCollectionNext(): """ - Test Class for VPNGatewayReferenceDeleted + Test Class for VPNServerRouteCollectionNext """ - def test_vpn_gateway_reference_deleted_serialization(self): + def test_vpn_server_route_collection_next_serialization(self): """ - Test serialization/deserialization for VPNGatewayReferenceDeleted + Test serialization/deserialization for VPNServerRouteCollectionNext """ - # Construct a json representation of a VPNGatewayReferenceDeleted model - vpn_gateway_reference_deleted_model_json = {} - vpn_gateway_reference_deleted_model_json['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + # Construct a json representation of a VPNServerRouteCollectionNext model + vpn_server_route_collection_next_model_json = {} + vpn_server_route_collection_next_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20' - # Construct a model instance of VPNGatewayReferenceDeleted by calling from_dict on the json representation - vpn_gateway_reference_deleted_model = VPNGatewayReferenceDeleted.from_dict(vpn_gateway_reference_deleted_model_json) - assert vpn_gateway_reference_deleted_model != False + # Construct a model instance of VPNServerRouteCollectionNext by calling from_dict on the json representation + vpn_server_route_collection_next_model = VPNServerRouteCollectionNext.from_dict(vpn_server_route_collection_next_model_json) + assert vpn_server_route_collection_next_model != False - # Construct a model instance of VPNGatewayReferenceDeleted by calling from_dict on the json representation - vpn_gateway_reference_deleted_model_dict = VPNGatewayReferenceDeleted.from_dict(vpn_gateway_reference_deleted_model_json).__dict__ - vpn_gateway_reference_deleted_model2 = VPNGatewayReferenceDeleted(**vpn_gateway_reference_deleted_model_dict) + # Construct a model instance of VPNServerRouteCollectionNext by calling from_dict on the json representation + vpn_server_route_collection_next_model_dict = VPNServerRouteCollectionNext.from_dict(vpn_server_route_collection_next_model_json).__dict__ + vpn_server_route_collection_next_model2 = VPNServerRouteCollectionNext(**vpn_server_route_collection_next_model_dict) # Verify the model instances are equivalent - assert vpn_gateway_reference_deleted_model == vpn_gateway_reference_deleted_model2 + assert vpn_server_route_collection_next_model == vpn_server_route_collection_next_model2 # Convert model instance back to dict and verify no loss of data - vpn_gateway_reference_deleted_model_json2 = vpn_gateway_reference_deleted_model.to_dict() - assert vpn_gateway_reference_deleted_model_json2 == vpn_gateway_reference_deleted_model_json + vpn_server_route_collection_next_model_json2 = vpn_server_route_collection_next_model.to_dict() + assert vpn_server_route_collection_next_model_json2 == vpn_server_route_collection_next_model_json + +class TestModel_VPNServerRoutePatch(): + """ + Test Class for VPNServerRoutePatch + """ + + def test_vpn_server_route_patch_serialization(self): + """ + Test serialization/deserialization for VPNServerRoutePatch + """ + + # Construct a json representation of a VPNServerRoutePatch model + vpn_server_route_patch_model_json = {} + vpn_server_route_patch_model_json['name'] = 'my-vpn-route-2' + + # Construct a model instance of VPNServerRoutePatch by calling from_dict on the json representation + vpn_server_route_patch_model = VPNServerRoutePatch.from_dict(vpn_server_route_patch_model_json) + assert vpn_server_route_patch_model != False + + # Construct a model instance of VPNServerRoutePatch by calling from_dict on the json representation + vpn_server_route_patch_model_dict = VPNServerRoutePatch.from_dict(vpn_server_route_patch_model_json).__dict__ + vpn_server_route_patch_model2 = VPNServerRoutePatch(**vpn_server_route_patch_model_dict) + + # Verify the model instances are equivalent + assert vpn_server_route_patch_model == vpn_server_route_patch_model2 + + # Convert model instance back to dict and verify no loss of data + vpn_server_route_patch_model_json2 = vpn_server_route_patch_model.to_dict() + assert vpn_server_route_patch_model_json2 == vpn_server_route_patch_model_json class TestModel_Volume(): """ @@ -54825,6 +59065,45 @@ def test_reserved_ip_target_vpn_gateway_reference_serialization(self): reserved_ip_target_vpn_gateway_reference_model_json2 = reserved_ip_target_vpn_gateway_reference_model.to_dict() assert reserved_ip_target_vpn_gateway_reference_model_json2 == reserved_ip_target_vpn_gateway_reference_model_json +class TestModel_ReservedIPTargetVPNServerReference(): + """ + Test Class for ReservedIPTargetVPNServerReference + """ + + def test_reserved_ip_target_vpn_server_reference_serialization(self): + """ + Test serialization/deserialization for ReservedIPTargetVPNServerReference + """ + + # Construct dict forms of any model objects needed in order to build this model. + + vpn_server_reference_deleted_model = {} # VPNServerReferenceDeleted + vpn_server_reference_deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + + # Construct a json representation of a ReservedIPTargetVPNServerReference model + reserved_ip_target_vpn_server_reference_model_json = {} + reserved_ip_target_vpn_server_reference_model_json['crn'] = 'crn:v1:bluemix:public:is:us-south:a/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5' + reserved_ip_target_vpn_server_reference_model_json['deleted'] = vpn_server_reference_deleted_model + reserved_ip_target_vpn_server_reference_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5' + reserved_ip_target_vpn_server_reference_model_json['id'] = 'r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5' + reserved_ip_target_vpn_server_reference_model_json['name'] = 'my-vpn-server' + reserved_ip_target_vpn_server_reference_model_json['resource_type'] = 'vpn_server' + + # Construct a model instance of ReservedIPTargetVPNServerReference by calling from_dict on the json representation + reserved_ip_target_vpn_server_reference_model = ReservedIPTargetVPNServerReference.from_dict(reserved_ip_target_vpn_server_reference_model_json) + assert reserved_ip_target_vpn_server_reference_model != False + + # Construct a model instance of ReservedIPTargetVPNServerReference by calling from_dict on the json representation + reserved_ip_target_vpn_server_reference_model_dict = ReservedIPTargetVPNServerReference.from_dict(reserved_ip_target_vpn_server_reference_model_json).__dict__ + reserved_ip_target_vpn_server_reference_model2 = ReservedIPTargetVPNServerReference(**reserved_ip_target_vpn_server_reference_model_dict) + + # Verify the model instances are equivalent + assert reserved_ip_target_vpn_server_reference_model == reserved_ip_target_vpn_server_reference_model2 + + # Convert model instance back to dict and verify no loss of data + reserved_ip_target_vpn_server_reference_model_json2 = reserved_ip_target_vpn_server_reference_model.to_dict() + assert reserved_ip_target_vpn_server_reference_model_json2 == reserved_ip_target_vpn_server_reference_model_json + class TestModel_ResourceGroupIdentityById(): """ Test Class for ResourceGroupIdentityById @@ -54854,6 +59133,84 @@ def test_resource_group_identity_by_id_serialization(self): resource_group_identity_by_id_model_json2 = resource_group_identity_by_id_model.to_dict() assert resource_group_identity_by_id_model_json2 == resource_group_identity_by_id_model_json +class TestModel_RouteCreatorVPNGatewayReference(): + """ + Test Class for RouteCreatorVPNGatewayReference + """ + + def test_route_creator_vpn_gateway_reference_serialization(self): + """ + Test serialization/deserialization for RouteCreatorVPNGatewayReference + """ + + # Construct dict forms of any model objects needed in order to build this model. + + vpn_gateway_reference_deleted_model = {} # VPNGatewayReferenceDeleted + vpn_gateway_reference_deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + + # Construct a json representation of a RouteCreatorVPNGatewayReference model + route_creator_vpn_gateway_reference_model_json = {} + route_creator_vpn_gateway_reference_model_json['crn'] = 'crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b' + route_creator_vpn_gateway_reference_model_json['deleted'] = vpn_gateway_reference_deleted_model + route_creator_vpn_gateway_reference_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b' + route_creator_vpn_gateway_reference_model_json['id'] = 'ddf51bec-3424-11e8-b467-0ed5f89f718b' + route_creator_vpn_gateway_reference_model_json['name'] = 'my-vpn-gateway' + route_creator_vpn_gateway_reference_model_json['resource_type'] = 'vpn_gateway' + + # Construct a model instance of RouteCreatorVPNGatewayReference by calling from_dict on the json representation + route_creator_vpn_gateway_reference_model = RouteCreatorVPNGatewayReference.from_dict(route_creator_vpn_gateway_reference_model_json) + assert route_creator_vpn_gateway_reference_model != False + + # Construct a model instance of RouteCreatorVPNGatewayReference by calling from_dict on the json representation + route_creator_vpn_gateway_reference_model_dict = RouteCreatorVPNGatewayReference.from_dict(route_creator_vpn_gateway_reference_model_json).__dict__ + route_creator_vpn_gateway_reference_model2 = RouteCreatorVPNGatewayReference(**route_creator_vpn_gateway_reference_model_dict) + + # Verify the model instances are equivalent + assert route_creator_vpn_gateway_reference_model == route_creator_vpn_gateway_reference_model2 + + # Convert model instance back to dict and verify no loss of data + route_creator_vpn_gateway_reference_model_json2 = route_creator_vpn_gateway_reference_model.to_dict() + assert route_creator_vpn_gateway_reference_model_json2 == route_creator_vpn_gateway_reference_model_json + +class TestModel_RouteCreatorVPNServerReference(): + """ + Test Class for RouteCreatorVPNServerReference + """ + + def test_route_creator_vpn_server_reference_serialization(self): + """ + Test serialization/deserialization for RouteCreatorVPNServerReference + """ + + # Construct dict forms of any model objects needed in order to build this model. + + vpn_server_reference_deleted_model = {} # VPNServerReferenceDeleted + vpn_server_reference_deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + + # Construct a json representation of a RouteCreatorVPNServerReference model + route_creator_vpn_server_reference_model_json = {} + route_creator_vpn_server_reference_model_json['crn'] = 'crn:v1:bluemix:public:is:us-south:a/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5' + route_creator_vpn_server_reference_model_json['deleted'] = vpn_server_reference_deleted_model + route_creator_vpn_server_reference_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5' + route_creator_vpn_server_reference_model_json['id'] = 'r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5' + route_creator_vpn_server_reference_model_json['name'] = 'my-vpn-server' + route_creator_vpn_server_reference_model_json['resource_type'] = 'vpn_server' + + # Construct a model instance of RouteCreatorVPNServerReference by calling from_dict on the json representation + route_creator_vpn_server_reference_model = RouteCreatorVPNServerReference.from_dict(route_creator_vpn_server_reference_model_json) + assert route_creator_vpn_server_reference_model != False + + # Construct a model instance of RouteCreatorVPNServerReference by calling from_dict on the json representation + route_creator_vpn_server_reference_model_dict = RouteCreatorVPNServerReference.from_dict(route_creator_vpn_server_reference_model_json).__dict__ + route_creator_vpn_server_reference_model2 = RouteCreatorVPNServerReference(**route_creator_vpn_server_reference_model_dict) + + # Verify the model instances are equivalent + assert route_creator_vpn_server_reference_model == route_creator_vpn_server_reference_model2 + + # Convert model instance back to dict and verify no loss of data + route_creator_vpn_server_reference_model_json2 = route_creator_vpn_server_reference_model.to_dict() + assert route_creator_vpn_server_reference_model_json2 == route_creator_vpn_server_reference_model_json + class TestModel_RouteNextHopIP(): """ Test Class for RouteNextHopIP @@ -54883,35 +59240,6 @@ def test_route_next_hop_ip_serialization(self): route_next_hop_ip_model_json2 = route_next_hop_ip_model.to_dict() assert route_next_hop_ip_model_json2 == route_next_hop_ip_model_json -class TestModel_RouteNextHopPrototypeRouteNextHopIP(): - """ - Test Class for RouteNextHopPrototypeRouteNextHopIP - """ - - def test_route_next_hop_prototype_route_next_hop_ip_serialization(self): - """ - Test serialization/deserialization for RouteNextHopPrototypeRouteNextHopIP - """ - - # Construct a json representation of a RouteNextHopPrototypeRouteNextHopIP model - route_next_hop_prototype_route_next_hop_ip_model_json = {} - route_next_hop_prototype_route_next_hop_ip_model_json['address'] = '192.168.3.4' - - # Construct a model instance of RouteNextHopPrototypeRouteNextHopIP by calling from_dict on the json representation - route_next_hop_prototype_route_next_hop_ip_model = RouteNextHopPrototypeRouteNextHopIP.from_dict(route_next_hop_prototype_route_next_hop_ip_model_json) - assert route_next_hop_prototype_route_next_hop_ip_model != False - - # Construct a model instance of RouteNextHopPrototypeRouteNextHopIP by calling from_dict on the json representation - route_next_hop_prototype_route_next_hop_ip_model_dict = RouteNextHopPrototypeRouteNextHopIP.from_dict(route_next_hop_prototype_route_next_hop_ip_model_json).__dict__ - route_next_hop_prototype_route_next_hop_ip_model2 = RouteNextHopPrototypeRouteNextHopIP(**route_next_hop_prototype_route_next_hop_ip_model_dict) - - # Verify the model instances are equivalent - assert route_next_hop_prototype_route_next_hop_ip_model == route_next_hop_prototype_route_next_hop_ip_model2 - - # Convert model instance back to dict and verify no loss of data - route_next_hop_prototype_route_next_hop_ip_model_json2 = route_next_hop_prototype_route_next_hop_ip_model.to_dict() - assert route_next_hop_prototype_route_next_hop_ip_model_json2 == route_next_hop_prototype_route_next_hop_ip_model_json - class TestModel_RouteNextHopVPNGatewayConnectionReference(): """ Test Class for RouteNextHopVPNGatewayConnectionReference @@ -54950,6 +59278,35 @@ def test_route_next_hop_vpn_gateway_connection_reference_serialization(self): route_next_hop_vpn_gateway_connection_reference_model_json2 = route_next_hop_vpn_gateway_connection_reference_model.to_dict() assert route_next_hop_vpn_gateway_connection_reference_model_json2 == route_next_hop_vpn_gateway_connection_reference_model_json +class TestModel_RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP(): + """ + Test Class for RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP + """ + + def test_route_prototype_next_hop_route_next_hop_prototype_route_next_hop_ip_serialization(self): + """ + Test serialization/deserialization for RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP + """ + + # Construct a json representation of a RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + route_prototype_next_hop_route_next_hop_prototype_route_next_hop_ip_model_json = {} + route_prototype_next_hop_route_next_hop_prototype_route_next_hop_ip_model_json['address'] = '192.168.3.4' + + # Construct a model instance of RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP by calling from_dict on the json representation + route_prototype_next_hop_route_next_hop_prototype_route_next_hop_ip_model = RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP.from_dict(route_prototype_next_hop_route_next_hop_prototype_route_next_hop_ip_model_json) + assert route_prototype_next_hop_route_next_hop_prototype_route_next_hop_ip_model != False + + # Construct a model instance of RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP by calling from_dict on the json representation + route_prototype_next_hop_route_next_hop_prototype_route_next_hop_ip_model_dict = RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP.from_dict(route_prototype_next_hop_route_next_hop_prototype_route_next_hop_ip_model_json).__dict__ + route_prototype_next_hop_route_next_hop_prototype_route_next_hop_ip_model2 = RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP(**route_prototype_next_hop_route_next_hop_prototype_route_next_hop_ip_model_dict) + + # Verify the model instances are equivalent + assert route_prototype_next_hop_route_next_hop_prototype_route_next_hop_ip_model == route_prototype_next_hop_route_next_hop_prototype_route_next_hop_ip_model2 + + # Convert model instance back to dict and verify no loss of data + route_prototype_next_hop_route_next_hop_prototype_route_next_hop_ip_model_json2 = route_prototype_next_hop_route_next_hop_prototype_route_next_hop_ip_model.to_dict() + assert route_prototype_next_hop_route_next_hop_prototype_route_next_hop_ip_model_json2 == route_prototype_next_hop_route_next_hop_prototype_route_next_hop_ip_model_json + class TestModel_RoutingTableIdentityByHref(): """ Test Class for RoutingTableIdentityByHref @@ -55659,6 +60016,45 @@ def test_security_group_target_reference_network_interface_reference_target_cont security_group_target_reference_network_interface_reference_target_context_model_json2 = security_group_target_reference_network_interface_reference_target_context_model.to_dict() assert security_group_target_reference_network_interface_reference_target_context_model_json2 == security_group_target_reference_network_interface_reference_target_context_model_json +class TestModel_SecurityGroupTargetReferenceVPNServerReference(): + """ + Test Class for SecurityGroupTargetReferenceVPNServerReference + """ + + def test_security_group_target_reference_vpn_server_reference_serialization(self): + """ + Test serialization/deserialization for SecurityGroupTargetReferenceVPNServerReference + """ + + # Construct dict forms of any model objects needed in order to build this model. + + vpn_server_reference_deleted_model = {} # VPNServerReferenceDeleted + vpn_server_reference_deleted_model['more_info'] = 'https://cloud.ibm.com/apidocs/vpc#deleted-resources' + + # Construct a json representation of a SecurityGroupTargetReferenceVPNServerReference model + security_group_target_reference_vpn_server_reference_model_json = {} + security_group_target_reference_vpn_server_reference_model_json['crn'] = 'crn:v1:bluemix:public:is:us-south:a/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5' + security_group_target_reference_vpn_server_reference_model_json['deleted'] = vpn_server_reference_deleted_model + security_group_target_reference_vpn_server_reference_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5' + security_group_target_reference_vpn_server_reference_model_json['id'] = 'r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5' + security_group_target_reference_vpn_server_reference_model_json['name'] = 'my-vpn-server' + security_group_target_reference_vpn_server_reference_model_json['resource_type'] = 'vpn_server' + + # Construct a model instance of SecurityGroupTargetReferenceVPNServerReference by calling from_dict on the json representation + security_group_target_reference_vpn_server_reference_model = SecurityGroupTargetReferenceVPNServerReference.from_dict(security_group_target_reference_vpn_server_reference_model_json) + assert security_group_target_reference_vpn_server_reference_model != False + + # Construct a model instance of SecurityGroupTargetReferenceVPNServerReference by calling from_dict on the json representation + security_group_target_reference_vpn_server_reference_model_dict = SecurityGroupTargetReferenceVPNServerReference.from_dict(security_group_target_reference_vpn_server_reference_model_json).__dict__ + security_group_target_reference_vpn_server_reference_model2 = SecurityGroupTargetReferenceVPNServerReference(**security_group_target_reference_vpn_server_reference_model_dict) + + # Verify the model instances are equivalent + assert security_group_target_reference_vpn_server_reference_model == security_group_target_reference_vpn_server_reference_model2 + + # Convert model instance back to dict and verify no loss of data + security_group_target_reference_vpn_server_reference_model_json2 = security_group_target_reference_vpn_server_reference_model.to_dict() + assert security_group_target_reference_vpn_server_reference_model_json2 == security_group_target_reference_vpn_server_reference_model_json + class TestModel_SnapshotIdentityByCRN(): """ Test Class for SnapshotIdentityByCRN @@ -56982,6 +61378,177 @@ def test_vpn_gateway_route_mode_serialization(self): vpn_gateway_route_mode_model_json2 = vpn_gateway_route_mode_model.to_dict() assert vpn_gateway_route_mode_model_json2 == vpn_gateway_route_mode_model_json +class TestModel_VPNServerAuthenticationByCertificate(): + """ + Test Class for VPNServerAuthenticationByCertificate + """ + + def test_vpn_server_authentication_by_certificate_serialization(self): + """ + Test serialization/deserialization for VPNServerAuthenticationByCertificate + """ + + # Construct dict forms of any model objects needed in order to build this model. + + certificate_instance_reference_model = {} # CertificateInstanceReference + certificate_instance_reference_model['crn'] = 'crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5' + + # Construct a json representation of a VPNServerAuthenticationByCertificate model + vpn_server_authentication_by_certificate_model_json = {} + vpn_server_authentication_by_certificate_model_json['method'] = 'certificate' + vpn_server_authentication_by_certificate_model_json['client_ca'] = certificate_instance_reference_model + vpn_server_authentication_by_certificate_model_json['crl'] = 'testString' + + # Construct a model instance of VPNServerAuthenticationByCertificate by calling from_dict on the json representation + vpn_server_authentication_by_certificate_model = VPNServerAuthenticationByCertificate.from_dict(vpn_server_authentication_by_certificate_model_json) + assert vpn_server_authentication_by_certificate_model != False + + # Construct a model instance of VPNServerAuthenticationByCertificate by calling from_dict on the json representation + vpn_server_authentication_by_certificate_model_dict = VPNServerAuthenticationByCertificate.from_dict(vpn_server_authentication_by_certificate_model_json).__dict__ + vpn_server_authentication_by_certificate_model2 = VPNServerAuthenticationByCertificate(**vpn_server_authentication_by_certificate_model_dict) + + # Verify the model instances are equivalent + assert vpn_server_authentication_by_certificate_model == vpn_server_authentication_by_certificate_model2 + + # Convert model instance back to dict and verify no loss of data + vpn_server_authentication_by_certificate_model_json2 = vpn_server_authentication_by_certificate_model.to_dict() + assert vpn_server_authentication_by_certificate_model_json2 == vpn_server_authentication_by_certificate_model_json + +class TestModel_VPNServerAuthenticationByUsername(): + """ + Test Class for VPNServerAuthenticationByUsername + """ + + def test_vpn_server_authentication_by_username_serialization(self): + """ + Test serialization/deserialization for VPNServerAuthenticationByUsername + """ + + # Construct dict forms of any model objects needed in order to build this model. + + vpn_server_authentication_by_username_id_provider_model = {} # VPNServerAuthenticationByUsernameIdProviderByIAM + vpn_server_authentication_by_username_id_provider_model['provider_type'] = 'iam' + + # Construct a json representation of a VPNServerAuthenticationByUsername model + vpn_server_authentication_by_username_model_json = {} + vpn_server_authentication_by_username_model_json['method'] = 'certificate' + vpn_server_authentication_by_username_model_json['identity_provider'] = vpn_server_authentication_by_username_id_provider_model + + # Construct a model instance of VPNServerAuthenticationByUsername by calling from_dict on the json representation + vpn_server_authentication_by_username_model = VPNServerAuthenticationByUsername.from_dict(vpn_server_authentication_by_username_model_json) + assert vpn_server_authentication_by_username_model != False + + # Construct a model instance of VPNServerAuthenticationByUsername by calling from_dict on the json representation + vpn_server_authentication_by_username_model_dict = VPNServerAuthenticationByUsername.from_dict(vpn_server_authentication_by_username_model_json).__dict__ + vpn_server_authentication_by_username_model2 = VPNServerAuthenticationByUsername(**vpn_server_authentication_by_username_model_dict) + + # Verify the model instances are equivalent + assert vpn_server_authentication_by_username_model == vpn_server_authentication_by_username_model2 + + # Convert model instance back to dict and verify no loss of data + vpn_server_authentication_by_username_model_json2 = vpn_server_authentication_by_username_model.to_dict() + assert vpn_server_authentication_by_username_model_json2 == vpn_server_authentication_by_username_model_json + +class TestModel_VPNServerAuthenticationByUsernameIdProviderByIAM(): + """ + Test Class for VPNServerAuthenticationByUsernameIdProviderByIAM + """ + + def test_vpn_server_authentication_by_username_id_provider_by_iam_serialization(self): + """ + Test serialization/deserialization for VPNServerAuthenticationByUsernameIdProviderByIAM + """ + + # Construct a json representation of a VPNServerAuthenticationByUsernameIdProviderByIAM model + vpn_server_authentication_by_username_id_provider_by_iam_model_json = {} + vpn_server_authentication_by_username_id_provider_by_iam_model_json['provider_type'] = 'iam' + + # Construct a model instance of VPNServerAuthenticationByUsernameIdProviderByIAM by calling from_dict on the json representation + vpn_server_authentication_by_username_id_provider_by_iam_model = VPNServerAuthenticationByUsernameIdProviderByIAM.from_dict(vpn_server_authentication_by_username_id_provider_by_iam_model_json) + assert vpn_server_authentication_by_username_id_provider_by_iam_model != False + + # Construct a model instance of VPNServerAuthenticationByUsernameIdProviderByIAM by calling from_dict on the json representation + vpn_server_authentication_by_username_id_provider_by_iam_model_dict = VPNServerAuthenticationByUsernameIdProviderByIAM.from_dict(vpn_server_authentication_by_username_id_provider_by_iam_model_json).__dict__ + vpn_server_authentication_by_username_id_provider_by_iam_model2 = VPNServerAuthenticationByUsernameIdProviderByIAM(**vpn_server_authentication_by_username_id_provider_by_iam_model_dict) + + # Verify the model instances are equivalent + assert vpn_server_authentication_by_username_id_provider_by_iam_model == vpn_server_authentication_by_username_id_provider_by_iam_model2 + + # Convert model instance back to dict and verify no loss of data + vpn_server_authentication_by_username_id_provider_by_iam_model_json2 = vpn_server_authentication_by_username_id_provider_by_iam_model.to_dict() + assert vpn_server_authentication_by_username_id_provider_by_iam_model_json2 == vpn_server_authentication_by_username_id_provider_by_iam_model_json + +class TestModel_VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype(): + """ + Test Class for VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype + """ + + def test_vpn_server_authentication_prototype_vpn_server_authentication_by_certificate_prototype_serialization(self): + """ + Test serialization/deserialization for VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype + """ + + # Construct dict forms of any model objects needed in order to build this model. + + certificate_instance_identity_model = {} # CertificateInstanceIdentityByCRN + certificate_instance_identity_model['crn'] = 'crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5' + + # Construct a json representation of a VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype model + vpn_server_authentication_prototype_vpn_server_authentication_by_certificate_prototype_model_json = {} + vpn_server_authentication_prototype_vpn_server_authentication_by_certificate_prototype_model_json['method'] = 'certificate' + vpn_server_authentication_prototype_vpn_server_authentication_by_certificate_prototype_model_json['client_ca'] = certificate_instance_identity_model + vpn_server_authentication_prototype_vpn_server_authentication_by_certificate_prototype_model_json['crl'] = 'testString' + + # Construct a model instance of VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype by calling from_dict on the json representation + vpn_server_authentication_prototype_vpn_server_authentication_by_certificate_prototype_model = VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype.from_dict(vpn_server_authentication_prototype_vpn_server_authentication_by_certificate_prototype_model_json) + assert vpn_server_authentication_prototype_vpn_server_authentication_by_certificate_prototype_model != False + + # Construct a model instance of VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype by calling from_dict on the json representation + vpn_server_authentication_prototype_vpn_server_authentication_by_certificate_prototype_model_dict = VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype.from_dict(vpn_server_authentication_prototype_vpn_server_authentication_by_certificate_prototype_model_json).__dict__ + vpn_server_authentication_prototype_vpn_server_authentication_by_certificate_prototype_model2 = VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype(**vpn_server_authentication_prototype_vpn_server_authentication_by_certificate_prototype_model_dict) + + # Verify the model instances are equivalent + assert vpn_server_authentication_prototype_vpn_server_authentication_by_certificate_prototype_model == vpn_server_authentication_prototype_vpn_server_authentication_by_certificate_prototype_model2 + + # Convert model instance back to dict and verify no loss of data + vpn_server_authentication_prototype_vpn_server_authentication_by_certificate_prototype_model_json2 = vpn_server_authentication_prototype_vpn_server_authentication_by_certificate_prototype_model.to_dict() + assert vpn_server_authentication_prototype_vpn_server_authentication_by_certificate_prototype_model_json2 == vpn_server_authentication_prototype_vpn_server_authentication_by_certificate_prototype_model_json + +class TestModel_VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype(): + """ + Test Class for VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype + """ + + def test_vpn_server_authentication_prototype_vpn_server_authentication_by_username_prototype_serialization(self): + """ + Test serialization/deserialization for VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype + """ + + # Construct dict forms of any model objects needed in order to build this model. + + vpn_server_authentication_by_username_id_provider_model = {} # VPNServerAuthenticationByUsernameIdProviderByIAM + vpn_server_authentication_by_username_id_provider_model['provider_type'] = 'iam' + + # Construct a json representation of a VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpn_server_authentication_prototype_vpn_server_authentication_by_username_prototype_model_json = {} + vpn_server_authentication_prototype_vpn_server_authentication_by_username_prototype_model_json['method'] = 'username' + vpn_server_authentication_prototype_vpn_server_authentication_by_username_prototype_model_json['identity_provider'] = vpn_server_authentication_by_username_id_provider_model + + # Construct a model instance of VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype by calling from_dict on the json representation + vpn_server_authentication_prototype_vpn_server_authentication_by_username_prototype_model = VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype.from_dict(vpn_server_authentication_prototype_vpn_server_authentication_by_username_prototype_model_json) + assert vpn_server_authentication_prototype_vpn_server_authentication_by_username_prototype_model != False + + # Construct a model instance of VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype by calling from_dict on the json representation + vpn_server_authentication_prototype_vpn_server_authentication_by_username_prototype_model_dict = VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype.from_dict(vpn_server_authentication_prototype_vpn_server_authentication_by_username_prototype_model_json).__dict__ + vpn_server_authentication_prototype_vpn_server_authentication_by_username_prototype_model2 = VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype(**vpn_server_authentication_prototype_vpn_server_authentication_by_username_prototype_model_dict) + + # Verify the model instances are equivalent + assert vpn_server_authentication_prototype_vpn_server_authentication_by_username_prototype_model == vpn_server_authentication_prototype_vpn_server_authentication_by_username_prototype_model2 + + # Convert model instance back to dict and verify no loss of data + vpn_server_authentication_prototype_vpn_server_authentication_by_username_prototype_model_json2 = vpn_server_authentication_prototype_vpn_server_authentication_by_username_prototype_model.to_dict() + assert vpn_server_authentication_prototype_vpn_server_authentication_by_username_prototype_model_json2 == vpn_server_authentication_prototype_vpn_server_authentication_by_username_prototype_model_json + class TestModel_VolumeIdentityByCRN(): """ Test Class for VolumeIdentityByCRN @@ -57177,6 +61744,60 @@ def test_volume_prototype_volume_by_capacity_serialization(self): volume_prototype_volume_by_capacity_model_json2 = volume_prototype_volume_by_capacity_model.to_dict() assert volume_prototype_volume_by_capacity_model_json2 == volume_prototype_volume_by_capacity_model_json +class TestModel_VolumePrototypeVolumeBySourceSnapshot(): + """ + Test Class for VolumePrototypeVolumeBySourceSnapshot + """ + + def test_volume_prototype_volume_by_source_snapshot_serialization(self): + """ + Test serialization/deserialization for VolumePrototypeVolumeBySourceSnapshot + """ + + # Construct dict forms of any model objects needed in order to build this model. + + volume_profile_identity_model = {} # VolumeProfileIdentityByName + volume_profile_identity_model['name'] = 'general-purpose' + + resource_group_identity_model = {} # ResourceGroupIdentityById + resource_group_identity_model['id'] = 'fee82deba12e4c0fb69c3b09d1f12345' + + zone_identity_model = {} # ZoneIdentityByName + zone_identity_model['name'] = 'us-south-1' + + encryption_key_identity_model = {} # EncryptionKeyIdentityByCRN + encryption_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179' + + snapshot_identity_model = {} # SnapshotIdentityById + snapshot_identity_model['id'] = '349a61d8-7ab1-420f-a690-5fed76ef9d4f' + + # Construct a json representation of a VolumePrototypeVolumeBySourceSnapshot model + volume_prototype_volume_by_source_snapshot_model_json = {} + volume_prototype_volume_by_source_snapshot_model_json['iops'] = 10000 + volume_prototype_volume_by_source_snapshot_model_json['name'] = 'my-volume' + volume_prototype_volume_by_source_snapshot_model_json['profile'] = volume_profile_identity_model + volume_prototype_volume_by_source_snapshot_model_json['resource_group'] = resource_group_identity_model + volume_prototype_volume_by_source_snapshot_model_json['user_tags'] = ['testString'] + volume_prototype_volume_by_source_snapshot_model_json['zone'] = zone_identity_model + volume_prototype_volume_by_source_snapshot_model_json['capacity'] = 100 + volume_prototype_volume_by_source_snapshot_model_json['encryption_key'] = encryption_key_identity_model + volume_prototype_volume_by_source_snapshot_model_json['source_snapshot'] = snapshot_identity_model + + # Construct a model instance of VolumePrototypeVolumeBySourceSnapshot by calling from_dict on the json representation + volume_prototype_volume_by_source_snapshot_model = VolumePrototypeVolumeBySourceSnapshot.from_dict(volume_prototype_volume_by_source_snapshot_model_json) + assert volume_prototype_volume_by_source_snapshot_model != False + + # Construct a model instance of VolumePrototypeVolumeBySourceSnapshot by calling from_dict on the json representation + volume_prototype_volume_by_source_snapshot_model_dict = VolumePrototypeVolumeBySourceSnapshot.from_dict(volume_prototype_volume_by_source_snapshot_model_json).__dict__ + volume_prototype_volume_by_source_snapshot_model2 = VolumePrototypeVolumeBySourceSnapshot(**volume_prototype_volume_by_source_snapshot_model_dict) + + # Verify the model instances are equivalent + assert volume_prototype_volume_by_source_snapshot_model == volume_prototype_volume_by_source_snapshot_model2 + + # Convert model instance back to dict and verify no loss of data + volume_prototype_volume_by_source_snapshot_model_json2 = volume_prototype_volume_by_source_snapshot_model.to_dict() + assert volume_prototype_volume_by_source_snapshot_model_json2 == volume_prototype_volume_by_source_snapshot_model_json + class TestModel_ZoneIdentityByHref(): """ Test Class for ZoneIdentityByHref @@ -58735,63 +63356,63 @@ def test_reserved_ip_target_prototype_endpoint_gateway_identity_endpoint_gateway reserved_ip_target_prototype_endpoint_gateway_identity_endpoint_gateway_identity_by_id_model_json2 = reserved_ip_target_prototype_endpoint_gateway_identity_endpoint_gateway_identity_by_id_model.to_dict() assert reserved_ip_target_prototype_endpoint_gateway_identity_endpoint_gateway_identity_by_id_model_json2 == reserved_ip_target_prototype_endpoint_gateway_identity_endpoint_gateway_identity_by_id_model_json -class TestModel_RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(): +class TestModel_RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(): """ - Test Class for RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref + Test Class for RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref """ - def test_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_serialization(self): + def test_route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_serialization(self): """ - Test serialization/deserialization for RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref + Test serialization/deserialization for RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref """ - # Construct a json representation of a RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref model - route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model_json = {} - route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b' + # Construct a json representation of a RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref model + route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model_json = {} + route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model_json['href'] = 'https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b' - # Construct a model instance of RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref by calling from_dict on the json representation - route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model = RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref.from_dict(route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model_json) - assert route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model != False + # Construct a model instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref by calling from_dict on the json representation + route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model = RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref.from_dict(route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model_json) + assert route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model != False - # Construct a model instance of RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref by calling from_dict on the json representation - route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model_dict = RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref.from_dict(route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model_json).__dict__ - route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model2 = RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(**route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model_dict) + # Construct a model instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref by calling from_dict on the json representation + route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model_dict = RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref.from_dict(route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model_json).__dict__ + route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model2 = RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(**route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model_dict) # Verify the model instances are equivalent - assert route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model == route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model2 + assert route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model == route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model2 # Convert model instance back to dict and verify no loss of data - route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model_json2 = route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model.to_dict() - assert route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model_json2 == route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model_json + route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model_json2 = route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model.to_dict() + assert route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model_json2 == route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_href_model_json -class TestModel_RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById(): +class TestModel_RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById(): """ - Test Class for RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById + Test Class for RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById """ - def test_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_serialization(self): + def test_route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_serialization(self): """ - Test serialization/deserialization for RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById + Test serialization/deserialization for RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById """ - # Construct a json representation of a RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById model - route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model_json = {} - route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model_json['id'] = 'a10a5771-dc23-442c-8460-c3601d8542f7' + # Construct a json representation of a RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById model + route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model_json = {} + route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model_json['id'] = 'a10a5771-dc23-442c-8460-c3601d8542f7' - # Construct a model instance of RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById by calling from_dict on the json representation - route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model = RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById.from_dict(route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model_json) - assert route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model != False + # Construct a model instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById by calling from_dict on the json representation + route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model = RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById.from_dict(route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model_json) + assert route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model != False - # Construct a model instance of RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById by calling from_dict on the json representation - route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model_dict = RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById.from_dict(route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model_json).__dict__ - route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model2 = RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById(**route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model_dict) + # Construct a model instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById by calling from_dict on the json representation + route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model_dict = RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById.from_dict(route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model_json).__dict__ + route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model2 = RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityById(**route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model_dict) # Verify the model instances are equivalent - assert route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model == route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model2 + assert route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model == route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model2 # Convert model instance back to dict and verify no loss of data - route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model_json2 = route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model.to_dict() - assert route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model_json2 == route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model_json + route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model_json2 = route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model.to_dict() + assert route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model_json2 == route_prototype_next_hop_route_next_hop_prototype_vpn_gateway_connection_identity_route_next_hop_prototype_vpn_gateway_connection_identity_vpn_gateway_connection_identity_by_id_model_json class TestModel_SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN(): """